govuk_publishing_components 34.2.0 → 34.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/youtube-play-icon.png +0 -0
  3. data/app/assets/images/govuk_publishing_components/youtube-play-icon.svg +4 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/linked-domains.js +135 -0
  5. data/app/assets/javascripts/govuk_publishing_components/components/image-card.js +19 -0
  6. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +9 -0
  7. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +3 -2
  8. data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +113 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +15 -19
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +81 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +0 -1
  12. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +26 -9
  13. data/app/controllers/govuk_publishing_components/application_controller.rb +0 -13
  14. data/app/views/govuk_publishing_components/components/_accordion.html.erb +2 -2
  15. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +2 -0
  16. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +7 -3
  17. data/app/views/govuk_publishing_components/components/_error_message.html.erb +2 -1
  18. data/app/views/govuk_publishing_components/components/_google_tag_manager_script.html.erb +2 -2
  19. data/app/views/govuk_publishing_components/components/_hint.html.erb +2 -1
  20. data/app/views/govuk_publishing_components/components/_image_card.html.erb +12 -9
  21. data/app/views/govuk_publishing_components/components/_input.html.erb +8 -2
  22. data/app/views/govuk_publishing_components/components/_label.html.erb +4 -3
  23. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +2 -2
  24. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +6 -2
  25. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +12 -6
  26. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -1
  27. data/app/views/govuk_publishing_components/components/_textarea.html.erb +10 -2
  28. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +43 -0
  29. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +58 -0
  30. data/app/views/govuk_publishing_components/components/docs/emergency_banner.yml +3 -1
  31. data/app/views/govuk_publishing_components/components/docs/error_message.yml +13 -0
  32. data/app/views/govuk_publishing_components/components/docs/hint.yml +6 -0
  33. data/app/views/govuk_publishing_components/components/docs/image_card.yml +24 -1
  34. data/app/views/govuk_publishing_components/components/docs/input.yml +32 -0
  35. data/app/views/govuk_publishing_components/components/docs/intervention.yml +2 -1
  36. data/app/views/govuk_publishing_components/components/docs/label.yml +11 -0
  37. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +1 -0
  38. data/app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml +2 -0
  39. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +27 -0
  40. data/app/views/govuk_publishing_components/components/docs/textarea.yml +31 -0
  41. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +2 -0
  42. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +2 -2
  43. data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +4 -2
  44. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +18 -8
  45. data/app/views/layouts/govuk_publishing_components/application.html.erb +2 -2
  46. data/config/locales/ar.yml +4 -4
  47. data/config/locales/az.yml +4 -4
  48. data/config/locales/be.yml +4 -4
  49. data/config/locales/bg.yml +4 -4
  50. data/config/locales/bn.yml +4 -4
  51. data/config/locales/cs.yml +4 -4
  52. data/config/locales/cy.yml +4 -4
  53. data/config/locales/da.yml +4 -4
  54. data/config/locales/de.yml +4 -4
  55. data/config/locales/dr.yml +4 -4
  56. data/config/locales/el.yml +4 -4
  57. data/config/locales/en.yml +4 -4
  58. data/config/locales/es-419.yml +4 -4
  59. data/config/locales/es.yml +4 -4
  60. data/config/locales/et.yml +4 -4
  61. data/config/locales/fa.yml +4 -4
  62. data/config/locales/fi.yml +4 -4
  63. data/config/locales/fr.yml +4 -4
  64. data/config/locales/gd.yml +4 -4
  65. data/config/locales/gu.yml +4 -4
  66. data/config/locales/he.yml +4 -4
  67. data/config/locales/hi.yml +4 -4
  68. data/config/locales/hr.yml +4 -4
  69. data/config/locales/hu.yml +4 -4
  70. data/config/locales/hy.yml +4 -4
  71. data/config/locales/id.yml +4 -4
  72. data/config/locales/is.yml +4 -4
  73. data/config/locales/it.yml +4 -4
  74. data/config/locales/ja.yml +4 -4
  75. data/config/locales/ka.yml +4 -4
  76. data/config/locales/kk.yml +4 -4
  77. data/config/locales/ko.yml +4 -4
  78. data/config/locales/lt.yml +4 -4
  79. data/config/locales/lv.yml +4 -4
  80. data/config/locales/ms.yml +4 -4
  81. data/config/locales/mt.yml +4 -4
  82. data/config/locales/nl.yml +4 -4
  83. data/config/locales/no.yml +4 -4
  84. data/config/locales/pa-pk.yml +4 -4
  85. data/config/locales/pa.yml +4 -4
  86. data/config/locales/pl.yml +4 -4
  87. data/config/locales/ps.yml +4 -4
  88. data/config/locales/pt.yml +4 -4
  89. data/config/locales/ro.yml +4 -4
  90. data/config/locales/ru.yml +4 -4
  91. data/config/locales/si.yml +4 -4
  92. data/config/locales/sk.yml +4 -4
  93. data/config/locales/sl.yml +4 -4
  94. data/config/locales/so.yml +4 -4
  95. data/config/locales/sq.yml +4 -4
  96. data/config/locales/sr.yml +4 -4
  97. data/config/locales/sv.yml +4 -4
  98. data/config/locales/sw.yml +4 -4
  99. data/config/locales/ta.yml +4 -4
  100. data/config/locales/th.yml +4 -4
  101. data/config/locales/tk.yml +4 -4
  102. data/config/locales/tr.yml +4 -4
  103. data/config/locales/uk.yml +4 -4
  104. data/config/locales/ur.yml +4 -4
  105. data/config/locales/uz.yml +4 -4
  106. data/config/locales/vi.yml +4 -4
  107. data/config/locales/zh-hk.yml +4 -4
  108. data/config/locales/zh-tw.yml +4 -4
  109. data/config/locales/zh.yml +4 -4
  110. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +65 -2
  111. data/lib/govuk_publishing_components/presenters/page_with_step_by_step_navigation.rb +1 -1
  112. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +4 -0
  113. data/lib/govuk_publishing_components/version.rb +1 -1
  114. data/node_modules/axe-core/axe.js +7 -8
  115. data/node_modules/axe-core/axe.min.js +3 -3
  116. data/node_modules/axe-core/package.json +1 -1
  117. data/node_modules/axe-core/sri-history.json +4 -0
  118. metadata +8 -3
@@ -1,12 +1,14 @@
1
1
  <%
2
2
  sizes ||= false
3
3
  brand ||= false
4
+
4
5
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
5
- card_helper = GovukPublishingComponents::Presenters::ImageCardHelper.new(local_assigns)
6
+ card_helper = GovukPublishingComponents::Presenters::ImageCardHelper.new(local_assigns, brand_helper)
6
7
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
7
- classes = "gem-c-image-card"
8
- classes << " gem-c-image-card--large" if card_helper.large
9
- classes << " gem-c-image-card--no-image" unless defined?(image_src)
8
+ classes = %w[gem-c-image-card]
9
+ classes << "gem-c-image-card--large" if card_helper.large
10
+ classes << "gem-c-image-card--no-image" unless (card_helper.image_src || card_helper.youtube_video_id)
11
+ classes << brand_helper.brand_class if brand_helper.brand_class
10
12
 
11
13
  font_size ||= card_helper.large ? 'm' : 's'
12
14
  heading_class = %w[gem-c-image-card__title]
@@ -23,11 +25,12 @@
23
25
  ]
24
26
  extra_link_classes << brand_helper.color_class
25
27
 
28
+ data_modules = %w[]
29
+ data_modules << "gem-track-click" if card_helper.is_tracking?
30
+ data_modules << "image-card" if card_helper.youtube_video_id
26
31
  %>
27
32
  <% if card_helper.href || card_helper.extra_details.any? %>
28
- <div class="<%= classes %> <%= brand_helper.brand_class %>"
29
- <%= "data-module=gem-track-click" if card_helper.is_tracking? %>
30
- <%= "lang=#{card_helper.lang}" if card_helper.lang %>>
33
+ <%= content_tag(:div, class: classes, "data-module": data_modules, lang: card_helper.lang) do %>
31
34
  <div class="gem-c-image-card__text-wrapper">
32
35
  <div class="gem-c-image-card__header-and-context-wrapper">
33
36
  <% if card_helper.heading_text %>
@@ -65,6 +68,6 @@
65
68
  <p class="gem-c-image-card__metadata"><%= card_helper.metadata %></p>
66
69
  <% end %>
67
70
  </div>
68
- <%= card_helper.image %>
69
- </div>
71
+ <%= card_helper.media %>
72
+ <% end %>
70
73
  <% end %>
@@ -31,6 +31,8 @@
31
31
  heading_level ||= nil
32
32
  prefix ||= nil
33
33
  suffix ||= nil
34
+ right_to_left ||= false
35
+ right_to_left_help = right_to_left_help.nil? ? right_to_left : right_to_left_help
34
36
 
35
37
  css_classes = %w(gem-c-input govuk-input)
36
38
  css_classes << "govuk-input--error" if has_error
@@ -70,7 +72,8 @@
70
72
  <% label_markup = capture do %>
71
73
  <%= render "govuk_publishing_components/components/label", {
72
74
  html_for: id,
73
- heading_size: heading_size
75
+ heading_size: heading_size,
76
+ right_to_left: right_to_left_help
74
77
  }.merge(label.symbolize_keys) %>
75
78
  <% end %>
76
79
 
@@ -86,7 +89,8 @@
86
89
  <% if hint %>
87
90
  <%= render "govuk_publishing_components/components/hint", {
88
91
  id: hint_id,
89
- text: hint
92
+ text: hint,
93
+ right_to_left: right_to_left_help
90
94
  } %>
91
95
  <% end %>
92
96
 
@@ -95,6 +99,7 @@
95
99
  id: error_id,
96
100
  text: error_message,
97
101
  items: error_items,
102
+ right_to_left: right_to_left_help
98
103
  } %>
99
104
  <% end %>
100
105
 
@@ -107,6 +112,7 @@
107
112
  autofocus: autofocus,
108
113
  class: css_classes,
109
114
  data: data,
115
+ dir: right_to_left ? "rtl" : nil,
110
116
  enterkeyhint: checked_enterkeyhint,
111
117
  id: id,
112
118
  inputmode: inputmode,
@@ -7,6 +7,7 @@
7
7
  bold ||= false
8
8
  heading_size = false unless shared_helper.valid_heading_size?(heading_size)
9
9
  is_page_heading ||= false
10
+ right_to_left ||= false
10
11
 
11
12
  css_classes = %w[gem-c-label govuk-label]
12
13
  css_classes << "govuk-label--s" if bold
@@ -19,14 +20,14 @@
19
20
 
20
21
  <% if is_page_heading %>
21
22
  <%= tag.h1 text, class: "govuk-label-wrapper" do %>
22
- <%= tag.label text, id: id, for: html_for, class: css_classes %>
23
+ <%= tag.label text, id: id, for: html_for, class: css_classes, dir: right_to_left ? "rtl" : nil %>
23
24
  <% end %>
24
25
  <% else %>
25
- <%= tag.label text, id: id, for: html_for, class: css_classes %>
26
+ <%= tag.label text, id: id, for: html_for, class: css_classes, dir: right_to_left ? "rtl" : nil %>
26
27
  <% end %>
27
28
 
28
29
  <% if hint_text.present? %>
29
- <%= tag.span id: hint_id, class: hint_text_css_classes do %>
30
+ <%= tag.div id: hint_id, class: hint_text_css_classes, dir: right_to_left ? "rtl" : nil do %>
30
31
  <%= hint_text %>
31
32
  <% end %>
32
33
  <% end %>
@@ -14,9 +14,9 @@
14
14
  <%= yield :head %>
15
15
  </head>
16
16
  <body class="gem-c-layout-for-admin govuk-template__body">
17
- <script>
17
+ <%= javascript_tag nonce: true do -%>
18
18
  document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
19
- </script>
19
+ <% end -%>
20
20
  <%= yield %>
21
21
  <%= javascript_include_tag "application" %>
22
22
  </body>
@@ -58,6 +58,7 @@
58
58
  "lux-reporter-script": path_to_javascript("govuk_publishing_components/vendor/lux/lux-reporter")
59
59
  }
60
60
  } %>
61
+ <%= javascript_include_tag "govuk_publishing_components/load-analytics" %>
61
62
 
62
63
  <%= csrf_meta_tags %>
63
64
 
@@ -78,12 +79,15 @@
78
79
  <% # The default og:image is added below :head so that scrapers see any custom metatags first, and this is just a fallback %>
79
80
  <meta property="og:image" content="<%= asset_path "govuk-opengraph-image.png" %>">
80
81
 
82
+ <% # Used for Google Analytics 4 debugging %>
83
+ <meta name="govuk:components_gem_version" content="<%= GovukPublishingComponents::VERSION %>" />
84
+
81
85
  <%= yield :head %>
82
86
  </head>
83
87
  <%= tag.body class: body_css_classes do %>
84
- <script>
88
+ <%= javascript_tag nonce: true do -%>
85
89
  document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
86
- </script>
90
+ <% end -%>
87
91
  <%= render "govuk_publishing_components/components/skip_link", {
88
92
  href: "#content"
89
93
  } %>
@@ -1,10 +1,15 @@
1
- <% related_nav_helper = GovukPublishingComponents::Presenters::RelatedNavigationHelper.new(local_assigns) %>
2
- <% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
1
+ <%
2
+ related_nav_helper = GovukPublishingComponents::Presenters::RelatedNavigationHelper.new(local_assigns)
3
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
+ ga4_tracking ||= false
5
+ data = {}
6
+ data[:module] = "gem-track-click"
7
+ data[:module] << " ga4-link-tracker" if ga4_tracking
8
+ %>
3
9
 
4
10
  <% if related_nav_helper.related_navigation? %>
5
11
  <% random = SecureRandom.hex(4) %>
6
- <div class="gem-c-related-navigation">
7
-
12
+ <%= tag.div(class: "gem-c-related-navigation", data: data) do %>
8
13
  <% if local_assigns[:context] != :footer %>
9
14
  <h2 id="related-nav-related_items-<%= random %>"
10
15
  class="gem-c-related-navigation__main-heading"
@@ -33,7 +38,8 @@
33
38
  section_title: section_title,
34
39
  links: links,
35
40
  section_index: section_index,
36
- random: random %>
41
+ random: random,
42
+ ga4_tracking: ga4_tracking %>
37
43
  <% end %>
38
- </div>
44
+ <% end %>
39
45
  <% end %>
@@ -36,7 +36,7 @@
36
36
  </svg><%= sl_helper.email_signup_link_text %>
37
37
  <% end %>
38
38
  <%= link_to email_link_text, sl_helper.email_signup_link, {
39
- class: "govuk-link govuk-link--no-underline gem-c-subscription-links__item #{brand_helper.color_class} gem-c-subscription-links__item--link",
39
+ class: "govuk-link gem-c-subscription-links__item #{brand_helper.color_class} gem-c-subscription-links__item--link",
40
40
  data: sl_helper.email_signup_link_data_attributes,
41
41
  lang: email_signup_link_text_locale
42
42
  } %>
@@ -17,6 +17,8 @@
17
17
  hint_id = "hint-#{SecureRandom.hex(4)}"
18
18
  has_error ||= error_message || error_items.any?
19
19
  error_id = "error-#{SecureRandom.hex(4)}"
20
+ right_to_left ||= false
21
+ right_to_left_help = right_to_left_help.nil? ? right_to_left : right_to_left_help
20
22
 
21
23
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
22
24
 
@@ -39,13 +41,17 @@
39
41
 
40
42
  <%= content_tag :div, class: form_group_css_classes do %>
41
43
  <% if label %>
42
- <%= render "govuk_publishing_components/components/label", { html_for: id }.merge(label.symbolize_keys) %>
44
+ <%= render "govuk_publishing_components/components/label", {
45
+ html_for: id,
46
+ right_to_left: right_to_left_help
47
+ }.merge(label.symbolize_keys) %>
43
48
  <% end %>
44
49
 
45
50
  <% if hint %>
46
51
  <%= render "govuk_publishing_components/components/hint", {
47
52
  id: hint_id,
48
- text: hint
53
+ text: hint,
54
+ right_to_left: right_to_left_help
49
55
  } %>
50
56
  <% end %>
51
57
 
@@ -54,11 +60,13 @@
54
60
  id: error_id,
55
61
  text: error_message,
56
62
  items: error_items,
63
+ right_to_left: right_to_left_help
57
64
  } %>
58
65
  <% end %>
59
66
 
60
67
  <%= tag.textarea name: name,
61
68
  class: css_classes,
69
+ dir: right_to_left ? "rtl" : nil,
62
70
  id: id,
63
71
  rows: rows,
64
72
  maxlength: maxlength,
@@ -69,3 +69,46 @@ examples:
69
69
  ordered_related_items:
70
70
  - title: "Find an apprenticeship"
71
71
  base_path: "/apply-apprenticeship"
72
+ with_ga4_tracking:
73
+ description: Adds Google Analytics 4 tracking to the Related Navigation component, if it is visible.
74
+ data:
75
+ ga4_tracking: true
76
+ content_item:
77
+ title: "A content item"
78
+ links:
79
+ topics:
80
+ - title: Apprenticeships, 14 to 19 education and training for work
81
+ base_path: /browse/education/find-course
82
+ document_type: topic
83
+ - title: Finding a job
84
+ base_path: /browse/working/finding-job
85
+ document_type: topic
86
+ - title: Apprenticeships
87
+ base_path: /topic/further-education-skills/apprenticeships
88
+ document_type: topic
89
+ topical_events:
90
+ - title: UK-China High-Level People to People Dialogue 2017
91
+ base_path: /government/topical-events/uk-china-high-level-people-to-people-dialogue-2017
92
+ document_type: topical_event
93
+ related:
94
+ - title: Pest Control
95
+ base_path: /pest-control
96
+ document_type: contact
97
+ related_statistical_data_sets:
98
+ - title: International road fuel prices
99
+ base_path: /government/statistical-data-sets/comparisons-of-industrial-and-domestic-energy-prices-monthly-figures
100
+ document_type: statistical_data_set
101
+ - title: Weekly road fuel prices
102
+ base_path: /government/statistical-data-sets/oil-and-petroleum-products-weekly-statistics
103
+ document_type: statistical_data_set
104
+ world_locations:
105
+ - title: South Sudan
106
+ base_path: /world/south-sudan/news
107
+ - title: USA
108
+ base_path: /world/usa/news
109
+ details:
110
+ external_related_links:
111
+ - url: "http://media.slc.co.uk/sfe/1718/ft/sfe_terms_and_conditions_guide_1718_d.pdf"
112
+ title: "Student loans: terms and conditions 2017 to 2018 (PDF, 136KB)"
113
+ - title: The Student Room repaying your student loan
114
+ url: https://www.thestudentroom.co.uk/content.php?r=5967-Repaying-your-student-loan
@@ -103,3 +103,61 @@ examples:
103
103
  title: "Russian invasion of Ukraine: UK government response"
104
104
  base_path: "/government/topical-events/russian-invasion-of-ukraine-uk-government-response"
105
105
  locale: "en"
106
+ with_ga4_tracking_on_related_navigation:
107
+ description: Adds Google Analytics 4 tracking to components within the sidebar. Currently only the Related Navigation and Step by Step navigation components accept this option.
108
+ data:
109
+ ga4_tracking: true
110
+ content_item:
111
+ title: "UK forces arrive to reinforce NATO’s eastern flank"
112
+ content_id: "a342fd46-d801-4c1e-9d8f-f41fba6da563"
113
+ locale: "en"
114
+ links:
115
+ ordered_related_items:
116
+ - title: Find an apprenticeship
117
+ base_path: /apply-apprenticeship
118
+ - title: Careers helpline for teenagers
119
+ base_path: /careers-helpline-for-teenagers
120
+ document_collections:
121
+ - title: Recruit an apprentice (formerly apprenticeship vacancies)
122
+ base_path: /government/collections/apprenticeship-vacancies
123
+ document_type: document_collection
124
+ - title: The future of jobs and skills
125
+ base_path: /government/collections/the-future-of-jobs-and-skills
126
+ document_type: document_collection
127
+ with_ga4_tracking_on_step_by_step:
128
+ description: Adds Google Analytics 4 tracking to components within the sidebar. Currently only the Related Navigation and Step by Step navigation components accept this option.
129
+ data:
130
+ ga4_tracking: true
131
+ content_item:
132
+ title: "A content item"
133
+ links:
134
+ part_of_step_navs:
135
+ - title: "Learn to drive a car: step by step"
136
+ base_path: "/micropigs-vs-micropugs"
137
+ details:
138
+ step_by_step_nav:
139
+ title: 'Stay in the UK after it leaves the EU (''settled status''): step by step'
140
+ steps:
141
+ - title: Check you're allowed to drive
142
+ contents:
143
+ - type: paragraph
144
+ text: Most people can start learning to drive when they’re 17.
145
+ - type: list
146
+ contents:
147
+ - text: Check what age you can drive
148
+ href: "/vehicles-can-drive"
149
+ optional: false
150
+ - title: Testing the and
151
+ logic: and
152
+ contents:
153
+ - type: paragraph
154
+ text: hello hello what's UP
155
+ - title: Driving lessons and practice
156
+ contents:
157
+ - type: paragraph
158
+ text: You need a provisional driving licence to take lessons or practice.
159
+ - type: list
160
+ contents:
161
+ - text: The Highway Code
162
+ href: "/guidance/the-highway-code"
163
+ optional: false
@@ -7,7 +7,9 @@ body: |
7
7
 
8
8
  shared_accessibility_criteria:
9
9
  - link
10
-
10
+ accessibility_excluded_rules:
11
+ - duplicate-id-aria # IDs will be duplicated in component examples list
12
+ - landmark-unique # aria-label attributes will be duplicated in component examples list
11
13
  examples:
12
14
  default:
13
15
  description: |
@@ -21,3 +21,16 @@ examples:
21
21
  items:
22
22
  - text: Error 1
23
23
  - text: Error 2
24
+ with_dir_attribute:
25
+ description: Allows the correct display of right to left languages
26
+ data:
27
+ text: "An error message displayed right to left"
28
+ id: "error_id_2"
29
+ right_to_left: true
30
+ with_items_and_dir_attribute:
31
+ description: To allow the correct display of right to left languages on error items
32
+ data:
33
+ right_to_left: true
34
+ items:
35
+ - text: Error 1 displayed right to left
36
+ - text: Error 2 displayed right to left
@@ -19,3 +19,9 @@ examples:
19
19
  data:
20
20
  text: "You qualify if you were born in the UK before June 1960."
21
21
  margin_bottom: 9
22
+ with_dir_attribute:
23
+ description: |
24
+ Allows the correct display of right to left languages.
25
+ data:
26
+ text: "العربيَّة"
27
+ right_to_left: true
@@ -205,6 +205,29 @@ examples:
205
205
  <div class="govuk-!-width-full">
206
206
  <%= component %>
207
207
  </div>
208
+ youtube_video:
209
+ description: |
210
+ Given a Youtube video id, the image card will render a Youtube embed instead of an image. If Javascript fails to execute for any reason, then a fallback link to the Youtube video will be rendered instead.
211
+
212
+ Youtube does not support embeds on Internet Explorer versions lower than 10. In addition, Youtube's website will block any version of Internet Explorer using it. There is therefore no fallback for IE9 and lower.
213
+ data:
214
+ youtube_video_id: "XnP6jaK7ZAY"
215
+ href: "/still-not-a-page"
216
+ youtube_video_alt: "The vision for GOV.UK"
217
+ context:
218
+ date: 2017-06-14 11:30:00
219
+ text: "Announcement"
220
+ description: "Following a news report that something has happened, further details are emerging of the thing that has happened and what that means for you."
221
+ extra_details: [
222
+ {
223
+ text: "Link to video transcript",
224
+ href: "/1"
225
+ }
226
+ ]
227
+ embed: |
228
+ <div class="govuk-!-width-full">
229
+ <%= component %>
230
+ </div>
208
231
  with_data_attributes:
209
232
  description: Data attributes can be applied as required. Note that the component does not include built in tracking. If this is required consider using the [track click script](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics/track-click.md).
210
233
  data:
@@ -296,4 +319,4 @@ examples:
296
319
  embed: |
297
320
  <div class="govuk-!-width-full">
298
321
  <%= component %>
299
- </div>
322
+ </div>
@@ -183,3 +183,35 @@ examples:
183
183
  text: "Given name"
184
184
  name: given-name
185
185
  enterkeyhint: "next"
186
+ with_dir_attribute:
187
+ description: |
188
+ Allows the correct display of right to left languages.
189
+
190
+ By default the input element and the label both display text in a left to right direction.
191
+
192
+ When the `right_to_left` parameter of the input component is set to `true` both the input and the label, hint and error message display their content in a right to left direction.
193
+ data:
194
+ label:
195
+ text: "Some input text to be displayed right to left with a label that displays in the same direction"
196
+ hint: "Some hint text that displays in the same text direction as the label"
197
+ error_message: "An error message that displays in the same text direction as the label"
198
+ name: rtl-input-text
199
+ value: "العربيَّة"
200
+ right_to_left: true
201
+
202
+ with_separate_dir_attributes_for_field_and_help_text:
203
+ description: |
204
+ Allows the correct display of right to left languages.
205
+
206
+ By default the input element and the label both display text in a left to right direction.
207
+
208
+ If the input field and the help text (label, hint and error messages) are required to display in different directions the `right_to_left_help` attribute can be set as false to override the `right_to_left` attribute.
209
+ data:
210
+ label:
211
+ text: "Some input text that displays right to left with a label that displays left to right"
212
+ hint: "Some hint text that displays in the same text direction as the label"
213
+ name: rtl-input-text
214
+ value: "العربيَّة"
215
+ right_to_left: true
216
+ right_to_left_help: false
217
+ error_message: "An error message that displays in the same text direction as the label"
@@ -14,9 +14,10 @@ accessibility_criteria: |
14
14
  - have a border colour contrast ratio of more than 4.5:1 with its background to be visually distinct
15
15
  - prevent screen readers from announcing the dismiss link icon
16
16
 
17
-
18
17
  shared_accessibility_criteria:
19
18
  - link
19
+ accessibility_excluded_rules:
20
+ - landmark-unique # aria-label attributes will be duplicated in component examples list
20
21
  examples:
21
22
  default:
22
23
  data:
@@ -65,3 +65,14 @@ examples:
65
65
  text: "Label with an ID"
66
66
  id: "id-for-the-label"
67
67
  html_for: "id-that-matches-input-6"
68
+ with_dir_attribute:
69
+ description: |
70
+ To allow the correct display of right to left languages.
71
+
72
+ When the `right_to_left` parameter is set to `true` any hint text displays in the same text direction as the label.
73
+ data:
74
+ text: "العربيَّة"
75
+ html_for: "id-that-matches-input-7"
76
+ hint_id: "should-match-aria-describedby-input"
77
+ hint_text: "Hint text displayed right to left"
78
+ right_to_left: true
@@ -7,6 +7,7 @@ govuk_frontend_components:
7
7
  - header
8
8
  accessibility_excluded_rules:
9
9
  - landmark-banner-is-top-level # The header element can not be top level in the examples
10
+ - duplicate-id # IDs will be duplicated in component examples list
10
11
  - duplicate-id-aria # IDs will be duplicated in component examples list
11
12
  - form-field-multiple-labels # Form labels will be ambiguous in component examples list
12
13
  - landmark-no-duplicate-banner # banners will be duplicated in component examples list
@@ -21,6 +21,8 @@ accessibility_criteria: |
21
21
 
22
22
  shared_accessibility_criteria:
23
23
  - link
24
+ accessibility_excluded_rules:
25
+ - landmark-unique # aria-label attributes will be duplicated in component examples list
24
26
  examples:
25
27
  default:
26
28
  data:
@@ -306,3 +306,30 @@ examples:
306
306
  title: "Student loans: terms and conditions 2017 to 2018 (PDF, 136KB)"
307
307
  - title: The Student Room repaying your student loan
308
308
  url: https://www.thestudentroom.co.uk/content.php?r=5967-Repaying-your-student-loan
309
+ with_ga4_tracking:
310
+ description: Adds Google Analytics 4 tracking to the component, using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/ga4-link-tracker.md).
311
+ data:
312
+ ga4_tracking: true
313
+ content_item:
314
+ links:
315
+ ordered_related_items:
316
+ - title: Find an apprenticeship
317
+ base_path: /apply-apprenticeship
318
+ - title: Training and study at work
319
+ base_path: /training-study-work-your-rights
320
+ - title: Careers helpline for teenagers
321
+ base_path: /careers-helpline-for-teenagers
322
+ topics:
323
+ - title: Apprenticeships, 14 to 19 education and training for work
324
+ base_path: /browse/education/find-course
325
+ document_type: topic
326
+ - title: Finding a job
327
+ base_path: /browse/working/finding-job
328
+ document_type: topic
329
+ - title: Apprenticeships
330
+ base_path: /topic/further-education-skills/apprenticeships
331
+ document_type: topic
332
+ topical_events:
333
+ - title: UK-China High-Level People to People Dialogue 2017
334
+ base_path: /government/topical-events/uk-china-high-level-people-to-people-dialogue-2017
335
+ document_type: topical_event
@@ -110,3 +110,34 @@ examples:
110
110
  name: "with_data_attrbutes"
111
111
  data:
112
112
  module: "some-awesome-module-here"
113
+ with_dir_attribute:
114
+ description: |
115
+ Allows the correct display of right to left languages.
116
+
117
+ By default the textarea element and the label both display text in a left to right direction.
118
+
119
+ When the `right_to_left` parameter of the textarea component is set to `true` all text desplays in a right to left direction.
120
+ data:
121
+ label:
122
+ text: "Some textarea text that displays right to left with a label that displays in the same direction"
123
+ hint: "Some hint text that displays in the same text direction as the label"
124
+ error_message: "An error message that displays in the same text direction as the label"
125
+ name: "rtl-textarea-text"
126
+ value: "العربيَّة"
127
+ right_to_left: true
128
+ with_separate_dir_attributes_for_field_and_help_text:
129
+ description: |
130
+ Allows the correct display of right to left languages.
131
+
132
+ By default the textarea element and the label both display text in a left to right direction.
133
+
134
+ If the textarea field and the help text (label, hint and error messages) are required to display in different directions the right_to_left_help attribute can be set as false to override the right_to_left attribute.
135
+ data:
136
+ label:
137
+ text: "Some textarea text that displays right to left with a label that displays left to right"
138
+ hint: "Some hint text that displays in the same text direction as the label"
139
+ error_message: "An error message that displays in the same text direction as the label"
140
+ name: rtl-textarea-text
141
+ value: "العربيَّة"
142
+ right_to_left: true
143
+ right_to_left_help: false
@@ -14,6 +14,8 @@ accessibility_criteria: |
14
14
  [Watch a screen reader pronounce text differently based on lang attribute](https://bit.ly/screenreaderpronunciation)
15
15
  shared_accessibility_criteria:
16
16
  - link
17
+ accessibility_excluded_rules:
18
+ - landmark-unique # aria-label attributes will be duplicated in component examples list
17
19
  examples:
18
20
  default:
19
21
  data:
@@ -68,7 +68,7 @@
68
68
  # This seems to be a more reliable way to make sure the script is executed.
69
69
  %>
70
70
 
71
- <script>
71
+ <%= javascript_tag nonce: true do -%>
72
72
  document.addEventListener("DOMContentLoaded", function () {
73
73
  var input = document.querySelector("#giraffe"),
74
74
  form = document.querySelector("#something-is-wrong")
@@ -80,4 +80,4 @@
80
80
  e.preventDefault();
81
81
  }
82
82
  });
83
- </script>
83
+ <% end -%>
@@ -13,8 +13,10 @@
13
13
  class="gem-c-metadata__definition-link govuk-!-display-none-print"
14
14
  data-controls="toggle-<%= toggle_id %>"
15
15
  data-expanded="false"
16
- data-toggled-text="<%= t("components.metadata.toggle_less") %>">
17
- <%= t("components.metadata.toggle_more", number: remaining.length) %>
16
+ data-toggled-text="<%= t("common.toggle_less") %>">
17
+ <%= t("common.toggle_more",
18
+ show: t('common.show'),
19
+ number: remaining.length) %>
18
20
  </a>
19
21
  </div>
20
22
  <span id="toggle-<%= toggle_id %>" class="gem-c-metadata__toggle-items js-hidden"><%= remaining.to_sentence.html_safe %></span>