govuk_publishing_components 23.13.0 → 24.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/take-action-amber.svg +4 -0
  3. data/app/assets/images/govuk_publishing_components/take-action-green.svg +4 -0
  4. data/app/assets/images/govuk_publishing_components/take-action-red.svg +4 -0
  5. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +286 -4
  6. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +0 -4
  7. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +44 -39
  8. data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js +8 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +0 -1
  10. data/app/assets/stylesheets/govuk_publishing_components/component_support.scss +0 -2
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +302 -14
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +34 -17
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +14 -8
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss +4 -4
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +35 -44
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +112 -47
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +8 -8
  18. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +0 -5
  19. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +16 -9
  20. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss +2 -2
  21. data/app/models/govuk_publishing_components/component_doc.rb +1 -1
  22. data/app/views/govuk_publishing_components/audit/show.html.erb +26 -26
  23. data/app/views/govuk_publishing_components/components/_accordion.html.erb +13 -20
  24. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +2 -8
  25. data/app/views/govuk_publishing_components/components/_document_list.html.erb +12 -2
  26. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +9 -4
  27. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -2
  28. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +21 -0
  29. data/app/views/govuk_publishing_components/components/docs/accordion.yml +8 -3
  30. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +65 -1
  31. data/app/views/govuk_publishing_components/components/docs/document_list.yml +50 -7
  32. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +3 -3
  33. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +11 -0
  34. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +9 -4
  36. data/config/initializers/assets.rb +3 -1
  37. data/config/locales/cy.yml +6 -1
  38. data/config/locales/en.yml +8 -3
  39. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +183 -2
  40. data/lib/govuk_publishing_components/version.rb +1 -1
  41. data/node_modules/govuk-frontend/govuk/all.js +58 -1
  42. data/node_modules/govuk-frontend/govuk/components/_all.scss +2 -0
  43. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +25 -10
  44. data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +12 -6
  45. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +4 -4
  46. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +34 -13
  47. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -0
  48. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/template.njk +2 -2
  49. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +2 -0
  50. data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +74 -31
  51. data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +1 -0
  52. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +1 -1
  53. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +85 -15
  54. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +1 -1
  55. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +145 -52
  56. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +2 -2
  57. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_cookie-banner.scss +2 -0
  58. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +51 -0
  59. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +425 -0
  60. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +132 -0
  61. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro.njk +3 -0
  62. data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +63 -0
  63. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +84 -34
  64. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  65. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  66. data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +35 -15
  67. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +21 -10
  68. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -0
  69. data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +2 -12
  70. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +86 -25
  71. data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +20 -10
  72. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +60 -13
  73. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +37 -18
  74. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +8 -5
  75. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +36 -18
  76. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +2 -2
  77. data/node_modules/govuk-frontend/govuk/components/header/template.njk +4 -4
  78. data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +17 -8
  79. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +130 -40
  80. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +1 -1
  81. data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +17 -8
  82. data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +20 -11
  83. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
  84. data/node_modules/govuk-frontend/govuk/components/notification-banner/README.md +15 -0
  85. data/node_modules/govuk-frontend/govuk/components/notification-banner/_index.scss +89 -0
  86. data/node_modules/govuk-frontend/govuk/components/notification-banner/_notification-banner.scss +2 -0
  87. data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +212 -0
  88. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +68 -0
  89. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro.njk +3 -0
  90. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +61 -0
  91. data/node_modules/govuk-frontend/govuk/components/notification-banner/template.njk +47 -0
  92. data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +30 -13
  93. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +20 -9
  94. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +167 -50
  95. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +97 -18
  96. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +1 -1
  97. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +21 -9
  98. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +118 -25
  99. data/node_modules/govuk-frontend/govuk/components/table/_index.scss +21 -0
  100. data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +92 -22
  101. data/node_modules/govuk-frontend/govuk/components/table/macro-options.json +2 -2
  102. data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +75 -18
  103. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
  104. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +28 -14
  105. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +68 -17
  106. data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +19 -14
  107. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +94 -0
  108. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  109. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +94 -0
  110. data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +9 -0
  111. data/node_modules/govuk-frontend/govuk/settings/_typography-font.scss +3 -0
  112. data/node_modules/govuk-frontend/package.json +1 -1
  113. metadata +21 -18
  114. data/app/assets/images/govuk_publishing_components/chevron-banner/chevron-banner-small-focus.svg +0 -4
  115. data/app/assets/images/govuk_publishing_components/chevron-banner/chevron-banner-small.svg +0 -4
  116. data/app/assets/javascripts/govuk_publishing_components/components/header.js +0 -8
  117. data/app/assets/javascripts/govuk_publishing_components/lib/auto-track-event.js +0 -31
  118. data/app/assets/stylesheets/govuk_publishing_components/components/_chevron-banner.scss +0 -138
  119. data/app/assets/stylesheets/govuk_publishing_components/components/_list.scss +0 -1
  120. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_variables.scss +0 -27
  121. data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_back-arrow.scss +0 -13
  122. data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_clearfix.scss +0 -8
  123. data/app/views/govuk_publishing_components/components/_chevron_banner.html.erb +0 -19
  124. data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +0 -85
  125. data/app/views/govuk_publishing_components/components/_translation-nav.html.erb +0 -33
  126. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_related_links.html.erb +0 -6
  127. data/app/views/govuk_publishing_components/components/docs/chevron_banner.yml +0 -33
  128. data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +0 -103
  129. data/app/views/govuk_publishing_components/components/docs/translation-nav.yml +0 -139
@@ -1,16 +1,16 @@
1
1
  name: Document list
2
2
  description: An ordered list of documents including a document type, when updated and a link.
3
3
  body: |
4
- Outputs a list to documents, based on an array of document data. This may include:
4
+ Outputs a list to documents, based on an array of document data. A "document" in this context can be an asset (such as a ODT or other downloadable document) or a web page.
5
+
6
+ The component can display:
5
7
 
6
- * document title
7
- * link to the document
8
- * last updated date object
9
- * document type
8
+ * a document title
9
+ * a link to the document
10
+ * a last updated date object
11
+ * a document type
10
12
 
11
13
  Tracking can be added to the links by supplying optional data attributes for each.
12
-
13
- Documents are presented in an ordered list as the component expects that the ordering of the documents is relevant.
14
14
  accessibility_criteria: |
15
15
  The component must:
16
16
 
@@ -195,6 +195,23 @@ examples:
195
195
  public_updated_at: 2017-07-19 15:01:48
196
196
  document_type: 'Statistical data set'
197
197
  subtext: 'First published during the 1996 Conservative Government'
198
+ without_top_border_on_list_element:
199
+ description: Several interfaces across GOV.UK benefit from the semantics of the document list but have their own bespoke designs, sometimes meaning that the visual border element doesn't gel with said interface. Removing it using the below attribute allows for cleaner visual fidelity in this instances.
200
+ data:
201
+ remove_top_border: true
202
+ items:
203
+ - link:
204
+ text: 'Department for Education – Statistics at DfE'
205
+ path: '/government/organisations/department-for-education/about/statistics'
206
+ metadata:
207
+ public_updated_at: 2017-07-19 15:01:48
208
+ document_type: 'Corporate information'
209
+ - link:
210
+ text: 'State-funded school inspections and outcomes: management information'
211
+ path: '/government/organisations/department-for-education/about/statistics'
212
+ metadata:
213
+ public_updated_at: 2017-07-19 15:01:48
214
+ document_type: 'Statistical data set'
198
215
  highlighted_result:
199
216
  description: Highlight one or more of the items in the list. This is used on finders to provide a 'top result' for a search. The `highlight_text` parameter is optional.
200
217
  data:
@@ -280,3 +297,29 @@ examples:
280
297
  document_type: 'Data tryloywder'
281
298
  locale:
282
299
  document_type: 'cy'
300
+ with_full_size_description_text:
301
+ data:
302
+ items:
303
+ - link:
304
+ text: 'Become an apprentice'
305
+ path: '/become-an-apprentice'
306
+ description: 'Becoming an apprentice - what to expect, apprenticeship levels, pay and training, making an application, complaining about an apprenticeship.'
307
+ full_size_description: true
308
+ with_rel_link_attribute:
309
+ description: |
310
+ The [rel attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel) is an option attribute to dictate the relationship between the document being linked to and the current page. This is predominantly used by search engines to help index journeys through a website.
311
+
312
+ On GOV.UK, this is typically used to dictate an external website being linked to with `rel="external"`, however this component supports:
313
+
314
+ - external
315
+ - nofollow
316
+ - noopener
317
+ - noreferrer
318
+ - opener
319
+ data:
320
+ items:
321
+ - link:
322
+ text: 'Report Fraud'
323
+ path: 'https://www.actionfraud.police.uk/contact-us'
324
+ rel: 'external'
325
+ description: "Contact Action Fraud to report fraud and cyber crime, or to tell them you've been the victim of a scam."
@@ -312,8 +312,8 @@ examples:
312
312
  block: |
313
313
  <div class="contact" id="contact_1017">
314
314
  <div class="content">
315
- <h3>Media enquiries</h3>
316
315
  <div class="vcard contact-inner">
316
+ <p>Media enquiries</p>
317
317
  <p class="adr">
318
318
  <span class="street-address">2 Marsham Street<br>London</span><br>
319
319
  <span class="postal-code">SW1P 4DF</span>
@@ -332,8 +332,8 @@ examples:
332
332
  <h2>This is a title</h2>
333
333
  <div class="contact" id="contact_1018">
334
334
  <div class="content">
335
- <h3>Media enquiries</h3>
336
335
  <div class="vcard contact-inner">
336
+ <p>Media enquiries</p>
337
337
  <p class="adr">
338
338
  <span class="street-address">2 Marsham Street<br>London</span><br>
339
339
  <span class="postal-code">SW1P 4DF</span>
@@ -349,8 +349,8 @@ examples:
349
349
  <p>This is a paragraph.</p>
350
350
  <div class="contact" id="contact_1019">
351
351
  <div class="content">
352
- <h3>Media enquiries</h3>
353
352
  <div class="vcard contact-inner">
353
+ <p>Media enquiries</p>
354
354
  <p class="adr">
355
355
  <span class="street-address">2 Marsham Street<br>London</span><br>
356
356
  <span class="postal-code">SW1P 4DF</span>
@@ -81,6 +81,17 @@ examples:
81
81
  - text: News and communications
82
82
  href: "item-6"
83
83
  active: true
84
+ with_navigation_link_data_attributes:
85
+ description: Supports adding data attributes i.e for tracking
86
+ data:
87
+ navigation_items:
88
+ - text: Departments
89
+ href: "item-1"
90
+ data:
91
+ module: "a custom attribute"
92
+ something_else: "some other custom attribute"
93
+ - text: Worldwide
94
+ href: "item-2"
84
95
  full_width:
85
96
  description: |
86
97
  This is difficult to preview because the preview windows are constrained, but the header will stretch to the size of its container.
@@ -1,5 +1,5 @@
1
1
  <div class="govuk-header__logo gem-c-header__logo">
2
- <a href="/" class="govuk-header__link govuk-header__link--homepage" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
2
+ <a href="/" class="govuk-header__link govuk-header__link--homepage" data-module="gem-track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
3
3
  <span class="govuk-header__logotype">
4
4
  <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="32" width="36">
5
5
  <path fill="currentColor" fill-rule="evenodd"
@@ -1,16 +1,21 @@
1
1
  <% if navigation_items.any? %>
2
2
  <button role="button" class="govuk-header__menu-button gem-c-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide Top Level Navigation">Menu</button>
3
- <%= tag.nav(class: "gem-c-header__nav", 'aria-label': navigation_aria_label ? navigation_aria_label : nil ) do %>
3
+ <%= tag.nav class: "gem-c-header__nav", aria: { label: navigation_aria_label } do %>
4
4
  <ul id="navigation" class="govuk-header__navigation govuk-header__navigation--end">
5
5
  <% navigation_items.each_with_index do |item, index| %>
6
- <li class="govuk-header__navigation-item <%= "govuk-header__navigation-item--active" if item[:active] %>
7
- <%= "govuk-header__navigation-item--collapsed-menu-only" if item[:show_only_in_collapsed_menu] %>">
6
+ <%
7
+ li_classes = %w(govuk-header__navigation-item)
8
+ li_classes << "govuk-header__navigation-item--active" if item[:active]
9
+ li_classes << "govuk-header__navigation-item--collapsed-menu-only" if item[:show_only_in_collapsed_menu]
10
+ %>
11
+ <%= tag.li class: li_classes do %>
8
12
  <%= link_to(
9
13
  item[:text],
10
14
  item[:href],
11
15
  class: 'govuk-header__link',
16
+ data: item[:data],
12
17
  ) %>
13
- </li>
18
+ <% end %>
14
19
  <% end %>
15
20
  </ul>
16
21
  <% end %>
@@ -25,8 +25,10 @@ Rails.application.config.assets.precompile += %w[
25
25
  govuk_publishing_components/search-button.png
26
26
  govuk_publishing_components/icon-file-download.svg
27
27
  govuk_publishing_components/icon-important.svg
28
- govuk_publishing_components/chevron-banner/*.svg
29
28
  govuk_publishing_components/crests/*.png
29
+ govuk_publishing_components/take-action-amber.svg
30
+ govuk_publishing_components/take-action-green.svg
31
+ govuk_publishing_components/take-action-red.svg
30
32
  ]
31
33
 
32
34
  # GOV.UK Frontend assets
@@ -12,4 +12,9 @@ cy:
12
12
  transition:
13
13
  title: "Brexit"
14
14
  link_path: "/transition.cy"
15
- link_text: "Darganfyddwch sut mae’r rheolau Brexit newydd yn effeithio arnoch chi"
15
+ link_text: "Gwiriwch beth sydd angen i chi ei wneud"
16
+ take_action_list:
17
+ red: Gwiriwch
18
+ amber: Newidiwch
19
+ green: Ewch
20
+ aria_label: Ymgyrch slogan Brexit, Gwiriwch, Newidiwch, Ewch.
@@ -79,7 +79,12 @@ en:
79
79
  transition:
80
80
  title: "Brexit"
81
81
  link_path: "/transition"
82
- link_text: "Check how the new Brexit rules affect you"
82
+ link_text: "Check what you need to do"
83
+ take_action_list:
84
+ red: Check
85
+ amber: Change
86
+ green: Go
87
+ aria_label: Brexit campaign slogan, Check, Change, Go.
83
88
  related_footer_navigation:
84
89
  collections: "Collections"
85
90
  policies: "Policies"
@@ -92,8 +97,8 @@ en:
92
97
  step_by_step_nav:
93
98
  show: "Show"
94
99
  hide: "Hide"
95
- show_all: "Show all"
96
- hide_all: "Hide all"
100
+ show_all: "Show all steps"
101
+ hide_all: "Hide all steps"
97
102
  step_by_step_nav_related:
98
103
  part_of: "Part of"
99
104
  subscription_links:
@@ -113,8 +113,189 @@ module GovukPublishingComponents
113
113
  tagged_to_brexit? && (page_content_id != brexit_start_page_content_id)
114
114
  end
115
115
 
116
- def transition_countdown_exception?
117
- content_item["content_id"] == "c3752802-f091-43a9-ba90-33568fccf391"
116
+ def brexit_cta_document_exceptions
117
+ # /government/news/30-creative-teams-awarded-up-to-100000-each-for-festival-uk-2022-rd-project
118
+ # and answer pages that have a start button (tracked in https://docs.google.com/spreadsheets/d/1ynH8zIjvElvK-u8JLI8KOYylxTbzJsoXRqEnqrnqv_4/edit)
119
+ %w[
120
+ c3752802-f091-43a9-ba90-33568fccf391
121
+ e1a9ce2b-4085-4761-b70f-d125a6571de3
122
+ 6a2bf66e-2313-4204-afd5-9940de5e1d66
123
+ f65b0ac7-b8cd-476b-bd5d-738268517659
124
+ 45ad868a-2e79-4029-991b-c29559d7eb29
125
+ e4e9c4ec-385e-4758-93ac-388bc154815e
126
+ cee73f76-83f0-44e2-b657-3b51a9cbc76e
127
+ 9a945506-60bc-44d8-a2ec-0eb2824732d6
128
+ 6ae16c12-a554-44e2-b3e3-596375aa1b9a
129
+ 9add4ccc-dc4c-44cf-9b69-6878c162d431
130
+ 4f5cf1cd-efda-4c49-8292-1db1c6c3cfb0
131
+ 73058592-dedf-4379-9a1d-d8222a796c0a
132
+ c9259172-5432-43a6-b710-409d463c7627
133
+ 59ecfc6d-cb9e-49b8-b013-fc368ebdf8ed
134
+ 9897695d-624b-4cb9-b873-f3113f0332a1
135
+ 715f4659-b058-46ec-84c8-cc346c210778
136
+ c63890f9-2356-4be3-9e07-6cf4b8de7081
137
+ e7661ec8-b678-444e-b4d0-a221fa83a7f7
138
+ 723f9c0a-bcdb-4d8f-952c-6df0ed468c57
139
+ a1c420b7-11d7-4b9c-a97e-406fb73c0200
140
+ c1347936-839b-4547-a570-0c315c34ee45
141
+ 1396f68b-6ffa-47ef-a049-414e7b548e81
142
+ 3b054acf-d0af-470e-b912-9481204d1a9a
143
+ 317b9c08-928b-4fd2-bc8e-4c6acf287c58
144
+ 44d6cb7a-d853-4cd8-a9cb-69eff0299d9e
145
+ 15517245-f142-4e45-ad84-773250f7d5a2
146
+ 6fe6644d-d037-4ea4-baf6-800dc1966ed0
147
+ 4a63625c-a195-4b86-9562-cb6653dd26ff
148
+ 47521233-20a8-4d02-ba31-6e1977448fd1
149
+ 7b8ca4ac-f3a3-41b8-9555-9e244c36575b
150
+ be1a82d1-e53c-431a-9e7a-337ed4b2654f
151
+ 6c445001-4e29-4853-8c14-444d7f9374ee
152
+ c8cf2a7c-5c13-4f3d-b1ff-6a7eb5533973
153
+ 2422a237-f8f1-4e9f-ad51-f1d44fde9755
154
+ ae000c08-c74f-467b-b8a4-90f138252a5c
155
+ 7eec7800-9c4d-4160-af53-57b5d3e02972
156
+ eb545b3b-111b-4c3c-890c-c9ec29b9090d
157
+ 8d705ade-8977-480d-9080-72a19e341c2a
158
+ 2a0dd317-0252-4c7c-8c13-b43af28406bc
159
+ f27e5792-a84b-4164-9890-7e86767634e8
160
+ b0b9a600-1fe6-4257-9e68-2be0f59ea25d
161
+ 28fa04ea-42e1-46ad-9abc-acf132c5666d
162
+ 64b27b8a-ae53-4034-a812-f4805cd7e3ad
163
+ 1dd5a75f-18b4-419d-b2b6-6d4808f2c7e4
164
+ b21b9e34-455c-4305-b4cc-4e6b8d3f7522
165
+ 0ab53a0d-b098-43a8-b3cc-8b3224697228
166
+ e3862156-ba5a-41ba-8ee6-22e5cd6a6144
167
+ 2e8f7fae-7164-459c-898b-0c0538eee3e0
168
+ 6087439c-26d2-4881-b345-5160e23f3b5e
169
+ cac78a0a-9c28-436a-a29e-8ccbe8fbc956
170
+ c2fd13a5-537b-4368-ac2e-6078b2c463f1
171
+ 98f0a21d-7b67-4089-a98c-f0a0177291a2
172
+ 06692612-8c39-464c-8aee-2aa62e6c8887
173
+ df943977-69cb-479d-a921-9410d603c471
174
+ 2656eb6b-f2eb-4982-8a90-e40d03a34a4d
175
+ 4ca8698b-4a24-45ff-baea-7633cc24b679
176
+ ed73581f-9bf8-48b5-bb66-935581a255e3
177
+ 15f1c594-af1d-4f16-97cc-ad4d12017509
178
+ ]
179
+ end
180
+
181
+ def brexit_cta_document_exception?
182
+ brexit_cta_document_exceptions.include?(content_item["content_id"])
183
+ end
184
+
185
+ def brexit_cta_document_type_exceptions
186
+ %w[
187
+ aaib_report
188
+ asylum_support_decision
189
+ fatality_notice
190
+ maib_report
191
+ raib_report
192
+ simple_smart_answer
193
+ transaction
194
+ ]
195
+ end
196
+
197
+ def brexit_cta_document_type_exception?
198
+ brexit_cta_document_type_exceptions.include?(content_item["document_type"])
199
+ end
200
+
201
+ def brexit_cta_taxon_allow_list
202
+ # Entering and staying in the UK
203
+ # Going and being abroad
204
+ # Corporate information
205
+ # Transport
206
+ # Environment
207
+ # International
208
+ # Defence and armed forces
209
+ # Society and culture
210
+ # Government
211
+ # Work
212
+ # Welfare
213
+ # Money
214
+ # Business and industry
215
+ # Health and social care
216
+ # Education > Further and higher education
217
+ # Education > Teaching and leadership
218
+ # Education > Funding and finance for students
219
+ # Coronavirus (COVID-19)
220
+ %w[
221
+ ba3a9702-da22-487f-86c1-8334a730e559
222
+ 9597c30a-605a-4e36-8bc1-47e5cdae41b3
223
+ a544d48b-1e9e-47fb-b427-7a987c658c14
224
+ a4038b29-b332-4f13-98b1-1c9709e216bc
225
+ 3cf97f69-84de-41ae-bc7b-7e2cc238fa58
226
+ 37d0fa26-abed-4c74-8835-b3b51ae1c8b2
227
+ e491505c-77ae-45b2-84be-8c94b94f6a2b
228
+ e2ca2f1a-0ff3-43ce-b813-16645ff27904
229
+ e48ab80a-de80-4e83-bf59-26316856a5f9
230
+ d0f1e5a3-c8f4-4780-8678-994f19104b21
231
+ dded88e2-f92e-424f-b73e-6ad24a839c51
232
+ 6acc9db4-780e-4a46-92b4-1812e3c2c48a
233
+ 495afdb6-47be-4df1-8b38-91c8adb1eefc
234
+ 8124ead8-8ebc-4faf-88ad-dd5cbcc92ba8
235
+ dd767840-363e-43ad-8835-c9ab516633de
236
+ ff00b8b2-dcdb-4659-93c2-291c9be354f3
237
+ 23265b25-7ec3-4960-8517-4ff8d4d92cac
238
+ 5b7b9532-a775-4bd2-a3aa-6ce380184b6c
239
+ ]
240
+ end
241
+
242
+ def brexit_cta_taxon_allow_list?
243
+ taxons = content_item.dig("links", "taxons").to_a
244
+ taxons.each do |taxon|
245
+ if brexit_cta_taxon_allow_list.include?(taxon["content_id"]) || parent_taxon_include?(taxon, brexit_cta_taxon_allow_list)
246
+ return true
247
+ end
248
+ end
249
+ false
250
+ end
251
+
252
+ def parent_taxon_include?(taxon, taxon_list)
253
+ if taxon.present?
254
+ if taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| taxon_list.include?(taxon_item["content_id"]) }
255
+ return true
256
+ end
257
+
258
+ taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| parent_taxon_include?(taxon_item, taxon_list) }
259
+ else
260
+ false
261
+ end
262
+ end
263
+
264
+ def brexit_cta_taxon_exception_list
265
+ # Entering and staying in the UK > Immigration offences
266
+ # Entering and staying in the UK > Inspections of border, immigration and asylum services
267
+ # Entering and staying in the UK > Refugees, asylum and human rights
268
+ # Transport > Local transport
269
+ # Education > Further and higher education > Education in prisons
270
+ %w[
271
+ fa13521f-9285-45b0-bd65-4a472a8037e7
272
+ 0fab9131-f877-4286-b4d8-922fbfb402b6
273
+ 08a8a69f-2825-4fe2-a4cf-c83458a5629e
274
+ 3b4d6319-fcef-4637-b35a-e3df76321894
275
+ 6426d1c5-93c8-4659-85d5-1f0d3368a124
276
+ ]
277
+ end
278
+
279
+ def brexit_cta_taxon_exception_list?
280
+ taxons = content_item.dig("links", "taxons").to_a
281
+ taxons.each do |taxon|
282
+ if brexit_cta_taxon_exception_list.include?(taxon["content_id"]) || parent_taxon_include?(taxon, brexit_cta_taxon_exception_list)
283
+ return true
284
+ end
285
+ end
286
+ false
287
+ end
288
+
289
+ def brexit_cta_exception?
290
+ brexit_cta_document_exception? ||
291
+ brexit_cta_document_type_exception? ||
292
+ brexit_cta_taxon_exception_list?
293
+ end
294
+
295
+ def show_brexit_cta?
296
+ brexit_cta_taxon_allow_list? &&
297
+ step_by_step_count.zero? &&
298
+ !brexit_cta_exception?
118
299
  end
119
300
 
120
301
  def step_by_step_count
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.13.0".freeze
2
+ VERSION = "24.1.0".freeze
3
3
  end
@@ -1498,7 +1498,7 @@ function CharacterCount ($module) {
1498
1498
  this.$module = $module;
1499
1499
  this.$textarea = $module.querySelector('.govuk-js-character-count');
1500
1500
  if (this.$textarea) {
1501
- this.$countMessage = $module.querySelector('[id=' + this.$textarea.id + '-info]');
1501
+ this.$countMessage = $module.querySelector('[id="' + this.$textarea.id + '-info"]');
1502
1502
  }
1503
1503
  }
1504
1504
 
@@ -1959,6 +1959,58 @@ ErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {
1959
1959
  $input.closest('label')
1960
1960
  };
1961
1961
 
1962
+ function NotificationBanner ($module) {
1963
+ this.$module = $module;
1964
+ }
1965
+
1966
+ /**
1967
+ * Initialise the component
1968
+ */
1969
+ NotificationBanner.prototype.init = function () {
1970
+ var $module = this.$module;
1971
+ // Check for module
1972
+ if (!$module) {
1973
+ return
1974
+ }
1975
+
1976
+ this.setFocus();
1977
+ };
1978
+
1979
+ /**
1980
+ * Focus the element
1981
+ *
1982
+ * If `role="alert"` is set, focus the element to help some assistive technologies
1983
+ * prioritise announcing it.
1984
+ *
1985
+ * You can turn off the auto-focus functionality by setting `data-disable-auto-focus="true"` in the
1986
+ * component HTML. You might wish to do this based on user research findings, or to avoid a clash
1987
+ * with another element which should be focused when the page loads.
1988
+ */
1989
+ NotificationBanner.prototype.setFocus = function () {
1990
+ var $module = this.$module;
1991
+
1992
+ if ($module.getAttribute('data-disable-auto-focus') === 'true') {
1993
+ return
1994
+ }
1995
+
1996
+ if ($module.getAttribute('role') !== 'alert') {
1997
+ return
1998
+ }
1999
+
2000
+ // Set tabindex to -1 to make the element focusable with JavaScript.
2001
+ // Remove the tabindex on blur as the component doesn't need to be focusable after the page has
2002
+ // loaded.
2003
+ if (!$module.getAttribute('tabindex')) {
2004
+ $module.setAttribute('tabindex', '-1');
2005
+
2006
+ $module.addEventListener('blur', function () {
2007
+ $module.removeAttribute('tabindex');
2008
+ });
2009
+ }
2010
+
2011
+ $module.focus();
2012
+ };
2013
+
1962
2014
  function Header ($module) {
1963
2015
  this.$module = $module;
1964
2016
  this.$menuButton = $module && $module.querySelector('.govuk-js-header-toggle');
@@ -2476,6 +2528,11 @@ function initAll (options) {
2476
2528
  var $toggleButton = scope.querySelector('[data-module="govuk-header"]');
2477
2529
  new Header($toggleButton).init();
2478
2530
 
2531
+ var $notificationBanners = scope.querySelectorAll('[data-module="govuk-notification-banner"]');
2532
+ nodeListForEach($notificationBanners, function ($notificationBanner) {
2533
+ new NotificationBanner($notificationBanner).init();
2534
+ });
2535
+
2479
2536
  var $radios = scope.querySelectorAll('[data-module="govuk-radios"]');
2480
2537
  nodeListForEach($radios, function ($radio) {
2481
2538
  new Radios($radio).init();