govuk_publishing_components 35.15.5 → 35.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/govuk_publishing_components_manifest.js +1 -0
  3. data/app/assets/images/option-select/input-icon.svg +3 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +37 -15
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-video-tracker.js +7 -1
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +1 -1
  7. data/app/assets/javascripts/govuk_publishing_components/components/option-select.js +312 -0
  8. data/app/assets/stylesheets/component_guide/application.scss +6 -6
  9. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +15 -15
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +3 -2
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +3 -3
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +2 -2
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +5 -5
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +1 -1
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +1 -1
  17. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +2 -2
  18. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +31 -5
  19. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +40 -35
  20. data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +172 -0
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +23 -19
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_table.scss +6 -6
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_tabs.scss +2 -1
  24. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +3 -1
  25. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +4 -4
  26. data/app/assets/stylesheets/govuk_publishing_components/components/mixins/_media-down.scss +2 -2
  27. data/app/views/govuk_publishing_components/components/_attachment.html.erb +1 -1
  28. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +20 -10
  29. data/app/views/govuk_publishing_components/components/_image_card.html.erb +8 -2
  30. data/app/views/govuk_publishing_components/components/_option_select.html.erb +71 -0
  31. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +6 -6
  32. data/app/views/govuk_publishing_components/components/docs/contents_list.yml +1 -0
  33. data/app/views/govuk_publishing_components/components/docs/image_card.yml +13 -0
  34. data/app/views/govuk_publishing_components/components/docs/option_select.yml +343 -0
  35. data/config/locales/ar.yml +5 -0
  36. data/config/locales/az.yml +5 -0
  37. data/config/locales/be.yml +5 -0
  38. data/config/locales/bg.yml +5 -0
  39. data/config/locales/bn.yml +5 -0
  40. data/config/locales/cs.yml +5 -0
  41. data/config/locales/cy.yml +5 -0
  42. data/config/locales/da.yml +5 -0
  43. data/config/locales/de.yml +5 -0
  44. data/config/locales/dr.yml +5 -0
  45. data/config/locales/el.yml +5 -0
  46. data/config/locales/en.yml +6 -1
  47. data/config/locales/es-419.yml +5 -0
  48. data/config/locales/es.yml +5 -0
  49. data/config/locales/et.yml +5 -0
  50. data/config/locales/fa.yml +5 -0
  51. data/config/locales/fi.yml +5 -0
  52. data/config/locales/fr.yml +5 -0
  53. data/config/locales/gd.yml +5 -0
  54. data/config/locales/gu.yml +5 -0
  55. data/config/locales/he.yml +5 -0
  56. data/config/locales/hi.yml +5 -0
  57. data/config/locales/hr.yml +5 -0
  58. data/config/locales/hu.yml +5 -0
  59. data/config/locales/hy.yml +5 -0
  60. data/config/locales/id.yml +5 -0
  61. data/config/locales/is.yml +5 -0
  62. data/config/locales/it.yml +5 -0
  63. data/config/locales/ja.yml +5 -0
  64. data/config/locales/ka.yml +5 -0
  65. data/config/locales/kk.yml +5 -0
  66. data/config/locales/ko.yml +5 -0
  67. data/config/locales/lt.yml +5 -0
  68. data/config/locales/lv.yml +5 -0
  69. data/config/locales/ms.yml +5 -0
  70. data/config/locales/mt.yml +5 -0
  71. data/config/locales/nl.yml +5 -0
  72. data/config/locales/no.yml +5 -0
  73. data/config/locales/pa-pk.yml +5 -0
  74. data/config/locales/pa.yml +5 -0
  75. data/config/locales/pl.yml +5 -0
  76. data/config/locales/ps.yml +5 -0
  77. data/config/locales/pt.yml +5 -0
  78. data/config/locales/ro.yml +5 -0
  79. data/config/locales/ru.yml +5 -0
  80. data/config/locales/si.yml +5 -0
  81. data/config/locales/sk.yml +5 -0
  82. data/config/locales/sl.yml +5 -0
  83. data/config/locales/so.yml +5 -0
  84. data/config/locales/sq.yml +5 -0
  85. data/config/locales/sr.yml +5 -0
  86. data/config/locales/sv.yml +5 -0
  87. data/config/locales/sw.yml +5 -0
  88. data/config/locales/ta.yml +5 -0
  89. data/config/locales/th.yml +5 -0
  90. data/config/locales/tk.yml +5 -0
  91. data/config/locales/tr.yml +5 -0
  92. data/config/locales/uk.yml +5 -0
  93. data/config/locales/ur.yml +5 -0
  94. data/config/locales/uz.yml +5 -0
  95. data/config/locales/vi.yml +5 -0
  96. data/config/locales/zh-hk.yml +5 -0
  97. data/config/locales/zh-tw.yml +5 -0
  98. data/config/locales/zh.yml +5 -0
  99. data/lib/govuk_publishing_components/presenters/contents_list_helper.rb +8 -0
  100. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +6 -2
  101. data/lib/govuk_publishing_components/presenters/meta_tags.rb +3 -0
  102. data/lib/govuk_publishing_components/version.rb +1 -1
  103. data/node_modules/axe-core/axe.js +6 -6
  104. data/node_modules/axe-core/axe.min.js +2 -2
  105. data/node_modules/axe-core/locales/_template.json +4 -4
  106. data/node_modules/axe-core/package.json +1 -1
  107. data/node_modules/axe-core/sri-history.json +4 -0
  108. metadata +7 -2
@@ -89,7 +89,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
89
89
  }
90
90
 
91
91
  // Create inner chevron arrow
92
- &:after {
92
+ &::after {
93
93
  content: "";
94
94
  box-sizing: border-box;
95
95
  display: block;
@@ -128,7 +128,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
128
128
  background: govuk-colour("black");
129
129
  }
130
130
 
131
- .gem-c-step-nav__chevron:after {
131
+ .gem-c-step-nav__chevron::after {
132
132
  color: govuk-colour("light-grey");
133
133
  }
134
134
 
@@ -145,7 +145,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
145
145
  background: govuk-colour("black");
146
146
  }
147
147
 
148
- .gem-c-step-nav__chevron:after {
148
+ .gem-c-step-nav__chevron::after {
149
149
  color: $govuk-focus-colour;
150
150
  }
151
151
 
@@ -234,7 +234,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
234
234
  list-style: none;
235
235
 
236
236
  // line down the side of a step
237
- &:after {
237
+ &::after {
238
238
  @include step-nav-vertical-line;
239
239
  @include step-nav-line-position;
240
240
  top: govuk-em(govuk-spacing(3), 16);
@@ -244,7 +244,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
244
244
  @include govuk-media-query($from: tablet) {
245
245
  padding-left: govuk-em(govuk-spacing(9), 16);
246
246
 
247
- &:after { // stylelint-disable-line max-nesting-depth
247
+ &::after { // stylelint-disable-line max-nesting-depth
248
248
  @include step-nav-line-position-large;
249
249
  top: govuk-em(govuk-spacing(6), 16);
250
250
  }
@@ -254,7 +254,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
254
254
 
255
255
  .gem-c-step-nav__step:last-child {
256
256
  // little dash at the bottom of the line
257
- &:before {
257
+ &::before {
258
258
  content: "";
259
259
  position: absolute;
260
260
  z-index: 6;
@@ -266,23 +266,23 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
266
266
  border-bottom: solid $stroke-width govuk-colour("mid-grey", $legacy: "grey-2");
267
267
  }
268
268
 
269
- &:after {
269
+ &::after {
270
270
  height: -webkit-calc(100% - #{govuk-spacing(3)}); // fallback for iphone 4
271
271
  height: calc(100% - #{govuk-spacing(3)});
272
272
  }
273
273
 
274
- .gem-c-step-nav__help:after {
274
+ .gem-c-step-nav__help::after {
275
275
  height: 100%;
276
276
  }
277
277
 
278
278
  .gem-c-step-nav--large & {
279
279
  @include govuk-media-query($from: tablet) {
280
- &:before {
280
+ &::before {
281
281
  margin-left: $number-circle-size-large / 4;
282
282
  width: $number-circle-size-large / 2;
283
283
  }
284
284
 
285
- &:after {
285
+ &::after {
286
286
  height: calc(100% - #{govuk-spacing(6)});
287
287
  }
288
288
  }
@@ -290,10 +290,10 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
290
290
  }
291
291
 
292
292
  .gem-c-step-nav__step--active {
293
- &:last-child:before,
293
+ &:last-child::before,
294
294
  .gem-c-step-nav__circle--number,
295
- &:after,
296
- .gem-c-step-nav__help:after {
295
+ &::after,
296
+ .gem-c-step-nav__help::after {
297
297
  border-color: govuk-colour("black");
298
298
  }
299
299
  }
@@ -365,7 +365,11 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
365
365
  $shadow-colour: govuk-colour("white");
366
366
 
367
367
  // to make numbers readable for users zooming text only in browsers such as Firefox
368
- text-shadow: 0 -#{$shadow-offset} 0 $shadow-colour, $shadow-offset 0 0 $shadow-colour, 0 $shadow-offset 0 $shadow-colour, -#{$shadow-offset} 0 0 $shadow-colour;
368
+ text-shadow:
369
+ 0 -#{$shadow-offset} 0 $shadow-colour,
370
+ $shadow-offset 0 0 $shadow-colour,
371
+ 0 $shadow-offset 0 $shadow-colour,
372
+ -#{$shadow-offset} 0 0 $shadow-colour;
369
373
  }
370
374
 
371
375
  .gem-c-step-nav__circle-step-label,
@@ -468,13 +472,13 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
468
472
  margin-left: $links-margin;
469
473
  list-style: disc;
470
474
 
471
- .gem-c-step-nav__list-item--active:before {
475
+ .gem-c-step-nav__list-item--active::before {
472
476
  left: -(govuk-spacing(6) + govuk-spacing(3)) - $links-margin;
473
477
  }
474
478
 
475
479
  .gem-c-step-nav--large & {
476
480
  @include govuk-media-query($from: tablet) {
477
- .gem-c-step-nav__list-item--active:before {
481
+ .gem-c-step-nav__list-item--active::before {
478
482
  left: -(govuk-spacing(9)) - $links-margin;
479
483
  }
480
484
  }
@@ -497,7 +501,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
497
501
  .gem-c-step-nav__list-item--active {
498
502
  position: relative;
499
503
 
500
- &:before {
504
+ &::before {
501
505
  box-sizing: border-box;
502
506
  content: "";
503
507
  position: absolute;
@@ -513,7 +517,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
513
517
 
514
518
  .gem-c-step-nav--large & {
515
519
  @include govuk-media-query($from: tablet) {
516
- &:before {
520
+ &::before {
517
521
  left: -(govuk-spacing(9));
518
522
  margin-left: ($number-circle-size-large / 2);
519
523
  }
@@ -530,7 +534,7 @@ $top-border: solid 1px govuk-colour("mid-grey", $legacy: "grey-3");
530
534
  font-weight: normal;
531
535
  color: govuk-colour("dark-grey", $legacy: "grey-1");
532
536
 
533
- &:before {
537
+ &::before {
534
538
  content: " \2013\00a0"; // dash followed by  
535
539
  }
536
540
  }
@@ -44,7 +44,7 @@ $table-row-even-background-colour: govuk-colour("light-grey", $legacy: "grey-4")
44
44
  @include govuk-focused-text;
45
45
  }
46
46
 
47
- .app-table__sort-link:after {
47
+ .app-table__sort-link::after {
48
48
  content: "";
49
49
  position: absolute;
50
50
  top: 5px;
@@ -52,7 +52,7 @@ $table-row-even-background-colour: govuk-colour("light-grey", $legacy: "grey-4")
52
52
  @include govuk-shape-arrow($direction: up, $base: $sort-link-arrow-size-small, $display: block);
53
53
  }
54
54
 
55
- .app-table__sort-link:before {
55
+ .app-table__sort-link::before {
56
56
  content: "";
57
57
  position: absolute;
58
58
  top: 13px;
@@ -80,12 +80,12 @@ $table-row-even-background-colour: govuk-colour("light-grey", $legacy: "grey-4")
80
80
  }
81
81
  }
82
82
 
83
- .app-table__sort-link--ascending:before,
84
- .app-table__sort-link--descending:before {
83
+ .app-table__sort-link--ascending::before,
84
+ .app-table__sort-link--descending::before {
85
85
  content: none;
86
86
  }
87
87
 
88
- .app-table__sort-link--ascending:after {
88
+ .app-table__sort-link--ascending::after {
89
89
  content: "";
90
90
  position: absolute;
91
91
  top: $sort-link-arrow-spacing;
@@ -95,7 +95,7 @@ $table-row-even-background-colour: govuk-colour("light-grey", $legacy: "grey-4")
95
95
  @include govuk-shape-arrow($direction: up, $base: $sort-link-arrow-size, $display: inline-block);
96
96
  }
97
97
 
98
- .app-table__sort-link--descending:after {
98
+ .app-table__sort-link--descending::after {
99
99
  content: "";
100
100
  position: absolute;
101
101
  top: $sort-link-arrow-spacing;
@@ -10,7 +10,8 @@
10
10
  }
11
11
 
12
12
  // We have some styles within GOVUK (.content-block) which can leak into the list styles for this component.
13
- // These styles are defined in Static: https://github.com/alphagov/static/blob/a815620cada7ea1c65428c1c3b3ac4dbe28977bf/app/assets/stylesheets/helpers/_text.scss
13
+ // These styles are defined in Static:
14
+ // https://github.com/alphagov/static/blob/a815620cada7ea1c65428c1c3b3ac4dbe28977bf/app/assets/stylesheets/helpers/_text.scss
14
15
  // This sets more specific selectors so those unwanted styles are overidden
15
16
  ul.govuk-tabs__list { // stylelint-disable-line selector-no-qualifying-type
16
17
  margin: 0;
@@ -17,7 +17,8 @@
17
17
  width: 100%;
18
18
  box-sizing: border-box;
19
19
 
20
- &:before {
20
+ // stylelint-disable max-nesting-depth
21
+ &::before {
21
22
  background-color: govuk-colour("black");
22
23
  border-radius: 50%;
23
24
  color: govuk-colour("white");
@@ -37,6 +38,7 @@
37
38
  content: "#{$i}";
38
39
  }
39
40
  }
41
+ // stylelint-enable max-nesting-depth
40
42
  }
41
43
  }
42
44
  }
@@ -49,14 +49,14 @@
49
49
  padding-left: govuk-spacing(6);
50
50
  }
51
51
 
52
- &:before {
52
+ &::before {
53
53
  content: "\201C";
54
54
  float: left;
55
55
  clear: both;
56
56
  margin-left: (- govuk-spacing(3));
57
57
  }
58
58
 
59
- &:last-child:after {
59
+ &:last-child::after {
60
60
  content: "\201D";
61
61
  }
62
62
  }
@@ -78,14 +78,14 @@
78
78
  padding-left: 0;
79
79
  }
80
80
 
81
- &:before {
81
+ &::before {
82
82
  content: "\201D";
83
83
  float: right;
84
84
  margin-right: (- govuk-spacing(3));
85
85
  margin-left: 0;
86
86
  }
87
87
 
88
- &:last-child:after {
88
+ &:last-child::after {
89
89
  content: "\201C";
90
90
  }
91
91
  }
@@ -10,11 +10,11 @@ $is-ie: false !default;
10
10
  @mixin media-down($size: false, $max-width: false, $min-width: false) {
11
11
  @if $is-ie == false {
12
12
  @if $size == mobile {
13
- @media (max-width: 640px) {
13
+ @media (max-width: 640px) { // stylelint-disable-line media-feature-range-notation
14
14
  @content;
15
15
  }
16
16
  } @else if $size == tablet {
17
- @media (max-width: 800px) {
17
+ @media (max-width: 800px) { // stylelint-disable-line media-feature-range-notation
18
18
  @content;
19
19
  }
20
20
  }
@@ -99,7 +99,7 @@
99
99
  <% end %>
100
100
 
101
101
  <% if attachment.preview_url.present? %>
102
- <%= tag.p link_to(t("components.attachment.preview_link"), attachment.preview_url, class: "govuk-link"), class: "gem-c-attachment__metadata" %>
102
+ <%= tag.p link_to(t("components.attachment.preview_link"), attachment.preview_url, class: "govuk-link", "aria-label": t("components.attachment.preview_aria_label", title: attachment.title)), class: "gem-c-attachment__metadata" %>
103
103
  <% end %>
104
104
 
105
105
  <% if attachment.is_official_document && !hide_order_copy_link %>
@@ -14,9 +14,10 @@
14
14
 
15
15
  ga4_tracking ||= false
16
16
  ga4_data = {
17
- event_name: "navigation",
18
- type: "content",
19
- section: t("components.contents_list.contents", locale: :en) || ""
17
+ event_name: "navigation",
18
+ type: "contents list",
19
+ section: t("components.contents_list.contents", locale: :en) || "",
20
+ index_total: cl_helper.get_index_total
20
21
  } if ga4_tracking
21
22
  local_assigns[:aria] ||= {}
22
23
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
@@ -37,15 +38,15 @@
37
38
  <% end %>
38
39
 
39
40
  <ol class="gem-c-contents-list__list">
41
+ <% index_link = 1 if ga4_tracking %>
40
42
  <% contents.each.with_index(1) do |contents_item, position| %>
41
43
  <li class="<%= cl_helper.list_item_classes(contents_item, false) %>" <%= "aria-current=true" if contents_item[:active] %>>
42
44
  <% link_text = format_numbers ? cl_helper.wrap_numbers_with_spans(contents_item[:text]) : contents_item[:text]
43
- if ga4_tracking
45
+ if ga4_tracking
44
46
  ga4_data[:index] = {
45
- "index_link": position,
47
+ "index_link": index_link,
46
48
  }
47
- ga4_data[:index_total] = contents.length
48
- end
49
+ end
49
50
  %>
50
51
  <%= link_to_if !contents_item[:active], link_text, contents_item[:href],
51
52
  class: link_classes,
@@ -59,11 +60,18 @@
59
60
  ga4_link: (ga4_tracking ? ga4_data.to_json : nil)
60
61
  }
61
62
  %>
62
-
63
+ <% index_link += 1 if ga4_tracking %>
63
64
  <% if contents_item[:items] && contents_item[:items].any? %>
64
65
  <ol class="gem-c-contents-list__nested-list">
65
66
  <% contents_item[:items].each.with_index(1) do |nested_contents_item, nested_position| %>
66
67
  <li class="<%= cl_helper.list_item_classes(nested_contents_item, true) %>" <%= "aria-current=true" if nested_contents_item[:active] %>>
68
+ <%
69
+ if ga4_tracking
70
+ ga4_data[:index] = {
71
+ "index_link": index_link,
72
+ }
73
+ end
74
+ %>
67
75
  <%= link_to_if !nested_contents_item[:active], nested_contents_item[:text], nested_contents_item[:href],
68
76
  class: link_classes,
69
77
  data: {
@@ -72,13 +80,15 @@
72
80
  track_label: nested_contents_item[:href],
73
81
  track_options: {
74
82
  dimension29: nested_contents_item[:text]
75
- }
83
+ },
84
+ ga4_link: (ga4_tracking ? ga4_data.to_json : nil)
76
85
  }
77
86
  %>
78
87
  </li>
88
+ <% index_link += 1 if ga4_tracking %>
79
89
  <% end %>
80
90
  </ol>
81
- <% end %>
91
+ <% end %>
82
92
  </li>
83
93
  <% end %>
84
94
  </ol>
@@ -7,11 +7,17 @@
7
7
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
8
8
  card_helper = GovukPublishingComponents::Presenters::ImageCardHelper.new(local_assigns, brand_helper)
9
9
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
10
+
10
11
  classes = %w[gem-c-image-card]
12
+ classes << "govuk-grid-row" if card_helper.two_thirds
11
13
  classes << "gem-c-image-card--large" if card_helper.large
14
+ classes << "gem-c-image-card--two-thirds" if card_helper.two_thirds
12
15
  classes << "gem-c-image-card--no-image" unless (card_helper.image_src || card_helper.youtube_video_id)
13
16
  classes << brand_helper.brand_class if brand_helper.brand_class
14
17
 
18
+ text_wrapper_classes = %w[gem-c-image-card__text-wrapper]
19
+ text_wrapper_classes << "gem-c-image-card__text-wrapper--two-thirds" if card_helper.two_thirds
20
+
15
21
  font_size ||= card_helper.large ? 'm' : 's'
16
22
  heading_class = %w[gem-c-image-card__title]
17
23
  heading_class << shared_helper.get_heading_size(font_size, 's')
@@ -33,7 +39,7 @@
33
39
  %>
34
40
  <% if card_helper.href || card_helper.extra_details.any? %>
35
41
  <%= content_tag(:div, class: classes, "data-module": data_modules, lang: card_helper.lang) do %>
36
- <div class="gem-c-image-card__text-wrapper">
42
+ <%= content_tag(:div, class: text_wrapper_classes) do %>
37
43
  <div class="gem-c-image-card__header-and-context-wrapper">
38
44
  <% if card_helper.heading_text %>
39
45
  <%= content_tag(shared_helper.get_heading_level, class: heading_class) do %>
@@ -69,7 +75,7 @@
69
75
  <% if card_helper.metadata %>
70
76
  <p class="gem-c-image-card__metadata"><%= card_helper.metadata %></p>
71
77
  <% end %>
72
- </div>
78
+ <% end %>
73
79
  <%= card_helper.media %>
74
80
  <% end %>
75
81
  <% end %>
@@ -0,0 +1,71 @@
1
+ <%
2
+ add_gem_component_stylesheet("option-select")
3
+ add_gem_component_stylesheet("input")
4
+
5
+ title_id = "option-select-title-#{title.parameterize}"
6
+ checkboxes_id = "checkboxes-#{SecureRandom.hex(4)}"
7
+ checkboxes_count_id = checkboxes_id + "-count"
8
+ show_filter ||= false
9
+ large ||= false
10
+
11
+ classes = %w[gem-c-option-select__container js-options-container]
12
+ classes << "gem-c-option-select__container--large" if large
13
+ %>
14
+
15
+ <% if show_filter %>
16
+ <%
17
+ filter_id ||= "input-#{SecureRandom.hex(4)}"
18
+ %>
19
+ <% filter = capture do %>
20
+ <%= tag.label for: filter_id, class: "govuk-label govuk-visually-hidden" do %>
21
+ Filter <%= title %>
22
+ <% end %>
23
+
24
+ <%= tag.input name: "option-select-filter",
25
+ id: filter_id,
26
+ class: "gem-c-option-select__filter-input govuk-input",
27
+ type: "text",
28
+ aria: {
29
+ describedby: checkboxes_count_id,
30
+ controls: checkboxes_id
31
+ }
32
+ %>
33
+ <% end %>
34
+ <% filter_element = CGI::escapeHTML(filter) %>
35
+ <% end %>
36
+
37
+ <div
38
+ class="gem-c-option-select" data-module="option-select"
39
+ <% if local_assigns.include?(:closed_on_load) && closed_on_load %>data-closed-on-load="true"<% end %>
40
+ <% if local_assigns.include?(:closed_on_load_mobile) && closed_on_load_mobile %>data-closed-on-load-mobile="true"<% end %>
41
+ <% if local_assigns.include?(:aria_controls_id) %>data-input-aria-controls="<%= aria_controls_id %>"<% end %>
42
+ <% if show_filter %>data-filter-element="<%= filter_element %>"<% end %>
43
+ >
44
+ <h3 class="gem-c-option-select__heading js-container-heading">
45
+ <span class="gem-c-option-select__title js-container-button" id="<%= title_id %>"><%= title %></span>
46
+ <svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="0" height="0" class="gem-c-option-select__icon gem-c-option-select__icon--up" aria-hidden="true" focusable="false"><path d="m798.16 609.84l-256-256c-16.683-16.683-43.691-16.683-60.331 0l-256 256c-16.683 16.683-16.683 43.691 0 60.331s43.691 16.683 60.331 0l225.84-225.84 225.84 225.84c16.683 16.683 43.691 16.683 60.331 0s16.683-43.691 0-60.331z"/></svg>
47
+ <svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="0" height="0" class="gem-c-option-select__icon gem-c-option-select__icon--down" aria-hidden="true" focusable="false"><path d="m225.84 414.16l256 256c16.683 16.683 43.691 16.683 60.331 0l256-256c16.683-16.683 16.683-43.691 0-60.331s-43.691-16.683-60.331 0l-225.84 225.84-225.84-225.84c-16.683-16.683-43.691-16.683-60.331 0s-16.683 43.691 0 60.331z"/></svg>
48
+ </h3>
49
+
50
+ <%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class: classes, id: options_container_id, tabindex: "-1") do %>
51
+ <div class="gem-c-option-select__container-inner js-auto-height-inner">
52
+ <% if show_filter %>
53
+ <span id="<%= checkboxes_count_id %>"
54
+ class="gem-c-option-select__count govuk-visually-hidden"
55
+ aria-live="polite"
56
+ data-single="<%= t('components.option_select.found_single') %>"
57
+ data-multiple="<%= t('components.option_select.found_multiple') %>"
58
+ data-selected="<%= t('components.option_select.selected') %>"></span>
59
+ <% end %>
60
+ <%= render "govuk_publishing_components/components/checkboxes", {
61
+ name: "#{key}[]",
62
+ id: checkboxes_id,
63
+ heading: title,
64
+ small: true,
65
+ visually_hide_heading: true,
66
+ no_hint_text: true,
67
+ items: options
68
+ } %>
69
+ </div>
70
+ <% end %>
71
+ </div>
@@ -19,8 +19,8 @@
19
19
  link_text_classes << "govuk-pagination__link-title--decorated" unless previous_page[:label].present?
20
20
  %>
21
21
  <div class="govuk-pagination__prev">
22
- <a class="govuk-link govuk-pagination__link"
23
- href="<%= previous_page[:url] %>"
22
+ <a class="govuk-link govuk-pagination__link"
23
+ href="<%= previous_page[:url] %>"
24
24
  rel="prev"
25
25
  data-track-category="contentsClicked"
26
26
  data-track-action="previous"
@@ -30,7 +30,7 @@
30
30
  <% if ga4_tracking %>
31
31
  data-ga4-link = "<%= {
32
32
  event_name: "navigation",
33
- type: "content",
33
+ type: "previous and next",
34
34
  text: previous_page[:label] || title,
35
35
  section: "Previous",
36
36
  }.to_json %>"
@@ -55,8 +55,8 @@
55
55
  link_text_classes << "govuk-pagination__link-title--decorated" unless next_page[:label].present?
56
56
  %>
57
57
  <div class="govuk-pagination__next">
58
- <a class="govuk-link govuk-pagination__link"
59
- href="<%= next_page[:url] %>"
58
+ <a class="govuk-link govuk-pagination__link"
59
+ href="<%= next_page[:url] %>"
60
60
  rel="next"
61
61
  data-track-category="contentsClicked"
62
62
  data-track-action="next"
@@ -66,7 +66,7 @@
66
66
  <% if ga4_tracking %>
67
67
  data-ga4-link = "<%= {
68
68
  event_name: "navigation",
69
- type: "content",
69
+ type: "previous and next",
70
70
  text: next_page[:label] || title,
71
71
  section: "Next",
72
72
  }.to_json %>"
@@ -204,6 +204,7 @@ examples:
204
204
  text: 1. Nested Item
205
205
  - href: "#third-thing"
206
206
  text: 2. Nested Item
207
+ active: true
207
208
  - href: "#first-thing"
208
209
  text: 2. Second thing
209
210
  items:
@@ -205,6 +205,19 @@ examples:
205
205
  <div class="govuk-!-width-full">
206
206
  <%= component %>
207
207
  </div>
208
+ two_thirds_column:
209
+ description: This variant is used for the featured section on the homepage.
210
+ data:
211
+ two_thirds: true
212
+ href: "/still-not-a-page"
213
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/91397/s712_SG_Swear_in_1_.jpg"
214
+ image_alt: "some meaningful alt text please"
215
+ heading_text: "Something has happened nearby possibly"
216
+ 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."
217
+ embed: |
218
+ <div class="govuk-!-width-full">
219
+ <%= component %>
220
+ </div>
208
221
  youtube_video:
209
222
  description: |
210
223
  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.