govuk_publishing_components 28.5.0 → 28.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +3 -3
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +4 -3
  5. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +21 -291
  6. data/app/assets/javascripts/govuk_publishing_components/components/button.js +1 -1
  7. data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +1 -1
  8. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -1
  9. data/app/assets/javascripts/govuk_publishing_components/components/details.js +1 -1
  10. data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +1 -1
  11. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +7 -6
  12. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +1 -1
  13. data/app/assets/javascripts/govuk_publishing_components/components/radio.js +1 -1
  14. data/app/assets/javascripts/govuk_publishing_components/components/skip-link.js +5 -0
  15. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +40 -37
  16. data/app/assets/javascripts/govuk_publishing_components/components/tabs.js +1 -1
  17. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js +2 -1
  18. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +8 -10
  19. data/app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js +4 -3
  20. data/app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js +4 -3
  21. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +4 -3
  22. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +1796 -911
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -329
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +1 -1
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +95 -56
  26. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +6 -17
  27. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +0 -9
  28. data/app/models/govuk_publishing_components/component_docs.rb +1 -1
  29. data/app/views/govuk_publishing_components/components/_accordion.html.erb +31 -16
  30. data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -1
  31. data/app/views/govuk_publishing_components/components/_button.html.erb +4 -4
  32. data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -2
  33. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -2
  34. data/app/views/govuk_publishing_components/components/_error_message.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/_error_summary.html.erb +0 -1
  36. data/app/views/govuk_publishing_components/components/_input.html.erb +3 -3
  37. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +12 -1
  38. data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -2
  39. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +1 -1
  40. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +1 -1
  41. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
  42. data/app/views/govuk_publishing_components/components/_search.html.erb +2 -4
  43. data/app/views/govuk_publishing_components/components/_select.html.erb +15 -43
  44. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +1 -1
  45. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +7 -8
  46. data/app/views/govuk_publishing_components/components/docs/accordion.yml +2 -97
  47. data/app/views/govuk_publishing_components/components/docs/attachment.yml +11 -0
  48. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +1 -1
  49. data/app/views/govuk_publishing_components/components/docs/inset_text.yml +6 -0
  50. data/app/views/govuk_publishing_components/components/docs/select.yml +1 -1
  51. data/app/views/govuk_publishing_components/components/docs/share_links.yml +1 -1
  52. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +13 -13
  53. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  54. data/app/views/govuk_publishing_components/components/docs/textarea.yml +1 -1
  55. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +11 -11
  56. data/config/initializers/assets.rb +1 -0
  57. data/lib/govuk_publishing_components/presenters/attachment.rb +23 -0
  58. data/lib/govuk_publishing_components/presenters/select_helper.rb +85 -0
  59. data/lib/govuk_publishing_components/version.rb +1 -1
  60. data/lib/govuk_publishing_components.rb +1 -1
  61. data/node_modules/govuk-frontend/govuk/all.js +294 -76
  62. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +274 -99
  63. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +169 -65
  64. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +37 -5
  65. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +4 -4
  66. data/node_modules/govuk-frontend/govuk/components/button/button.js +2 -2
  67. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +3 -3
  68. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +15 -2
  69. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +8 -10
  70. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +52 -15
  71. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +0 -2
  72. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +31 -0
  73. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +25 -25
  74. data/node_modules/govuk-frontend/govuk/components/details/details.js +2 -2
  75. data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +1 -0
  76. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +8 -8
  77. data/node_modules/govuk-frontend/govuk/components/error-message/template.njk +2 -2
  78. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +24 -3
  79. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +25 -16
  80. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +6 -0
  81. data/node_modules/govuk-frontend/govuk/components/error-summary/template.njk +2 -1
  82. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +4 -4
  83. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +3 -37
  84. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +119 -15
  85. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +6 -0
  86. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  87. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +10 -4
  88. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +11 -11
  89. data/node_modules/govuk-frontend/govuk/components/header/header.js +4 -4
  90. data/node_modules/govuk-frontend/govuk/components/header/template.njk +4 -3
  91. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +1 -3
  92. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +1 -1
  93. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +40 -40
  94. data/node_modules/govuk-frontend/govuk/components/input/template.njk +4 -3
  95. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +499 -2
  96. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +2 -2
  97. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +0 -8
  98. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +44 -45
  99. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +4 -4
  100. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -9
  101. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +6 -1
  102. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +3 -3
  103. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +13 -0
  104. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +9 -9
  105. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1108 -0
  106. data/node_modules/govuk-frontend/govuk/components/skip-link/template.njk +1 -1
  107. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +20 -23
  108. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +86 -1
  109. data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +1 -4
  110. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +2 -2
  111. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +2 -2
  112. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +0 -5
  113. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +2 -2
  114. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +1 -1
  115. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +4 -4
  116. data/node_modules/govuk-frontend/govuk/core/_all.scss +0 -1
  117. data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +0 -6
  118. data/node_modules/govuk-frontend/govuk/core/_links.scss +0 -6
  119. data/node_modules/govuk-frontend/govuk/core/_lists.scss +0 -6
  120. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +0 -6
  121. data/node_modules/govuk-frontend/govuk/core/_typography.scss +0 -6
  122. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  123. data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +15 -30
  124. data/node_modules/govuk-frontend/govuk/{core → objects}/_template.scss +1 -5
  125. data/node_modules/govuk-frontend/govuk/overrides/_display.scss +0 -6
  126. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +0 -6
  127. data/node_modules/govuk-frontend/govuk/overrides/_text-align.scss +0 -6
  128. data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +0 -6
  129. data/node_modules/govuk-frontend/govuk/overrides/_width.scss +0 -6
  130. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
  131. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +0 -10
  132. data/node_modules/govuk-frontend/govuk/tools/_all.scss +0 -1
  133. data/node_modules/govuk-frontend/package.json +1 -1
  134. metadata +22 -37
  135. data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +0 -100
  136. data/lib/govuk_publishing_components/presenters/select.rb +0 -43
  137. data/lib/tasks/govuk_publishing_components_tasks.rake +0 -49
  138. data/node_modules/govuk-frontend/govuk/tools/_iff.scss +0 -17
@@ -4,12 +4,10 @@
4
4
 
5
5
  id ||= "default-id-#{SecureRandom.hex(4)}"
6
6
  items ||= []
7
- condensed ||= false
8
7
  anchor_navigation ||= false
9
8
 
10
- accordion_classes = %w(gem-c-accordion)
11
- accordion_classes << 'gem-c-accordion--condensed' if condensed
12
- accordion_classes << shared_helper.get_margin_bottom
9
+ accordion_classes = %w(gem-c-accordion govuk-accordion)
10
+ accordion_classes << (shared_helper.get_margin_bottom)
13
11
 
14
12
  translations = {
15
13
  show_text: "components.accordion.show",
@@ -22,7 +20,7 @@
22
20
  locales = {}
23
21
 
24
22
  data_attributes ||= {}
25
- data_attributes[:module] = 'gem-accordion'
23
+ data_attributes[:module] = 'govuk-accordion gem-accordion'
26
24
  data_attributes[:anchor_navigation] = anchor_navigation
27
25
 
28
26
  translations.each do |key, translation|
@@ -39,27 +37,44 @@
39
37
  data_attributes[:locale] = unique_locales[0]
40
38
  end
41
39
  end
40
+
42
41
  %>
43
42
  <% if items.any? %>
44
43
  <%= tag.div(class: accordion_classes, id: id, data: data_attributes) do %>
45
44
  <% items.each_with_index do |item, i| %>
46
45
  <%
46
+ # The GOVUK Frontend JavaScript for this component
47
+ # uses a loop starting at 1 for accessing heading ID values,
48
+ # hence the increment below
47
49
  index = i + 1
48
50
 
49
- section_classes = %w(gem-c-accordion__section)
50
- section_classes << 'gem-c-accordion__section--expanded' if item[:expanded]
51
+ item[:data_attributes] ||= nil
51
52
 
52
- summary_classes = %w(gem-c-accordion__section-summary govuk-body)
53
- %>
53
+ section_classes = %w(govuk-accordion__section)
54
+ section_classes << 'govuk-accordion__section--expanded' if item[:expanded]
54
55
 
55
- <%= tag.section(class: section_classes) do %>
56
- <div class="gem-c-accordion__section-header">
57
- <%= content_tag(shared_helper.get_heading_level, class: 'gem-c-accordion__section-heading', id: item[:heading][:id]) do %>
58
- <%= tag.span(item[:heading][:text], id: "#{id}-heading-#{index}", data: item[:data_attributes], class: 'gem-c-accordion__section-button') %>
59
- <% end %>
56
+ summary_classes = %w(govuk-accordion__section-summary govuk-body)
57
+ %>
58
+ <%= tag.div(class: section_classes) do %>
59
+ <%= tag.div(class: "govuk-accordion__section-header") do %>
60
+ <%=
61
+ content_tag(
62
+ shared_helper.get_heading_level,
63
+ content_tag(
64
+ 'span',
65
+ item[:heading][:text],
66
+ class: "govuk-accordion__section-button",
67
+ id: "#{id}-heading-#{index}"
68
+
69
+ ),
70
+ class: "govuk-accordion__section-heading",
71
+ id: item[:heading][:id],
72
+ data: item[:data_attributes]
73
+ )
74
+ %>
60
75
  <%= tag.div(item[:summary][:text], id: "#{id}-summary-#{index}", class: summary_classes) if item[:summary].present? %>
61
- </div>
62
- <%= tag.div(item[:content][:html], id: "#{id}-content-#{index}", class: "gem-c-accordion__section-content", 'aria-label': "#{item[:heading][:text]}") %>
76
+ <% end %>
77
+ <%= tag.div(item[:content][:html], id: "#{id}-content-#{index}", class: "govuk-accordion__section-content", 'aria-labelledby': "#{id}-heading-#{index}") %>
63
78
  <% end %>
64
79
  <% end %>
65
80
  <% end %>
@@ -83,7 +83,9 @@
83
83
  <% end %>
84
84
  <% end %>
85
85
 
86
- <% if attachment.alternative_format_contact_email %>
86
+ <% if attachment.display_accessible_format_request_form_link? %>
87
+ <%= link_to "Request an accessible format of this document", "/contact/govuk/request-accessible-format?content_id=#{attachment.owning_document_content_id}&attachment_id=#{attachment.attachment_id}", class: "govuk-link" %>
88
+ <% elsif attachment.alternative_format_contact_email %>
87
89
  <%= tag.p t("components.attachment.request_format_text"), class: "gem-c-attachment__metadata" %>
88
90
  <%= render "govuk_publishing_components/components/details", {
89
91
  title: t("components.attachment.request_format_cta")
@@ -7,7 +7,7 @@
7
7
 
8
8
  <% start_button_text = capture do %>
9
9
  <%= button.text %>
10
- <svg class="govuk-button__start-icon govuk-!-display-none-print" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" role="presentation" focusable="false">
10
+ <svg class="govuk-button__start-icon govuk-!-display-none-print" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" focusable="false" aria-hidden="true">
11
11
  <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
12
12
  </svg>
13
13
  <% end %>
@@ -21,11 +21,11 @@
21
21
  %>
22
22
 
23
23
  <% if button.link? %>
24
- <%= link_to button_text, button.href, button.html_options %>
24
+ <%= link_to button_text, button.href, **button.html_options %>
25
25
  <% else %>
26
- <%= content_tag :button, button_text, button.html_options %>
26
+ <%= content_tag :button, button_text, **button.html_options %>
27
27
  <% end %>
28
28
 
29
29
  <% if button.info_text %>
30
- <%= tag.span button.info_text, button.info_text_options %>
30
+ <%= tag.span button.info_text, **button.info_text_options %>
31
31
  <% end %>
@@ -17,8 +17,8 @@
17
17
 
18
18
  <%= render "govuk_publishing_components/components/textarea", { id: id, character_count: true }.merge(textarea.symbolize_keys) %>
19
19
 
20
- <span id="<%= id %>-info" class="govuk-hint govuk-character-count__message" aria-live="polite">
20
+ <div id="<%= id %>-info" class="govuk-hint govuk-character-count__message" aria-live="polite">
21
21
  <%= t("components.character_count.body", number: maxlength || maxwords, type: maxwords ? t("components.character_count.type.words") : t("components.character_count.type.characters")) %>
22
- </span>
22
+ </div>
23
23
  <% end %>
24
24
  <% end %>
@@ -15,11 +15,11 @@
15
15
  <% end %>
16
16
 
17
17
  <% if cb_helper.hint_text %>
18
- <%= tag.span cb_helper.hint_text, id: "#{id}-hint", class: "govuk-hint" %>
18
+ <%= tag.div cb_helper.hint_text, id: "#{id}-hint", class: "govuk-hint" %>
19
19
  <% end %>
20
20
 
21
21
  <% if cb_helper.error %>
22
- <%= tag.span error, id: "#{id}-error", class: "govuk-error-message" %>
22
+ <%= tag.p error, id: "#{id}-error", class: "govuk-error-message" %>
23
23
  <% end %>
24
24
 
25
25
  <%= tag.ul class: cb_helper.list_classes, data: {
@@ -10,6 +10,6 @@
10
10
  text = raw(errors.join("<br />"))
11
11
  end
12
12
  %>
13
- <%= tag.span id: id, class: css_classes do %>
13
+ <%= tag.p id: id, class: css_classes do %>
14
14
  <span class="govuk-visually-hidden">Error:</span> <%= text %>
15
15
  <% end %>
@@ -14,7 +14,6 @@
14
14
  data: { module: "govuk-error-summary" }.merge(data_attributes),
15
15
  aria: { labelledby: title_id },
16
16
  role: "alert",
17
- tabindex: -1,
18
17
  id: id,
19
18
  ) do %>
20
19
  <% if title %>
@@ -98,7 +98,7 @@
98
98
  } %>
99
99
  <% end %>
100
100
 
101
- <% input_tag = tag.input({
101
+ <% input_tag = tag.input(
102
102
  aria: {
103
103
  describedby: aria_described_by,
104
104
  controls: controls
@@ -116,8 +116,8 @@
116
116
  readonly: readonly,
117
117
  tabindex: tabindex,
118
118
  type: type,
119
- value: value,
120
- }) %>
119
+ value: value
120
+ ) %>
121
121
 
122
122
  <% if prefix && suffix %>
123
123
  <%= tag.div class: "govuk-input__wrapper" do %>
@@ -1,7 +1,18 @@
1
1
  <%
2
2
  id ||= "inset-text-#{SecureRandom.hex(4)}"
3
+ margin_top ||= 6
4
+ margin_bottom ||= 6
5
+
6
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new({
7
+ margin_top: margin_top,
8
+ margin_bottom: margin_bottom
9
+ })
10
+
11
+ classes = %w[gem-c-inset-text govuk-inset-text]
12
+ classes << shared_helper.get_margin_top
13
+ classes << shared_helper.get_margin_bottom
3
14
  %>
4
- <%= tag.div id: id, class: "gem-c-inset-text govuk-inset-text" do %>
15
+ <%= tag.div id: id, class: classes do %>
5
16
  <% if defined? text %>
6
17
  <%= text %>
7
18
  <% elsif block_given? %>
@@ -45,11 +45,11 @@
45
45
  section_options.merge!({ hidden: true }) if hide
46
46
  %>
47
47
  <% if suggestion_text || (suggestion_link_text && suggestion_link_url) %>
48
- <%= tag.section section_options do %>
48
+ <%= tag.section **section_options do %>
49
49
  <p class="govuk-body">
50
50
  <%= tag.span suggestion_text, class: "gem-c-intervention__textwrapper" if suggestion_text %>
51
51
  <% if suggestion_link_text && suggestion_link_url %>
52
- <%= tag.a suggestion_link_text, suggestion_tag_options %>
52
+ <%= tag.a suggestion_link_text, **suggestion_tag_options %>
53
53
  <% end %>
54
54
  </p>
55
55
 
@@ -72,7 +72,7 @@
72
72
  <% end %>
73
73
  </ul>
74
74
  <% end %>
75
- <svg role="presentation" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 483.2 195.7" height="17" width="41">
75
+ <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 483.2 195.7" height="17" width="41">
76
76
  <path
77
77
  fill="currentColor"
78
78
  d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"
@@ -11,7 +11,7 @@
11
11
  <%= tag.div class: "gem-c-modal-dialogue__overlay" %>
12
12
  <%= tag.dialog class: dialog_classes, data: data_attributes, aria: { modal: true, label: aria_label }, role: "dialog", tabindex: 0 do %>
13
13
  <%= tag.div class: "gem-c-modal-dialogue__header" do %>
14
- <svg role="presentation" focusable="false" class="gem-c-modal-dialogue__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="26" width="30">
14
+ <svg aria-hidden="true" focusable="false" class="gem-c-modal-dialogue__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="26" width="30">
15
15
  <path fill="currentColor" fill-rule="evenodd"
16
16
  d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
17
17
  <image src="<%= asset_path('govuk-logotype-crown.png') %>" class="gem-c-modal-dialogue__logotype-crown-fallback-image"></image>
@@ -122,7 +122,7 @@
122
122
  <% end %>
123
123
 
124
124
  <% if item[:conditional] %>
125
- <%= tag.div item[:conditional], class:"govuk-radios__conditional govuk-radios__conditional--hidden", id: conditional_id %>
125
+ <%= tag.div item[:conditional], class:"govuk-radios__conditional govuk-radios__conditional--hidden govuk-body", id: conditional_id %>
126
126
  <% end %>
127
127
 
128
128
  <% end %>
@@ -39,7 +39,7 @@
39
39
  label_classes << "govuk-!-margin-bottom-#{label_margin_bottom}" if [*1..9].include?(label_margin_bottom) and local_assigns.include?(:inline_label)
40
40
 
41
41
  tag_label = capture do
42
- tag.label({ for: id, class: label_classes }) do
42
+ tag.label(for: id, class: label_classes) do
43
43
  label_text
44
44
  end
45
45
  end
@@ -47,9 +47,7 @@
47
47
 
48
48
  <div class="<%= classes.join(" ") %>" data-module="gem-toggle-input-class-on-focus">
49
49
  <% if wrap_label_in_a_heading %>
50
- <%= content_tag(shared_helper.get_heading_level, {
51
- class: "govuk-!-margin-0",
52
- }) do %>
50
+ <%= content_tag(shared_helper.get_heading_level, class: "govuk-!-margin-0") do %>
53
51
  <%= tag_label %>
54
52
  <% end %>
55
53
  <% else %>
@@ -1,67 +1,39 @@
1
1
  <%
2
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
-
4
- options ||= []
2
+ # select_helper.css_classes generates "gem-c-select"
5
3
  id ||= false
6
4
  label ||= false
7
- full_width ||= false
8
5
  name ||= id
9
6
  is_page_heading ||= false
10
- heading_size = false unless shared_helper.valid_heading_size?(heading_size)
11
- error_message ||= nil
12
- error_id ||= nil
13
- hint ||= nil
14
- hint_id ||= nil
15
-
16
- describedby = %w[]
17
-
18
- if error_message || error_id
19
- error_id = "error-#{SecureRandom.hex(4)}" unless error_id
20
- describedby << error_id
21
- end
22
-
23
- if hint
24
- hint_id = "hint-#{SecureRandom.hex(4)}" unless hint_id
25
- describedby << hint_id
26
- end
27
7
 
28
- aria_describedby = { describedby: describedby } if describedby
29
-
30
- css_classes = %w(govuk-form-group gem-c-select)
31
- css_classes << "govuk-form-group--error" if error_message
32
-
33
- select_classes = %w(govuk-select)
34
- select_classes << "gem-c-select__select--full-width" if full_width
35
- select_classes << "govuk-select--error" if error_id
36
-
37
- label_classes = %w(govuk-label)
38
- label_classes << "govuk-label--#{heading_size}" if heading_size
8
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
9
+ heading_size = false unless shared_helper.valid_heading_size?(heading_size)
10
+ select_helper = GovukPublishingComponents::Presenters::SelectHelper.new(local_assigns)
39
11
 
40
- select_helper = GovukPublishingComponents::Presenters::SelectHelper.new(options)
12
+ aria_describedby = { describedby: select_helper.describedby }
41
13
  data_module = { module: "track-select-change" } unless select_helper.data_tracking?.eql?(false)
42
14
  %>
43
- <% if options.any? && id && label %>
44
- <%= content_tag :div, class: css_classes do %>
15
+ <% if select_helper.options.any? && id && label %>
16
+ <%= content_tag :div, class: select_helper.css_classes do %>
45
17
  <% if is_page_heading %>
46
- <%= tag.h1 label_tag(id, label, class: label_classes), class: "gem-c-title__text" %>
18
+ <%= tag.h1 label_tag(id, label, class: select_helper.label_classes), class: "gem-c-title__text" %>
47
19
  <% else %>
48
- <%= label_tag(id, label, class: label_classes) %>
20
+ <%= label_tag(id, label, class: select_helper.label_classes) %>
49
21
  <% end %>
50
22
 
51
- <% if hint %>
23
+ <% if select_helper.hint %>
52
24
  <%= render "govuk_publishing_components/components/hint", {
53
- id: hint_id,
25
+ id: select_helper.hint_id,
54
26
  text: hint
55
27
  } %>
56
28
  <% end %>
57
29
 
58
- <% if error_message %>
30
+ <% if select_helper.error_message %>
59
31
  <%= render "govuk_publishing_components/components/error_message", {
60
- id: error_id,
61
- text: error_message
32
+ id: select_helper.error_id,
33
+ text: select_helper.error_message
62
34
  } %>
63
35
  <% end %>
64
36
 
65
- <%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_classes, data: data_module, aria: aria_describedby %>
37
+ <%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_helper.select_classes, data: data_module, aria: aria_describedby %>
66
38
  <% end %>
67
39
  <% end %>
@@ -2,4 +2,4 @@
2
2
  href ||= '#main-content'
3
3
  text ||= t('components.skip_link.text')
4
4
  %>
5
- <%= link_to(text, href, class: "gem-c-skip-link govuk-skip-link govuk-!-display-none-print") %>
5
+ <%= link_to(text, href, class: "gem-c-skip-link govuk-skip-link govuk-!-display-none-print", data: { module: "govuk-skip-link" }) %>
@@ -49,17 +49,16 @@
49
49
  <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" class="gem-c-subscription-links__icon" focusable="false" fill="currentColor" aria-hidden="true"><path d="M1.996 11A2 2 0 0 0 0 12.993c0 1.101.895 1.99 1.996 1.99 1.106 0 2-.889 2-1.99a2 2 0 0 0-2-1.993zM.002 5.097V7.97c1.872 0 3.632.733 4.958 2.059A6.984 6.984 0 0 1 7.015 15h2.888c0-5.461-4.443-9.903-9.9-9.903zM.006 0v2.876c6.676 0 12.11 5.44 12.11 12.124H15C15 6.731 8.273 0 .006 0z"/>
50
50
  </svg><%= sl_helper.feed_link_text %>
51
51
  <% end %>
52
- <%= tag.button feed_link_text, {
52
+ <%= tag.button(feed_link_text,
53
53
  class: "govuk-link govuk-link--no-underline gem-c-subscription-links__item #{brand_helper.color_class} gem-c-subscription-links__item--button",
54
54
  data: sl_helper.feed_link_data_attributes,
55
55
  lang: feed_link_text_locale
56
- } if sl_helper.feed_link_box_value %>
57
- <%= link_to feed_link_text, sl_helper.feed_link,
58
- {
59
- class: "govuk-link govuk-link--no-underline gem-c-subscription-links__item #{brand_helper.color_class} gem-c-subscription-links__item--link",
60
- data: sl_helper.feed_link_data_attributes,
61
- lang: feed_link_text_locale
62
- } unless sl_helper.feed_link_box_value %>
56
+ ) if sl_helper.feed_link_box_value %>
57
+ <%= link_to(feed_link_text, sl_helper.feed_link,
58
+ class: "govuk-link govuk-link--no-underline gem-c-subscription-links__item #{brand_helper.color_class} gem-c-subscription-links__item--link",
59
+ data: sl_helper.feed_link_data_attributes,
60
+ lang: feed_link_text_locale
61
+ ) unless sl_helper.feed_link_box_value %>
63
62
  </li>
64
63
  <% end %>
65
64
  </ul>
@@ -296,11 +296,11 @@ examples:
296
296
  text: Writing well for the web
297
297
  id: writing-well-for-the-web
298
298
  content:
299
- html: <p class="govuk-body">This is the content for Writing well for the web.</p>
299
+ html: <p class="govuk-body">This is content for accordion 1 of 2</p><p class="govuk-body">This content contains a <a href="#anchor-nav-test" class="govuk-link">link</a></p>
300
300
  - heading:
301
301
  text: Writing well for specialists
302
302
  content:
303
- html: <p class="govuk-body">This is the content for Writing well for specialists.</p>
303
+ html: <p class="govuk-body" id="anchor-nav-test">This is content for accordion 2 of 2</p>
304
304
  - heading:
305
305
  text: Know your audience
306
306
  content:
@@ -309,98 +309,3 @@ examples:
309
309
  text: How people read
310
310
  content:
311
311
  html: <p class="govuk-body">This is the content for How people read.</p>
312
- condensed_layout:
313
- description: |
314
- This layout is for when a smaller accordion is required. Since smaller screens trigger a single column layout, this modifier only makes the accordion smaller when viewed on large screens.
315
- data:
316
- condensed: true
317
- items:
318
- - heading:
319
- text: Understanding agile project management
320
- content:
321
- html:
322
- '<ul class="govuk-list">
323
- <li>
324
- <a class="govuk-link govuk-body-s" href="#">Agile and government services: an introduction</a>
325
- </li>
326
- <li>
327
- <a class="govuk-link govuk-body-s" href="#">Agile methods: an introduction</a>
328
- </li>
329
- <li>
330
- <a class="govuk-link govuk-body-s" href="#">Core principles of agile</a>
331
- </li>
332
- </ul>'
333
- - heading:
334
- text: Working with agile methods
335
- summary:
336
- text: Workspaces, tools and techniques, user stories, planning.
337
- content:
338
- html:
339
- '<ul class="govuk-list">
340
- <li>
341
- <a class="govuk-link govuk-body-s" href="#">Creating an agile working environment</a>
342
- </li>
343
- <li>
344
- <a class="govuk-link govuk-body-s" href="#">Agile tools and techniques</a>
345
- </li>
346
- <li>
347
- <a class="govuk-link govuk-body-s" href="#">Set up a team wall</a>
348
- </li>
349
- <li>
350
- <a class="govuk-link govuk-body-s" href="#">Writing user stories</a>
351
- </li>
352
- <li>
353
- <a class="govuk-link govuk-body-s" href="#">Planning in agile</a>
354
- </li>
355
- <li>
356
- <a class="govuk-link govuk-body-s" href="#">Deciding on priorities</a>
357
- </li>
358
- <li>
359
- <a class="govuk-link govuk-body-s" href="#">Developing a roadmap</a>
360
- </li>
361
- </ul>'
362
- - heading:
363
- text: Governing agile services
364
- content:
365
- html:
366
- '<ul class="govuk-list">
367
- <li>
368
- <a class="govuk-link govuk-body-s" href="#">Governance principles for agile service delivery</a>
369
- </li>
370
- <li>
371
- <a class="govuk-link govuk-body-s" href="#">Measuring and reporting progress</a>
372
- </li>
373
- <li>
374
- <a class="govuk-link govuk-body-s" href="#">Spend controls: check if you need approval to spend money on a service</a>
375
- </li>
376
- <li>
377
- <a class="govuk-link govuk-body-s" href="#">Spend controls: apply for approval to spend money on a service</a>
378
- </li>
379
- <li>
380
- <a class="govuk-link govuk-body-s" href="#">Spend controls: the new pipeline process</a>
381
- </li>
382
- <li>
383
- <a class="govuk-link govuk-body-s" href="#">Working across organisational boundaries</a>
384
- </li>
385
- </ul>'
386
- - heading:
387
- text: Phases of an agile project
388
- content:
389
- html:
390
- '<ul class="govuk-list">
391
- <li>
392
- <a class="govuk-link govuk-body-s" href="#">How the discovery phase works</a>
393
- </li>
394
- <li>
395
- <a class="govuk-link govuk-body-s" href="#">How the alpha phase works</a>
396
- </li>
397
- <li>
398
- <a class="govuk-link govuk-body-s" href="#">How the beta phase works</a>
399
- </li>
400
- <li>
401
- <a class="govuk-link govuk-body-s" href="#">How the live phase works</a>
402
- </li>
403
- <li>
404
- <a class="govuk-link govuk-body-s" href="#">Retiring your service</a>
405
- </li>
406
- </ul>'
@@ -76,6 +76,17 @@ examples:
76
76
  content_type: application/pdf
77
77
  file_size: 20000
78
78
  alternative_format_contact_email: defra.helpline@defra.gsi.gov.uk
79
+ with_link_to_request_accessible_format_form:
80
+ data:
81
+ attachment:
82
+ title: "Department for Transport information asset register"
83
+ url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/747661/department-for-transport-information-asset-register.csv
84
+ filename: department-for-transport-information-asset-register.csv
85
+ content_type: application/pdf
86
+ file_size: 20000
87
+ owning_document_content_id: 456_abc
88
+ attachment_id: 123
89
+ alternative_format_contact_email: alternative.formats@education.gov.uk
79
90
  with_data_attributes:
80
91
  data:
81
92
  attachment:
@@ -816,7 +816,7 @@ examples:
816
816
  block: |
817
817
  <p>
818
818
  <a role="button" class="gem-c-button govuk-button" href="https://gov.uk/random">Button</a>
819
- <a class="gem-c-button govuk-button govuk-button--start" role="button" href="https://gov.uk/random"> Start button <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" role="presentation" focusable="false"><path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path></svg></a>
819
+ <a class="gem-c-button govuk-button govuk-button--start" role="button" href="https://gov.uk/random"> Start button <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false"><path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path></svg></a>
820
820
  </p>
821
821
  image:
822
822
  data:
@@ -18,3 +18,9 @@ examples:
18
18
  <h2 class="govuk-heading-m" id='heading'>To publish this step by step you need to</h2>
19
19
  <a class="govuk-link" href='/foo'>Check for broken links</a>
20
20
  </div>
21
+ with_custom_margins:
22
+ description: The component accepts a number for margin bottom 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). It defaults to having margin of 6 (30px) top and bottom.
23
+ data:
24
+ text: "When a failure occurs, you must submit logbook, landing and transhipment data manually to the UK Fisheries Call Centre each day and by no later than 23.59 UTC"
25
+ margin_top: 0
26
+ margin_bottom: 9
@@ -47,7 +47,7 @@ examples:
47
47
  data:
48
48
  id: 'dropdown2-1'
49
49
  label: 'Choose your preferred thing'
50
- hint_text: 'You might need some more information here'
50
+ hint: 'You might need some more information here'
51
51
  hint_id: 'optional-hint-id'
52
52
  options:
53
53
  - text: 'Something'
@@ -125,7 +125,7 @@ examples:
125
125
  },
126
126
  {
127
127
  href: '/email-share-link',
128
- text: 'Share on email to someone you know',
128
+ text: 'Email',
129
129
  icon: 'email'
130
130
  },
131
131
  {