govuk_publishing_components 48.0.0 → 49.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/crests/gds_crest_18px_x2.png +0 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +16 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +6 -3
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +4 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +9 -0
  7. data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +7 -2
  8. data/app/views/govuk_publishing_components/components/_attachment.html.erb +8 -7
  9. data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +6 -3
  10. data/app/views/govuk_publishing_components/components/_big_number.html.erb +7 -8
  11. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +0 -1
  12. data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +5 -2
  13. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -2
  14. data/app/views/govuk_publishing_components/components/_cross_service_header.html.erb +1 -1
  15. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +0 -1
  16. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +0 -1
  17. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -1
  18. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +7 -3
  19. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -1
  20. data/app/views/govuk_publishing_components/components/_secondary_navigation.html.erb +0 -1
  21. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
  22. data/app/views/govuk_publishing_components/components/docs/attachment.yml +3 -2
  23. data/app/views/govuk_publishing_components/components/docs/attachment_link.yml +3 -2
  24. data/app/views/govuk_publishing_components/components/docs/big_number.yml +9 -5
  25. data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +11 -0
  26. data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +1 -0
  27. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +1 -0
  28. data/app/views/govuk_publishing_components/components/docs/document_list.yml +1 -2
  29. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +0 -9
  30. data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +1 -17
  31. data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -1
  32. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -2
  33. data/config/locales/ar.yml +1 -1
  34. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +61 -2
  35. data/lib/govuk_publishing_components/version.rb +1 -1
  36. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36a9c949e5b0818fd9a88c6e3d391589f2856b2354b061526323ee0da268663b
4
- data.tar.gz: 9e50cfbc67ab2a7ad2be57cc08de07d962555de601f760a1737f99100fb20608
3
+ metadata.gz: 9138d245bd1d57f9a78c08fad8234385936554efa39c18fcde3b1e37b1d25a33
4
+ data.tar.gz: 905cd9baa8e3975c2a4fba5540039179d7f4a08e296124be5ec130de3fb86568
5
5
  SHA512:
6
- metadata.gz: d43bd8d3c8c0f58404798658c83e7b5349776b123dd1f3be9f9b380a8124ee510fce6d36ffbc634f33cdd0f4c5f7a4be2002a6c1225869e5289ab9f1c9c65183
7
- data.tar.gz: a26a44f9bc7ba5b824d9f145662675935cf329f8cb98cfd076f217b18b1e2a557aff6df08b8bc03dc3c84f1d0b90330eb26c211569a3d99d3836bb765b4e5fe2
6
+ metadata.gz: 7411d2ecc8f7992e32352b12fcbd6f1363edff9bf2d79e7052b5f117c17ff7060da05c9fdaa07338e8a84540d0826c7a9630e0d82abb623c81763cf5e0da4b55
7
+ data.tar.gz: e0a37e610ddb60d74f694f9fd4056b98730a54b0d2dd941b089209e373a6228b045bab3bc398a25ade701359a6e0fb92b250d51da570180a8d61bf65c013ad7f
@@ -55,6 +55,22 @@
55
55
  }
56
56
  }
57
57
 
58
+ .gem-c-breadcrumbs[dir="rtl"] {
59
+ text-align: start;
60
+
61
+ .govuk-breadcrumbs__list-item {
62
+ float: inline-start;
63
+ margin-inline-end: .625em;
64
+ padding-inline-end: .978em;
65
+
66
+ &::before {
67
+ transform: rotate(-135deg);
68
+ left: 0;
69
+ right: -1.2069em;
70
+ }
71
+ }
72
+ }
73
+
58
74
  @include govuk-media-query($media-type: print) {
59
75
  .gem-c-breadcrumbs {
60
76
  font-size: 12pt;
@@ -17,6 +17,7 @@
17
17
  }
18
18
  }
19
19
 
20
+ .direction-rtl .gem-c-metadata,
20
21
  .gem-c-metadata.direction-rtl {
21
22
  direction: rtl;
22
23
  text-align: start;
@@ -63,9 +64,10 @@
63
64
  }
64
65
  }
65
66
 
67
+ .direction-rtl .gem-c-metadata .gem-c-metadata__term,
66
68
  .gem-c-metadata.direction-rtl .gem-c-metadata__term {
67
- float: right;
68
- clear: right;
69
+ float: inline-start;
70
+ clear: inline-start;
69
71
 
70
72
  @include govuk-media-query($from: tablet) {
71
73
  padding-left: govuk-spacing(1);
@@ -83,8 +85,9 @@
83
85
  }
84
86
  }
85
87
 
88
+ .direction-rtl .gem-c-metadata .gem-c-metadata__definition,
86
89
  .gem-c-metadata.direction-rtl .gem-c-metadata__definition {
87
- float: right;
90
+ float: inline-start;
88
91
  }
89
92
 
90
93
  .gem-c-metadata__toggle-wrap {
@@ -119,6 +119,10 @@
119
119
  @include crest($crest: "bis_crest", $xpos: 9px);
120
120
  }
121
121
 
122
+ .gem-c-organisation-logo__crest--gds {
123
+ @include crest($crest: "gds_crest", $xpos: 8px);
124
+ }
125
+
122
126
  .gem-c-organisation-logo__crest--hmrc {
123
127
  @include crest($crest: "hmrc_crest", $xpos: 8px);
124
128
  }
@@ -58,9 +58,18 @@
58
58
  }
59
59
  }
60
60
 
61
+ // Temp colour overrides
62
+
61
63
  .brand--department-for-science-innovation-and-technology {
62
64
  &.brand__border-color,
63
65
  .brand__border-color {
64
66
  border-color: govuk-organisation-colour("department-for-science-innovation-technology", $contrast-safe: false);
65
67
  }
66
68
  }
69
+
70
+ .brand--government-digital-service {
71
+ &.brand__border-color,
72
+ .brand__border-color {
73
+ border-color: #16eeee;
74
+ }
75
+ }
@@ -13,8 +13,13 @@ This component uses the component wrapper helper. It accepts the following optio
13
13
  - `lang` - accepts a language attribute value
14
14
  - `open` - accepts an open attribute value (true or false)
15
15
  - `hidden` - accepts an empty string, 'hidden', or 'until-found'
16
- - `tabindex` - accepts an integer. The integer can also be passed as a string.
17
- - `dir` - accepts 'rtl', 'ltr', or 'auto'.
16
+ - `tabindex` - accepts an integer. The integer can also be passed as a string
17
+ - `dir` - accepts 'rtl', 'ltr', or 'auto'
18
+ - `type` - accepts any valid type attribute e.g. 'button', 'submit', 'text'
19
+ - `rel` - accepts any valid rel attribute e.g. 'nofollow'
20
+ - `target` - accepts a valid target attribute e.g. '_blank'
21
+ - `title` - accepts any string
22
+ - `draggable` - accepts a draggable attribute value (\"true\" or \"false\")
18
23
  "
19
24
  end
20
25
  end
@@ -6,12 +6,13 @@
6
6
  hide_opendocument_metadata ||= false
7
7
  hide_order_copy_link ||= false
8
8
  attributes = []
9
- data_attributes ||= {}
9
+ url_data_attributes ||= {}
10
10
  details_ga4_attributes ||= {}
11
11
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
12
12
 
13
- container_class_names = %w[gem-c-attachment]
14
- container_class_names << shared_helper.get_margin_bottom if local_assigns.key?(:margin_bottom)
13
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
+ component_helper.add_class("gem-c-attachment")
15
+ component_helper.add_data_attribute({ module: "ga4-link-tracker" })
15
16
  ga4_link = { 'event_name': 'navigation', 'type': 'attachment' }
16
17
 
17
18
  case attachment.type
@@ -55,16 +56,16 @@
55
56
  )
56
57
  end
57
58
 
58
- data_attributes[:ga4_link] = ga4_link
59
+ url_data_attributes[:ga4_link] = ga4_link
59
60
  %>
60
- <%= tag.section class: class_names(container_class_names), data: { module: "ga4-link-tracker" } do %>
61
+ <%= tag.section(**component_helper.all_attributes) do %>
61
62
  <%= tag.div class: "gem-c-attachment__thumbnail govuk-!-display-none-print" do %>
62
63
  <%= link_to attachment.url,
63
64
  class: "govuk-link",
64
65
  target: target,
65
66
  tabindex: "-1",
66
67
  "aria-hidden": true,
67
- data: data_attributes do %>
68
+ data: url_data_attributes do %>
68
69
  <% if attachment.thumbnail_url.present? %>
69
70
  <% image_tag(attachment.thumbnail_url, alt: "", class: "gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--custom") %>
70
71
  <% elsif attachment.html? %>
@@ -88,7 +89,7 @@
88
89
  <%= link_to attachment.title, attachment.url,
89
90
  class: "govuk-link gem-c-attachment__link",
90
91
  target: target,
91
- data: data_attributes %>
92
+ data: url_data_attributes %>
92
93
  <% end %>
93
94
 
94
95
  <% if attachment.reference.present? %>
@@ -3,7 +3,7 @@
3
3
 
4
4
  attachment = GovukPublishingComponents::Presenters::AttachmentHelper.new(attachment)
5
5
  target ||= nil
6
- data_attributes ||= {}
6
+ url_data_attributes ||= {}
7
7
  attributes = []
8
8
  if attachment.content_type_name
9
9
  content = if attachment.content_type_abbr
@@ -30,11 +30,14 @@
30
30
  class: "gem-c-attachment-link__attribute",
31
31
  )
32
32
  end
33
+
34
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
35
+ component_helper.add_class("gem-c-attachment-link")
33
36
  %>
34
- <%= tag.span(class: "gem-c-attachment-link") do %>
37
+ <%= tag.span(**component_helper.all_attributes) do %>
35
38
  <%= link_to(attachment.title, attachment.url,
36
39
  class: "govuk-link",
37
40
  target: target,
38
- data: data_attributes) -%>
41
+ data: url_data_attributes) -%>
39
42
  <%= raw("(#{attributes.join(', ')})") if attributes.any? -%>
40
43
  <% end %>
@@ -1,22 +1,21 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("big-number")
3
3
 
4
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
4
  big_number_helper = GovukPublishingComponents::Presenters::BigNumberHelper.new(local_assigns)
6
5
 
7
6
  number ||= false
8
7
  label ||= nil
9
8
  href ||= nil
10
- data_attributes ||= nil
11
- aria ||= nil
12
- classes = ["gem-c-big-number"]
13
- classes << shared_helper.get_margin_bottom
9
+ nested_data_attributes ||= nil
14
10
 
15
11
  value_classes = big_number_helper.value_classes
12
+
13
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
+ component_helper.add_class("gem-c-big-number")
16
15
  %>
17
16
  <% if number %>
18
17
  <% big_number_value = capture do %>
19
- <%= tag.span class: value_classes, data: href ? nil : data_attributes do %>
18
+ <%= tag.span class: value_classes, data: href ? nil : nested_data_attributes do %>
20
19
  <%
21
20
  # The below check is to account for small symbols awkwardly sitting above the baseline in our typeface and adjust them to sit at the baseline for the purpose of visual harmony
22
21
  # Currently the only small symbol used with big numbers are pluses so they are specifically applied in the below code
@@ -37,9 +36,9 @@
37
36
  <% end %>
38
37
  <% end %>
39
38
 
40
- <%= tag.div class: classes, aria: aria do %>
39
+ <%= tag.div(**component_helper.all_attributes) do %>
41
40
  <% unless href.nil? %>
42
- <%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: data_attributes %>
41
+ <%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: nested_data_attributes %>
43
42
  <% else %>
44
43
  <%= big_number_value %>
45
44
  <% end %>
@@ -30,7 +30,6 @@
30
30
  component_helper.add_class("gem-c-contents-list--custom-title") if title
31
31
  component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
32
32
  component_helper.add_aria_attribute({ label: t("components.contents_list.contents") }) unless local_assigns[:aria][:label]
33
- component_helper.add_role("navigation")
34
33
 
35
34
  title_fallback = t("components.contents_list.contents", locale: I18n.locale, fallback: false, default: "en")
36
35
  %>
@@ -4,9 +4,12 @@
4
4
  breadcrumb_selector = GovukPublishingComponents::Presenters::BreadcrumbSelector.new(content_item, request, prioritise_taxon_breadcrumbs, disable_ga4)
5
5
  inverse ||= false
6
6
  collapse_on_mobile ||= true unless local_assigns[:collapse_on_mobile].eql?(false)
7
+
8
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
9
+ component_helper.add_class("gem-c-contextual-breadcrumbs")
7
10
  %>
8
11
 
9
- <div class="gem-c-contextual-breadcrumbs">
12
+ <%= tag.div(**component_helper.all_attributes) do %>
10
13
  <% if breadcrumb_selector.step_by_step %>
11
14
  <%= render 'govuk_publishing_components/components/step_by_step_nav_header', breadcrumb_selector.breadcrumbs %>
12
15
  <% elsif breadcrumb_selector.breadcrumbs %>
@@ -17,4 +20,4 @@
17
20
  collapse_on_mobile: collapse_on_mobile %>
18
21
  </div>
19
22
  <% end %>
20
- </div>
23
+ <% end %>
@@ -7,9 +7,12 @@
7
7
  show_ukraine_cta = navigation.show_ukraine_cta?
8
8
  ga4_tracking_counts = OpenStruct.new(index_section_count: 0)
9
9
  ga4_tracking_counts.index_section_count = 1 if show_ukraine_cta
10
+
11
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
12
+ component_helper.add_class("gem-c-contextual-sidebar govuk-!-display-none-print")
10
13
  %>
11
14
 
12
- <div class="gem-c-contextual-sidebar govuk-!-display-none-print">
15
+ <%= tag.div(**component_helper.all_attributes) do %>
13
16
  <% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
14
17
  <%# Rendering step by step related items because there are a few but not too many of them %>
15
18
  <%= render 'govuk_publishing_components/components/step_by_step_nav_related', links: navigation.step_nav_helper.related_links, disable_ga4: disable_ga4 %>
@@ -36,4 +39,4 @@
36
39
  <% if show_ukraine_cta %>
37
40
  <%= render 'govuk_publishing_components/components/contextual_sidebar/ukraine_cta', content_item: content_item, disable_ga4: disable_ga4, ga4_tracking_counts: ga4_tracking_counts %>
38
41
  <% end %>
39
- </div>
42
+ <% end %>
@@ -7,7 +7,7 @@
7
7
  service_navigation_aria_label ||= "Service menu"
8
8
  %>
9
9
 
10
- <header class="gem-c-cross-service-header" role="banner" data-module="cross-service-header">
10
+ <header class="gem-c-cross-service-header" data-module="cross-service-header">
11
11
  <%= render "govuk_publishing_components/components/cross_service_header/one_login_header", {
12
12
  one_login_navigation_items: one_login_navigation_items,
13
13
  } %>
@@ -11,7 +11,6 @@
11
11
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
12
12
  component_helper.add_class("gem-c-layout-footer govuk-footer")
13
13
  component_helper.add_class("gem-c-layout-footer--border") if with_border
14
- component_helper.add_role("contentinfo")
15
14
  component_helper.add_data_attribute({ module: "ga4-link-tracker" })
16
15
  %>
17
16
  <%= tag.footer(**component_helper.all_attributes) do %>
@@ -15,7 +15,6 @@
15
15
  component_helper.add_class("gem-c-layout-header govuk-header")
16
16
  component_helper.add_class("gem-c-layout-header--#{environment}") if environment
17
17
  component_helper.add_class("gem-c-layout-header--no-bottom-border") if remove_bottom_border
18
- component_helper.add_role("banner")
19
18
  component_helper.add_data_attribute({ module: "govuk-header" })
20
19
 
21
20
  %>
@@ -65,7 +65,6 @@
65
65
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
66
66
  component_helper.add_class("gem-c-layout-super-navigation-header")
67
67
  component_helper.add_class("gem-c-layout-super-navigation-header--blue-background") if blue_background
68
- component_helper.add_role("banner")
69
68
  component_helper.add_data_attribute({ module: "ga4-event-tracker ga4-link-tracker", ga4_expandable: "" })
70
69
  %>
71
70
  <%= tag.header(**component_helper.all_attributes) do %>
@@ -3,15 +3,19 @@
3
3
 
4
4
  id ||= "modal-dialogue-#{SecureRandom.hex(4)}"
5
5
  wide ||= false
6
- data_attributes = {}
7
6
  aria_label ||= nil
8
7
  dialog_classes = ["gem-c-modal-dialogue__box"]
9
8
  dialog_classes << "gem-c-modal-dialogue__box--wide" if wide
9
+
10
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
11
+ component_helper.add_class("gem-c-modal-dialogue")
12
+ component_helper.add_data_attribute({ module: "modal-dialogue" })
13
+ component_helper.set_id(id)
10
14
  %>
11
15
 
12
- <%= tag.div class: "gem-c-modal-dialogue", data: { module: "modal-dialogue" }, id: id do %>
16
+ <%= tag.div(**component_helper.all_attributes) do %>
13
17
  <%= tag.div class: "gem-c-modal-dialogue__overlay" %>
14
- <%= tag.dialog class: dialog_classes, data: data_attributes, aria: { modal: true, label: aria_label }, role: "dialog", tabindex: 0 do %>
18
+ <%= tag.dialog class: dialog_classes, aria: { modal: true, label: aria_label }, role: "dialog", tabindex: 0 do %>
15
19
  <%= tag.div class: "gem-c-modal-dialogue__header" do %>
16
20
  <%= render "govuk_publishing_components/components/govuk_logo/govuk_logo_crown_only", {
17
21
  classes: %w[gem-c-modal-dialogue__logotype-crown],
@@ -4,7 +4,6 @@
4
4
 
5
5
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
6
6
  component_helper.add_class("govuk-pagination govuk-pagination--block")
7
- component_helper.add_role("navigation")
8
7
  component_helper.add_aria_attribute({ label: t("components.previous_and_next_navigation.pagination") })
9
8
  component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
10
9
 
@@ -8,7 +8,6 @@
8
8
  component_helper.add_aria_attribute({label: aria_label})
9
9
  component_helper.add_class('gem-c-secondary-navigation')
10
10
  component_helper.set_id(id)
11
- component_helper.add_role("navigation")
12
11
  %>
13
12
 
14
13
  <% if items.any? %>
@@ -6,7 +6,6 @@
6
6
  translation_helper = GovukPublishingComponents::Presenters::TranslationNavHelper.new(local_assigns)
7
7
 
8
8
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
9
- component_helper.add_role("navigation")
10
9
  component_helper.add_class("gem-c-translation-nav govuk-!-display-none-print #{translation_helper.classes} #{brand_helper.brand_class}")
11
10
  component_helper.add_aria_attribute({ label: t("common.translations") })
12
11
  %>
@@ -17,6 +17,7 @@ shared_accessibility_criteria:
17
17
  accessibility_criteria: |
18
18
  The thumbnail image, and the link wrapping it, must not focusable or shown to
19
19
  screenreaders.
20
+ uses_component_wrapper_helper: true
20
21
  examples:
21
22
  default:
22
23
  data:
@@ -89,7 +90,7 @@ examples:
89
90
  details_ga4_attributes: {
90
91
  index_section_count: 4
91
92
  }
92
- with_data_attributes:
93
+ with_data_attributes_on_url:
93
94
  data:
94
95
  attachment:
95
96
  title: "Department for Transport information asset register"
@@ -97,7 +98,7 @@ examples:
97
98
  filename: department-for-transport-information-asset-register.csv
98
99
  content_type: application/pdf
99
100
  file_size: 20000
100
- data_attributes:
101
+ url_data_attributes:
101
102
  gtm: "attachment-preview"
102
103
  with_margin_bottom:
103
104
  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 no margin bottom.
@@ -14,6 +14,7 @@ accessibility_criteria: |
14
14
  Attachment links within paragraphs of text do not need to meet the 24 by 24 CSS pixels requirements.
15
15
  shared_accessibility_criteria:
16
16
  - link
17
+ uses_component_wrapper_helper: true
17
18
  examples:
18
19
  default:
19
20
  data:
@@ -58,10 +59,10 @@ examples:
58
59
  title: "Temporary snow ploughs: guidance note"
59
60
  url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
60
61
  target: _blank
61
- with_data_attributes:
62
+ with_data_attributes_on_url:
62
63
  data:
63
64
  attachment:
64
65
  title: "Temporary snow ploughs: guidance note"
65
66
  url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
66
- data_attributes:
67
+ url_data_attributes:
67
68
  gtm: "attachment-preview"
@@ -48,22 +48,26 @@ examples:
48
48
  data:
49
49
  number: 23
50
50
  href: "/government/organisations#ministerial_departments"
51
- with_data_attributes:
51
+ with_nested_data_attributes:
52
52
  description: |
53
- If a `href` attribute is present, `data_attributes` will apply to the `span` containing the number value (see below).
53
+ If a `href` attribute is present, `nested_data_attributes` will apply to the `a` containing the number value (see below). If a `href` is not present, it will apply to the `span` containing the number value.
54
+
55
+ For parent level data attributes, use `data_attributes` which comes from this component having the component wrapper.
54
56
 
55
57
  Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
56
58
  data:
57
59
  number: 23
58
60
  label: Ministerial departments
59
61
  href: "/government/organisations#ministerial_departments"
60
- data_attributes:
62
+ nested_data_attributes:
61
63
  department-count: true
62
- with_data_attributes_but_no_link:
64
+ with_nested_data_attributes_but_no_link:
65
+ description: |
66
+ If a `href` is not present, the data attributes will be applied to the `span` containing the big number. For parent level data attributes, use `data_attributes` which comes from this component having the component wrapper.
63
67
  data:
64
68
  number: 23
65
69
  label: Ministerial departments
66
- data_attributes:
70
+ nested_data_attributes:
67
71
  department-count: true
68
72
  with_aria_attributes:
69
73
  description: Aria attributes are applied to the whole component instance
@@ -121,3 +121,14 @@ examples:
121
121
  url: "/section/sub-section"
122
122
  - title: "Sub-sub-section"
123
123
  url: "/section/sub-section/sub-section"
124
+ right_to_left:
125
+ data:
126
+ collapse_on_mobile: true
127
+ dir: rtl
128
+ breadcrumbs:
129
+ - title: "Section"
130
+ url: "/section"
131
+ - title: "Sub-section"
132
+ url: "/section/sub-section"
133
+ - title: "Sub-sub-section"
134
+ url: "/section/sub-section/sub-section"
@@ -20,6 +20,7 @@ body: |
20
20
  [breadcrumbs]: https://components.publishing.service.gov.uk/component-guide/breadcrumbs
21
21
  accessibility_criteria: |
22
22
  Components called by this component must be accessible
23
+ uses_component_wrapper_helper: true
23
24
  examples:
24
25
  default:
25
26
  data:
@@ -17,6 +17,7 @@ body: |
17
17
  [contextual_breadcrumbs]: /component-guide/contextual_breadcrumbs
18
18
  accessibility_criteria: |
19
19
  Components called by this component must be accessible
20
+ uses_component_wrapper_helper: true
20
21
  examples:
21
22
  default:
22
23
  description: Display collections, guides, quick links, ordered related items and related mainstream content.
@@ -246,8 +246,7 @@ examples:
246
246
  document_type: 'Statistical data set'
247
247
  with_equal_item_spacing:
248
248
  description: |
249
- The new search UI has consistently equal spacing between items in the document list, instead
250
- of the original larger bottom padding.
249
+ Use this option to add equal spacing between items in the document list.
251
250
  data:
252
251
  equal_item_spacing: true
253
252
  items:
@@ -20,17 +20,8 @@ accessibility_criteria: |
20
20
 
21
21
  Note: This decision has been made based on prior experience seeing removal of overuse of `<nav>` elements from www.GOV.UK, which made it confusing for users of assistive technologies to know what were the most important navigation aspects of GOV.UK.
22
22
  Should be challenged if user research indicates this is an issue.
23
-
24
- - have a role of [`contentinfo`](https://www.w3.org/TR/wai-aria-1.1/#contentinfo) at the root of the component (`<footer>`)
25
-
26
- Note: This decision has been made given that most uses of this role tend to be used directly on a `<footer>` element.
27
- Assumption made is that is most predictable for users of assistive technologies.
28
- The spec indicates that `contentinfo` is useful for "Examples of information included in this region of the page are copyrights and links to privacy statements.", which may indicate that it might be better placed around the 'meta' section of this component.
29
- Should be challenged if user research indicates this is an issue.
30
23
  shared_accessibility_criteria:
31
24
  - link
32
- accessibility_excluded_rules:
33
- - landmark-contentinfo-is-top-level # The footer element can not be top level in the examples
34
25
  examples:
35
26
  default:
36
27
  data: {}
@@ -24,6 +24,7 @@ accessibility_criteria: |
24
24
  - return focus to last focused element on close
25
25
 
26
26
  display_preview: false
27
+ uses_component_wrapper_helper: true
27
28
  examples:
28
29
  default:
29
30
  embed: |
@@ -100,20 +101,3 @@ examples:
100
101
  <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
101
102
  <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
102
103
  <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
103
- with_data_attributes:
104
- embed: |
105
- <%= render "govuk_publishing_components/components/button", {
106
- text: "Open modal with data attributes",
107
- data_attributes: {
108
- toggle: "modal",
109
- target: "modal-with-data-attributes"
110
- }
111
- } %>
112
- <%= component %>
113
- data:
114
- id: modal-with-data-attributes
115
- data_attributes:
116
- gtm: modal
117
- block: |
118
- <h1 class="govuk-heading-l">Modal title</h1>
119
- <p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
@@ -12,7 +12,7 @@
12
12
  <div class="govuk-grid-column-two-thirds">
13
13
  <div id="wrapper">
14
14
  <%= yield :before_content %>
15
- <main role="main" id="content">
15
+ <main id="content">
16
16
  <%= yield %>
17
17
  </main>
18
18
  </div>
@@ -1,5 +1,4 @@
1
- <nav role="navigation"
2
- class="gem-c-related-navigation__nav-section"
1
+ <nav class="gem-c-related-navigation__nav-section"
3
2
  aria-labelledby="related-nav-<%= section_title %>-<%= random %>"
4
3
  data-module="gem-toggle">
5
4
 
@@ -134,7 +134,7 @@ ar:
134
134
  history: المحفوظات
135
135
  last_updated: التحديث الأخير
136
136
  part_of: جزء من
137
- published: منشورة
137
+ published: تاريخ النشر
138
138
  see_all_updates: اطلع على كل التحديثات
139
139
  modal_dialogue:
140
140
  close_modal: إغلاق مربع الحوار المشروط
@@ -15,6 +15,9 @@ module GovukPublishingComponents
15
15
  check_tabindex_is_valid(@options[:tabindex]) if @options.include?(:tabindex)
16
16
  check_dir_is_valid(@options[:dir]) if @options.include?(:dir)
17
17
  check_type_is_valid(@options[:type]) if @options.include?(:type)
18
+ check_draggable_is_valid(@options[:draggable]) if @options.include?(:draggable)
19
+ check_rel_is_valid(@options[:rel]) if @options.include?(:rel)
20
+ check_target_is_valid(@options[:target]) if @options.include?(:target)
18
21
  check_margin_bottom_is_valid(@options[:margin_bottom]) if @options.include?(:margin_bottom)
19
22
  end
20
23
 
@@ -35,6 +38,10 @@ module GovukPublishingComponents
35
38
  attributes[:tabindex] = @options[:tabindex] unless @options[:tabindex].blank?
36
39
  attributes[:dir] = @options[:dir] unless @options[:dir].blank?
37
40
  attributes[:type] = @options[:type] unless @options[:type].blank?
41
+ attributes[:draggable] = @options[:draggable] unless @options[:draggable].blank?
42
+ attributes[:rel] = @options[:rel] unless @options[:rel].blank?
43
+ attributes[:target] = @options[:target] unless @options[:target].blank?
44
+ attributes[:title] = @options[:title] unless @options[:title].blank?
38
45
 
39
46
  attributes
40
47
  end
@@ -94,6 +101,30 @@ module GovukPublishingComponents
94
101
  @options[:type] = type_attribute
95
102
  end
96
103
 
104
+ def set_draggable(draggable_attribute)
105
+ check_draggable_is_valid(draggable_attribute)
106
+ @options[:draggable] = draggable_attribute
107
+ end
108
+
109
+ def add_rel(rel_attribute)
110
+ check_rel_is_valid(rel_attribute)
111
+ extend_string(:rel, rel_attribute)
112
+ end
113
+
114
+ def set_rel(rel_attribute)
115
+ check_rel_is_valid(rel_attribute)
116
+ @options[:rel] = rel_attribute
117
+ end
118
+
119
+ def set_target(target_attribute)
120
+ check_target_is_valid(target_attribute)
121
+ @options[:target] = target_attribute
122
+ end
123
+
124
+ def set_title(title_attribute)
125
+ @options[:title] = title_attribute
126
+ end
127
+
97
128
  def set_margin_bottom(margin_bottom)
98
129
  check_margin_bottom_is_valid(margin_bottom)
99
130
  @options[:margin_bottom] = margin_bottom
@@ -191,7 +222,7 @@ module GovukPublishingComponents
191
222
  end
192
223
 
193
224
  def check_dir_is_valid(dir_attribute)
194
- return if dir_attribute.nil?
225
+ return if dir_attribute.blank?
195
226
 
196
227
  options = %w[ltr rtl auto]
197
228
  unless options.include? dir_attribute
@@ -200,7 +231,7 @@ module GovukPublishingComponents
200
231
  end
201
232
 
202
233
  def check_type_is_valid(type_attribute)
203
- return if type_attribute.nil?
234
+ return if type_attribute.blank?
204
235
 
205
236
  options = %w[button checkbox color date datetime-local email file hidden image month number password radio range reset search submit tel text time url week]
206
237
  unless options.include? type_attribute
@@ -208,6 +239,34 @@ module GovukPublishingComponents
208
239
  end
209
240
  end
210
241
 
242
+ def check_draggable_is_valid(draggable_attribute)
243
+ return if draggable_attribute.blank?
244
+
245
+ options = %w[true false]
246
+ unless options.include? draggable_attribute
247
+ raise(ArgumentError, "draggable attribute (#{draggable_attribute}) is not recognised")
248
+ end
249
+ end
250
+
251
+ def check_rel_is_valid(rel_attribute)
252
+ return if rel_attribute.blank?
253
+
254
+ options = %w[alternate author bookmark canonical dns-prefetch external expect help icon license manifest me modulepreload next nofollow noopener noreferrer opener pingback preconnect prefetch preload prerender prev privacy-policy search stylesheet tag terms-of-service]
255
+ rel_array = rel_attribute.split(" ")
256
+ unless rel_array.all? { |r| options.include? r }
257
+ raise(ArgumentError, "rel attribute (#{rel_attribute}) is not recognised")
258
+ end
259
+ end
260
+
261
+ def check_target_is_valid(target_attribute)
262
+ return if target_attribute.blank?
263
+
264
+ options = %w[_self _blank _parent _top _unfencedTop]
265
+ unless options.include? target_attribute
266
+ raise(ArgumentError, "target attribute (#{target_attribute}) is not recognised")
267
+ end
268
+ end
269
+
211
270
  def extend_string(option, string)
212
271
  ((@options[option] ||= "") << " #{string}").strip!
213
272
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "48.0.0".freeze
2
+ VERSION = "49.1.0".freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 48.0.0
4
+ version: 49.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-13 00:00:00.000000000 Z
10
+ date: 2025-01-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: govuk_app_config
@@ -396,6 +396,7 @@ files:
396
396
  - app/assets/images/govuk_publishing_components/crests/bis_crest_18px_x2.png
397
397
  - app/assets/images/govuk_publishing_components/crests/coastguard_18px_x2.png
398
398
  - app/assets/images/govuk_publishing_components/crests/dbt_crest_18px_x2.png
399
+ - app/assets/images/govuk_publishing_components/crests/gds_crest_18px_x2.png
399
400
  - app/assets/images/govuk_publishing_components/crests/hmrc_crest_18px_x2.png
400
401
  - app/assets/images/govuk_publishing_components/crests/ho_crest_18px_x2.png
401
402
  - app/assets/images/govuk_publishing_components/crests/mod_crest_18px_x2.png
@@ -1994,7 +1995,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1994
1995
  - !ruby/object:Gem::Version
1995
1996
  version: '0'
1996
1997
  requirements: []
1997
- rubygems_version: 3.6.2
1998
+ rubygems_version: 3.6.3
1998
1999
  specification_version: 4
1999
2000
  summary: A gem to document components in GOV.UK frontend applications
2000
2001
  test_files: []