govuk_publishing_components 24.7.0 → 24.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/component_guide/application.js +3 -0
  3. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +35 -4
  4. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +1 -0
  5. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +1 -1
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +0 -2
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +0 -8
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -2
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +1 -2
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +0 -4
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +1 -11
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +0 -1
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +0 -1
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +0 -1
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +0 -1
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +0 -4
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +0 -1
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss +1 -32
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_title.scss +0 -5
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +0 -4
  21. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +16 -2
  22. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +0 -1
  23. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +15 -0
  24. data/app/controllers/govuk_publishing_components/audit_controller.rb +21 -17
  25. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +9 -0
  26. data/app/helpers/govuk_publishing_components/application_helper.rb +3 -0
  27. data/app/models/govuk_publishing_components/audit_applications.rb +3 -3
  28. data/app/models/govuk_publishing_components/audit_comparer.rb +16 -8
  29. data/app/models/govuk_publishing_components/audit_components.rb +6 -3
  30. data/app/views/govuk_publishing_components/audit/_applications.html.erb +126 -0
  31. data/app/views/govuk_publishing_components/audit/_components.html.erb +142 -0
  32. data/app/views/govuk_publishing_components/audit/show.html.erb +22 -277
  33. data/app/views/govuk_publishing_components/component_guide/index.html.erb +18 -2
  34. data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/_accordion.html.erb +25 -0
  36. data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +1 -1
  37. data/app/views/govuk_publishing_components/components/_image_card.html.erb +14 -11
  38. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +7 -2
  39. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -2
  40. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +2 -2
  41. data/app/views/govuk_publishing_components/components/_print_link.html.erb +2 -2
  42. data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -1
  43. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +4 -4
  44. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +3 -3
  45. data/app/views/govuk_publishing_components/components/_success_alert.html.erb +24 -8
  46. data/app/views/govuk_publishing_components/components/_title.html.erb +6 -2
  47. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +1 -1
  48. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +1 -1
  49. data/app/views/govuk_publishing_components/components/docs/accordion.yml +73 -73
  50. data/app/views/govuk_publishing_components/components/docs/button.yml +7 -6
  51. data/app/views/govuk_publishing_components/components/docs/image_card.yml +12 -0
  52. data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +3 -0
  53. data/app/views/govuk_publishing_components/components/docs/success_alert.yml +12 -1
  54. data/config/locales/ar.yml +1 -0
  55. data/config/locales/az.yml +1 -0
  56. data/config/locales/be.yml +1 -0
  57. data/config/locales/bg.yml +1 -0
  58. data/config/locales/bn.yml +1 -0
  59. data/config/locales/cs.yml +1 -0
  60. data/config/locales/da.yml +1 -0
  61. data/config/locales/de.yml +1 -0
  62. data/config/locales/dr.yml +1 -0
  63. data/config/locales/el.yml +1 -0
  64. data/config/locales/en.yml +11 -0
  65. data/config/locales/es-419.yml +1 -0
  66. data/config/locales/es.yml +1 -0
  67. data/config/locales/fa.yml +1 -0
  68. data/config/locales/fi.yml +1 -0
  69. data/config/locales/gd.yml +1 -0
  70. data/config/locales/gu.yml +1 -0
  71. data/config/locales/he.yml +1 -0
  72. data/config/locales/hi.yml +1 -0
  73. data/config/locales/hr.yml +1 -0
  74. data/config/locales/hu.yml +1 -0
  75. data/config/locales/hy.yml +1 -0
  76. data/config/locales/id.yml +1 -0
  77. data/config/locales/is.yml +1 -0
  78. data/config/locales/it.yml +1 -0
  79. data/config/locales/ja.yml +1 -0
  80. data/config/locales/ka.yml +1 -0
  81. data/config/locales/kk.yml +1 -0
  82. data/config/locales/ko.yml +1 -0
  83. data/config/locales/lt.yml +1 -0
  84. data/config/locales/lv.yml +1 -0
  85. data/config/locales/ms.yml +1 -0
  86. data/config/locales/mt.yml +1 -0
  87. data/config/locales/nl.yml +1 -0
  88. data/config/locales/no.yml +1 -0
  89. data/config/locales/pa-pk.yml +1 -0
  90. data/config/locales/pa.yml +1 -0
  91. data/config/locales/pl.yml +1 -0
  92. data/config/locales/ps.yml +1 -0
  93. data/config/locales/pt.yml +1 -0
  94. data/config/locales/ro.yml +1 -0
  95. data/config/locales/ru.yml +1 -0
  96. data/config/locales/si.yml +1 -0
  97. data/config/locales/sk.yml +1 -0
  98. data/config/locales/sl.yml +1 -0
  99. data/config/locales/so.yml +1 -0
  100. data/config/locales/sq.yml +1 -0
  101. data/config/locales/sr.yml +1 -0
  102. data/config/locales/sv.yml +1 -0
  103. data/config/locales/sw.yml +1 -0
  104. data/config/locales/ta.yml +1 -0
  105. data/config/locales/th.yml +1 -0
  106. data/config/locales/tk.yml +1 -0
  107. data/config/locales/tr.yml +1 -0
  108. data/config/locales/uk.yml +1 -0
  109. data/config/locales/ur.yml +1 -0
  110. data/config/locales/uz.yml +1 -0
  111. data/config/locales/vi.yml +1 -0
  112. data/config/locales/zh-hk.yml +1 -0
  113. data/config/locales/zh-tw.yml +1 -0
  114. data/config/locales/zh.yml +1 -0
  115. data/lib/govuk_publishing_components/presenters/button_helper.rb +13 -2
  116. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -4
  117. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +15 -31
  118. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +1 -0
  119. data/lib/govuk_publishing_components/presenters/shared_helper.rb +10 -0
  120. data/lib/govuk_publishing_components/version.rb +1 -1
  121. metadata +84 -2
@@ -66,18 +66,19 @@ examples:
66
66
  href: "#"
67
67
  start: true
68
68
  info_text: "Sometimes you want to explain where a user is going to."
69
+ with_margin_bottom:
70
+ 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 no margin bottom."
71
+ data:
72
+ text: "Submit"
73
+ margin_bottom: 6
69
74
  start_now_button_with_info_text_and_margin_bottom:
75
+ description: "When the component requires margin bottom and has info text, the margin is applied to the info text."
70
76
  data:
71
77
  text: "Start now"
72
78
  href: "#"
73
79
  start: true
74
80
  info_text: "Sometimes you want to explain where a user is going to and have a margin bottom"
75
- margin_bottom: true
76
- with_margin_bottom:
77
- description: "Sometimes it's useful to break up a page, for example if a button is at the bottom of a page."
78
- data:
79
- text: "Submit"
80
- margin_bottom: true
81
+ margin_bottom: 6
81
82
  extreme_text:
82
83
  data:
83
84
  text: "I'm a button with lots of text to test how the component scales at extremes."
@@ -35,6 +35,18 @@ examples:
35
35
  image_alt: "some meaningful alt text please"
36
36
  heading_text: "I am not a heading"
37
37
  heading_level: 0
38
+ with_different_link_size:
39
+ description: |
40
+ Set a different font size for the link. Uses the [GOV.UK Frontend heading sizes](https://design-system.service.gov.uk/styles/typography/#headings) but defaults to 19px for legacy reasons. Valid options are `xl`, `l`, `m` and `s`.
41
+
42
+ This option is not tied to the `heading_level` option in order to give flexibility.
43
+ data:
44
+ href: "/definitely-not-a-page"
45
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
46
+ image_alt: "some meaningful alt text please"
47
+ heading_text: "I am a big link"
48
+ heading_level: 0
49
+ font_size: 'xl'
38
50
  with_more_information:
39
51
  data:
40
52
  href: "/also-not-a-page"
@@ -8,6 +8,8 @@ body: |
8
8
  When the component is not limited to presenting information (e.g. an alert dialog or an informative dialog) and it contains interactive elements (e.g. form elements) you should use the `aria_label` attribute.
9
9
  This will provide context around what the modal dialogue is about and will prevent it from being too verbose for screen reader users (if `aria_label` is not specified the whole modal content will be read out).
10
10
 
11
+ Modal components must be a direct descendant of the `<body>` element; we recommend placing it toward the end of the document for performance considerations.
12
+
11
13
  This component is currently experimental. If you are using it, please feed back any research findings to the Content Publisher team.
12
14
  accessibility_criteria: |
13
15
  The modal dialogue box must:
@@ -21,6 +23,7 @@ accessibility_criteria: |
21
23
  - can be operable with a keyboard (allows the ESC key to close the dialogue)
22
24
  - return focus to last focused element on close
23
25
 
26
+ display_preview: false
24
27
  examples:
25
28
  default:
26
29
  embed: |
@@ -1,5 +1,7 @@
1
1
  name: Success alert
2
2
  description: Used at the top of the page, to summarise a successful user action.
3
+ govuk_frontend_components:
4
+ - notification-banner
3
5
  accessibility_criteria: |
4
6
  - should be focused on page load, to ensure the message is noticed by
5
7
  assistive tech
@@ -10,9 +12,18 @@ examples:
10
12
  data:
11
13
  message: Message to alert the user to a successful action goes here
12
14
  with_message_and_description:
15
+ description: Descriptions can be passed as plain text but it is strongly recommended that you pass these as html, cleaned using `raw` or `sanitize`.
13
16
  data:
14
17
  message: Message to alert the user to a successful action goes here
15
- description: A further description
18
+ description: <p class="govuk-body">A further description</p>
19
+ with_custom_title_id:
20
+ description: |
21
+ This is for the heading element at the head of the component (reading "Success" by default) where the id is used by an `aria-labelledby` on screen reader focus of the element.
22
+
23
+ Please ensure that this id is unique across the view you are building.
24
+ data:
25
+ message: Message to alert the user to a successful action goes here
26
+ title_id: my-custom-success-id
16
27
  long_example:
17
28
  data:
18
29
  message: |
@@ -0,0 +1 @@
1
+ ar:
@@ -0,0 +1 @@
1
+ az:
@@ -0,0 +1 @@
1
+ be:
@@ -0,0 +1 @@
1
+ bg:
@@ -0,0 +1 @@
1
+ bn:
@@ -0,0 +1 @@
1
+ cs:
@@ -0,0 +1 @@
1
+ da:
@@ -0,0 +1 @@
1
+ de:
@@ -0,0 +1 @@
1
+ dr:
@@ -0,0 +1 @@
1
+ el:
@@ -23,6 +23,12 @@ en:
23
23
  common:
24
24
  translations: "Translations"
25
25
  components:
26
+ accordion:
27
+ show: "Show"
28
+ hide: "Hide"
29
+ show_all: "Show all sections"
30
+ hide_all: "Hide all sections"
31
+ this_section_visually_hidden: " this section"
26
32
  attachment:
27
33
  opendocument_html: "This file is in an <a href='https://www.gov.uk/guidance/using-open-document-formats-odf-in-your-organisation' target=%{target} class='govuk-link'>OpenDocument</a> format"
28
34
  request_format_text: "This file may not be suitable for users of assistive technology."
@@ -58,6 +64,9 @@ en:
58
64
  search_button: "Search GOV.UK"
59
65
  show_button: "Show search"
60
66
  hide_button: "Hide search"
67
+ top_level: "Top level"
68
+ nav_items_aria_label: "Show or hide Top Level Navigation"
69
+ menu: "Menu"
61
70
  organisation_schema:
62
71
  all_content_search_description: "Find all content from %{organisation}"
63
72
  radio:
@@ -100,6 +109,8 @@ en:
100
109
  hide_password: "Hide password"
101
110
  announce_show: "Your password is shown"
102
111
  announce_hide: "Your password is hidden"
112
+ success_alert:
113
+ success: "Success"
103
114
  print_link:
104
115
  text: "Print this page"
105
116
  skip_link:
@@ -0,0 +1 @@
1
+ es-419:
@@ -0,0 +1 @@
1
+ es:
@@ -0,0 +1 @@
1
+ fa:
@@ -0,0 +1 @@
1
+ fi:
@@ -0,0 +1 @@
1
+ gd:
@@ -0,0 +1 @@
1
+ gu:
@@ -0,0 +1 @@
1
+ he:
@@ -0,0 +1 @@
1
+ hi:
@@ -0,0 +1 @@
1
+ hr:
@@ -0,0 +1 @@
1
+ hu:
@@ -0,0 +1 @@
1
+ hy:
@@ -0,0 +1 @@
1
+ id:
@@ -0,0 +1 @@
1
+ is:
@@ -0,0 +1 @@
1
+ it:
@@ -0,0 +1 @@
1
+ ja:
@@ -0,0 +1 @@
1
+ ka:
@@ -0,0 +1 @@
1
+ kk:
@@ -0,0 +1 @@
1
+ ko:
@@ -0,0 +1 @@
1
+ lt:
@@ -0,0 +1 @@
1
+ lv:
@@ -0,0 +1 @@
1
+ ms:
@@ -0,0 +1 @@
1
+ mt:
@@ -0,0 +1 @@
1
+ nl:
@@ -0,0 +1 @@
1
+ "no":
@@ -0,0 +1 @@
1
+ pa-pk:
@@ -0,0 +1 @@
1
+ pa:
@@ -0,0 +1 @@
1
+ pl:
@@ -0,0 +1 @@
1
+ ps:
@@ -0,0 +1 @@
1
+ pt:
@@ -0,0 +1 @@
1
+ ro:
@@ -0,0 +1 @@
1
+ ru:
@@ -0,0 +1 @@
1
+ si:
@@ -0,0 +1 @@
1
+ sk:
@@ -0,0 +1 @@
1
+ sl:
@@ -0,0 +1 @@
1
+ so:
@@ -0,0 +1 @@
1
+ sq:
@@ -0,0 +1 @@
1
+ sr:
@@ -0,0 +1 @@
1
+ sv:
@@ -0,0 +1 @@
1
+ sw:
@@ -0,0 +1 @@
1
+ ta:
@@ -0,0 +1 @@
1
+ th:
@@ -0,0 +1 @@
1
+ tk:
@@ -0,0 +1 @@
1
+ tr:
@@ -0,0 +1 @@
1
+ uk:
@@ -0,0 +1 @@
1
+ ur:
@@ -0,0 +1 @@
1
+ uz:
@@ -0,0 +1 @@
1
+ vi:
@@ -0,0 +1 @@
1
+ zh-hk:
@@ -0,0 +1 @@
1
+ zh-tw:
@@ -0,0 +1 @@
1
+ zh:
@@ -31,7 +31,8 @@ module GovukPublishingComponents
31
31
  @info_text = local_assigns[:info_text]
32
32
  @info_text_classes = %w[gem-c-button__info-text]
33
33
  if local_assigns[:margin_bottom]
34
- @info_text_classes << "gem-c-button__info-text--bottom-margin"
34
+ margin_class = get_margin_bottom(local_assigns[:margin_bottom], true)
35
+ @info_text_classes << margin_class
35
36
  end
36
37
  @rel = local_assigns[:rel]
37
38
  @data_attributes = local_assigns[:data_attributes]
@@ -81,11 +82,21 @@ module GovukPublishingComponents
81
82
  css_classes << "gem-c-button--secondary-quiet" if secondary_quiet
82
83
  css_classes << "govuk-button--secondary" if secondary_solid
83
84
  css_classes << "govuk-button--warning" if destructive
84
- css_classes << "gem-c-button--bottom-margin" if margin_bottom && !info_text
85
+ if margin_bottom && !info_text
86
+ margin_class = get_margin_bottom(margin_bottom, false)
87
+ css_classes << margin_class
88
+ end
85
89
  css_classes << "gem-c-button--inline" if inline_layout
86
90
  css_classes << classes if classes
87
91
  css_classes.join(" ")
88
92
  end
93
+
94
+ def get_margin_bottom(margin, info_text)
95
+ legacy_class = "gem-c-button--bottom-margin"
96
+ legacy_class = "gem-c-button__info-text--bottom-margin" if info_text
97
+
98
+ [*0..9].include?(margin) ? "govuk-!-margin-bottom-#{margin}" : legacy_class
99
+ end
89
100
  end
90
101
  end
91
102
  end
@@ -206,8 +206,6 @@ module GovukPublishingComponents
206
206
  # Environment
207
207
  # International
208
208
  # Defence and armed forces
209
- # Society and culture
210
- # Government
211
209
  # Work
212
210
  # Welfare
213
211
  # Money
@@ -225,8 +223,6 @@ module GovukPublishingComponents
225
223
  3cf97f69-84de-41ae-bc7b-7e2cc238fa58
226
224
  37d0fa26-abed-4c74-8835-b3b51ae1c8b2
227
225
  e491505c-77ae-45b2-84be-8c94b94f6a2b
228
- e2ca2f1a-0ff3-43ce-b813-16645ff27904
229
- e48ab80a-de80-4e83-bf59-26316856a5f9
230
226
  d0f1e5a3-c8f4-4780-8678-994f19104b21
231
227
  dded88e2-f92e-424f-b73e-6ad24a839c51
232
228
  6acc9db4-780e-4a46-92b4-1812e3c2c48a
@@ -3,50 +3,34 @@ module GovukPublishingComponents
3
3
  class PublicLayoutHelper
4
4
  FOOTER_NAV = [
5
5
  {
6
- title: "Prepare for Brexit",
6
+ title: "Coronavirus (COVID-19)",
7
7
  columns: 2,
8
8
  items: [
9
9
  {
10
- href: "/business-uk-leaving-eu",
11
- text: "Prepare your business or organisation for Brexit",
10
+ href: "/coronavirus",
11
+ text: "Coronavirus (COVID-19): guidance and support",
12
12
  attributes: {
13
13
  data: {
14
14
  track_category: "footerClicked",
15
- track_action: "brexitLinks",
16
- track_label: "Prepare your business or organisation for the UK leaving the EU",
17
- },
18
- },
19
- },
20
- {
21
- href: "/prepare-eu-exit",
22
- text: "Prepare for Brexit if you live in the UK",
23
- attributes: {
24
- data: {
25
- track_category: "footerClicked",
26
- track_action: "brexitLinks",
27
- track_label: "Prepare for Brexit if you live in the UK",
28
- },
29
- },
30
- },
31
- {
32
- href: "/uk-nationals-living-eu",
33
- text: "Living in Europe after Brexit",
34
- attributes: {
35
- data: {
36
- track_category: "footerClicked",
37
- track_action: "brexitLinks",
38
- track_label: "Living in Europe after Brexit",
15
+ track_action: "coronavirusLinks",
16
+ track_label: "Coronavirus (COVID-19): guidance and support",
39
17
  },
40
18
  },
41
19
  },
20
+ ],
21
+ },
22
+ {
23
+ title: "Brexit",
24
+ columns: 1,
25
+ items: [
42
26
  {
43
- href: "/staying-uk-eu-citizen",
44
- text: "Continue to live in the UK after Brexit",
27
+ href: "/transition",
28
+ text: "Check what you need to do",
45
29
  attributes: {
46
30
  data: {
47
31
  track_category: "footerClicked",
48
- track_action: "brexitLinks",
49
- track_label: "Continue to live in the UK after Brexit",
32
+ track_action: "transitionLinks",
33
+ track_label: "Check what you need to do",
50
34
  },
51
35
  },
52
36
  },