govuk_publishing_components 51.2.0 → 52.0.0

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.
Files changed (19) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +29 -34
  3. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +7 -2
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +0 -7
  5. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -2
  6. data/app/views/govuk_publishing_components/components/_add_another.html.erb +10 -6
  7. data/app/views/govuk_publishing_components/components/_copy_to_clipboard.html.erb +6 -2
  8. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +1 -5
  9. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -2
  10. data/app/views/govuk_publishing_components/components/docs/add_another.yml +1 -1
  11. data/app/views/govuk_publishing_components/components/docs/copy_to_clipboard.yml +1 -0
  12. data/app/views/govuk_publishing_components/components/docs/feedback.yml +1 -1
  13. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +685 -566
  14. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +0 -16
  15. data/app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml +1 -7
  16. data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +6 -2
  17. data/app/views/govuk_publishing_components/components/layout_for_public/_layout_super_navigation_header_homepage.html.erb +0 -1
  18. data/lib/govuk_publishing_components/version.rb +1 -1
  19. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db74fa9c85934d448152da8903352a36ab46a513068455227b209267bb698a3f
4
- data.tar.gz: 2fdd9cb41e512fab8054ee4005af8eabd2fa006394a19940388946e4887a31e6
3
+ metadata.gz: 198f8ac365179c47560311c0629f3ff7e8e698cc3dbc96d2e7b400e8fc090a0d
4
+ data.tar.gz: dee1f0c019a773b93009f9028ae39e9f4c9cb8c3d344df15e89c04a9021dae50
5
5
  SHA512:
6
- metadata.gz: 1d9d34b3457fb88865bac9df441cd621abba687e5c624a661b6e1f24bb922b2ce8d0eb1f5f9737093096d10bdd0433ea3f23a04e2b20e58f58cff172a67de729
7
- data.tar.gz: 702d5378bd7d5c1278155f7ad564bea78098a0bb80883abde47c917170f1c42b010de450ba06897517af1809c69b93e1720c772bc8986faabaaed40811eba312
6
+ metadata.gz: ee48bbc9936311ebceb2c168f63ac94e13345b59507e1cf9a7268c5a752a1f7898a5a985e4cf9e606bb186f6b4cce4b830f7ef1fc9cf4cdbc593160f9cbff7db
7
+ data.tar.gz: 8468d0dd135db6de987149366fb6388b07603c2e8cc9248f2ab2818d17136e2af361c28a871bd17bf5cf97433fefafd1828a70b4ceaba1b20c2879b9f132d12c
@@ -69,40 +69,35 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
69
69
  }.bind(this), 1000)
70
70
  }.bind(this))
71
71
 
72
- // much of the JS needed to support sending the form contents via this script is
73
- // unsupported by IE, even IE11. This check causes IE to not intercept form submits
74
- // and let them happen normally, which is handled already by the backend
75
- if (typeof window.URLSearchParams === 'function') {
76
- for (var f = 0; f < this.forms.length; f++) {
77
- this.forms[f].addEventListener('submit', function (e) {
78
- e.preventDefault()
79
- var $form = e.target
80
- var xhr = new XMLHttpRequest()
81
- var url = $form.getAttribute('action')
82
- var params = new FormData($form)
83
- params = new URLSearchParams(params).toString()
84
-
85
- this.done = function () {
86
- if (xhr.status === 200) {
87
- this.showFormSuccess(xhr.message)
88
- this.revealInitialPrompt()
89
- this.setInitialAriaAttributes()
90
- this.activeForm.hidden = true
91
- clearInterval(this.timerInterval)
92
- } else {
93
- this.showError(xhr)
94
- this.enableSubmitFormButton($form)
95
- }
96
- }.bind(this)
97
-
98
- xhr.addEventListener('loadend', this.done)
99
- xhr.open('POST', url, true)
100
- xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
101
-
102
- this.disableSubmitFormButton($form)
103
- xhr.send(params)
104
- }.bind(this))
105
- }
72
+ for (var f = 0; f < this.forms.length; f++) {
73
+ this.forms[f].addEventListener('submit', function (e) {
74
+ e.preventDefault()
75
+ var $form = e.target
76
+ var xhr = new XMLHttpRequest()
77
+ var url = $form.getAttribute('action')
78
+ var params = new FormData($form)
79
+ params = new URLSearchParams(params).toString()
80
+
81
+ this.done = function () {
82
+ if (xhr.status === 200) {
83
+ this.showFormSuccess(xhr.message)
84
+ this.revealInitialPrompt()
85
+ this.setInitialAriaAttributes()
86
+ this.activeForm.hidden = true
87
+ clearInterval(this.timerInterval)
88
+ } else {
89
+ this.showError(xhr)
90
+ this.enableSubmitFormButton($form)
91
+ }
92
+ }.bind(this)
93
+
94
+ xhr.addEventListener('loadend', this.done)
95
+ xhr.open('POST', url, true)
96
+ xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
97
+
98
+ this.disableSubmitFormButton($form)
99
+ xhr.send(params)
100
+ }.bind(this))
106
101
  }
107
102
  }
108
103
 
@@ -336,7 +336,7 @@
336
336
  return str;
337
337
  }
338
338
 
339
- var VERSION = "4.0.29";
339
+ var VERSION = "4.0.30";
340
340
  /**
341
341
  * Returns the version of the script as a float to be stored in legacy systems that do not support
342
342
  * string versions.
@@ -622,6 +622,10 @@
622
622
  }
623
623
  var MAX_SELECTOR_LENGTH = 100;
624
624
  function getNodeSelector(node, selector) {
625
+ if (selector === void 0) { selector = ""; }
626
+ return _getNodeSelector(node, selector).slice(0, MAX_SELECTOR_LENGTH);
627
+ }
628
+ function _getNodeSelector(node, selector) {
625
629
  if (selector === void 0) { selector = ""; }
626
630
  try {
627
631
  if (selector &&
@@ -668,6 +672,7 @@
668
672
  var sessionAttributions = [];
669
673
  var largestEntry;
670
674
  var maximumSessionValue = 0;
675
+ var MAX_CLS_SOURCES = 50;
671
676
  function processEntry$2(entry) {
672
677
  if (!entry.hadRecentInput) {
673
678
  var firstEntry = sessionEntries[0];
@@ -717,7 +722,7 @@
717
722
  startTime: processTimeMetric(largestEntry.startTime),
718
723
  }
719
724
  : null,
720
- sources: sessionAttributions.length ? sessionAttributions : null,
725
+ sources: sessionAttributions.length ? sessionAttributions.slice(0, MAX_CLS_SOURCES) : null,
721
726
  };
722
727
  }
723
728
 
@@ -311,12 +311,10 @@ $after-button-padding-left: govuk-spacing(4);
311
311
  }
312
312
 
313
313
  .gem-c-layout-super-navigation-header__navigation-item-link-inner {
314
- border-left: 1px solid $button-pipe-colour;
315
314
  padding: govuk-spacing(1) $after-link-padding;
316
315
  }
317
316
 
318
317
  .gem-c-layout-super-navigation-header__navigation-item-link-inner--blue-background {
319
- border-left: 0;
320
318
  border-right: 1px solid $pale-blue-colour;
321
319
  }
322
320
 
@@ -589,7 +587,6 @@ $after-button-padding-left: govuk-spacing(4);
589
587
 
590
588
  .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
591
589
  display: inline-block;
592
- border-left: 1px solid govuk-colour("white");
593
590
  border-right: 1px solid govuk-colour("white");
594
591
  margin: 0;
595
592
  padding: govuk-spacing(1) govuk-spacing(4);
@@ -601,10 +598,6 @@ $after-button-padding-left: govuk-spacing(4);
601
598
  }
602
599
  }
603
600
 
604
- .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--no-left-border {
605
- border-left: 0;
606
- }
607
-
608
601
  // Styles for search toggle button.
609
602
  .gem-c-layout-super-navigation-header__search-toggle-button {
610
603
  background: none;
@@ -31,12 +31,11 @@
31
31
 
32
32
  h2 {
33
33
  margin-top: $govuk-gutter;
34
- margin-bottom: 0;
34
+ margin-bottom: govuk-spacing(4);
35
35
  @include govuk-font($size: 27, $weight: bold);
36
36
 
37
37
  @include govuk-media-query($from: desktop) {
38
38
  margin-top: $govuk-gutter * 1.5;
39
- margin-bottom: 0;
40
39
  }
41
40
  }
42
41
 
@@ -5,14 +5,18 @@
5
5
  fieldset_legend ||= ""
6
6
  add_button_text ||= "Add another"
7
7
  empty_fields ||= false
8
+
9
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
10
+ component_helper.add_class("gem-c-add-another")
11
+ component_helper.add_data_attribute({
12
+ module: "add-another",
13
+ add_button_text:,
14
+ fieldset_legend:,
15
+ empty_fields:,
16
+ })
8
17
  %>
9
18
 
10
- <%= tag.div class: "gem-c-add-another", data: {
11
- module: "add-another",
12
- "add-button-text": add_button_text,
13
- "fieldset-legend": fieldset_legend,
14
- "empty-fields": empty_fields
15
- } do %>
19
+ <%= tag.div(**component_helper.all_attributes) do %>
16
20
  <% unless empty_fields && items.count == 0 %>
17
21
  <% items.each_with_index do |item, index| %>
18
22
  <%= render "govuk_publishing_components/components/fieldset", {
@@ -1,8 +1,12 @@
1
1
  <%
2
2
  button_data_attributes ||= nil
3
3
  input_data_attributes ||= nil
4
+
5
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
6
+ component_helper.add_class("gem-c-copy-to-clipboard")
7
+ component_helper.add_data_attribute({ module: "copy-to-clipboard" })
4
8
  %>
5
- <div class="gem-c-copy-to-clipboard" data-module="copy-to-clipboard">
9
+ <%= tag.div(**component_helper.all_attributes) do %>
6
10
  <%= render "govuk_publishing_components/components/input", {
7
11
  label: {
8
12
  text: label,
@@ -19,4 +23,4 @@
19
23
  data_attributes: button_data_attributes,
20
24
  secondary_quiet: true,
21
25
  } %>
22
- </div>
26
+ <% end %>
@@ -18,7 +18,6 @@
18
18
  omit_footer_navigation ||= false
19
19
  omit_footer_border ||= false
20
20
  omit_header ||= false
21
- custom_layout ||= false
22
21
  product_name ||= nil
23
22
  show_explore_header ||= false
24
23
  show_cross_service_header ||= false
@@ -119,8 +118,6 @@
119
118
  service_navigation_items: service_navigation_items,
120
119
  product_name: product_name,
121
120
  } %>
122
- <% elsif content_for?(:custom_header) %>
123
- <%= yield :custom_header %>
124
121
  <% else %>
125
122
  <%= render "govuk_publishing_components/components/layout_header", {
126
123
  search: show_search,
@@ -156,12 +153,11 @@
156
153
  omit_account_phase_banner: omit_account_phase_banner,
157
154
  omit_account_navigation: omit_account_navigation,
158
155
  account_nav_location: account_nav_location,
156
+ for_static: for_static,
159
157
  } do %>
160
158
  <%= yield :before_content %>
161
159
  <%= yield %>
162
160
  <% end %>
163
- <% elsif custom_layout %>
164
- <%= yield %>
165
161
  <% elsif for_static %>
166
162
  <div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
167
163
  <%= yield :before_content %>
@@ -7,7 +7,6 @@
7
7
  logo_text = t("components.layout_super_navigation_header.logo_text")
8
8
 
9
9
  hide_logo_text ||= false
10
- hide_button_left_border ||= false
11
10
  blue_background ||= false
12
11
  large_navbar ||= false
13
12
 
@@ -28,7 +27,6 @@
28
27
  top_toggle_button_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button--large-navbar" if large_navbar
29
28
 
30
29
  top_toggle_button_inner_classes = %w(gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner)
31
- top_toggle_button_inner_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--no-left-border" if hide_button_left_border
32
30
  top_toggle_button_inner_classes << "gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner--blue-background" if blue_background
33
31
 
34
32
  search_toggle_button_classes = %w(gem-c-layout-super-navigation-header__search-toggle-button)
@@ -20,7 +20,7 @@ body: |
20
20
  accessibility_criteria: |
21
21
  The form controls within the fieldsets must be fully accessible as per the
22
22
  design system guidance for each of the form control components.
23
- uses_component_wrapper_helper: false
23
+ uses_component_wrapper_helper: true
24
24
  govuk_frontend_components:
25
25
  - button
26
26
  examples:
@@ -1,5 +1,6 @@
1
1
  name: Copy to clipboard
2
2
  description: Content that a user is intended to copy, like a URL
3
+ uses_component_wrapper_helper: true
3
4
  examples:
4
5
  default:
5
6
  data:
@@ -3,7 +3,7 @@ description: Invites user feedback on the current page.
3
3
  body: |
4
4
  This component is designed to sit at the bottom of pages on GOV.UK to allow users to submit feedback on that page.
5
5
 
6
- This component uses JavaScript for expanding and collapsing and also for submitting form responses. This code is not compatible with Internet Explorer, so IE11 and down do not use JavaScript to submit the forms, instead falling back to a normal form submission.
6
+ This component uses JavaScript for expanding and collapsing and also for submitting form responses. Users without JavaScript will fall back to a normal form submission.
7
7
  uses_component_wrapper_helper: true
8
8
  accessibility_criteria: |
9
9
  The form must: