govuk_publishing_components 45.7.0 → 45.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f666e85d9ff44b241dd92ecedaac2816dffcfd44c50b85f206bc5a0c209529b
4
- data.tar.gz: c87b274a6e3bb1170ab2144ad3cfe21f22602381406edad542f03fbde9caa00c
3
+ metadata.gz: 7048798873f02e7ccdd7098ca9ce280a403df59e5b24d1ae54f93b6405971c48
4
+ data.tar.gz: 7145d41beda3ab925378248e55ee8dc9afb34585cc5a81df804a74fd664d1f05
5
5
  SHA512:
6
- metadata.gz: 7062f9f8179dabef8ce3d70b4aca757f257c62e69a19486d095ae8fcfcddd8cce3b3405fddc663bce7e368d2272b89b80a921fa777c9adca32e3624c4d989953
7
- data.tar.gz: ec90e23e9b1c953bc687b1abd5b5850336053a86c5f03a251eef0d05aab6747a280888f4c65672eddb965355e22a73402590e78844d6b0d0e3ce71b5cfe59d3b
6
+ metadata.gz: d39c1a66ce5dbe6bca7dd41e7864170d4b413c250be1806fbe6873677bbc89126cab120ebb92741735ebd90665d3deb7c1cee17145770f9b2636f236ae67a1ae
7
+ data.tar.gz: 0a7f8ff45a1b76035cbf7842f3344d61bf1c2174727b643868a4814aacde5dfccfe87d7fd8b0dd57406ff52b70f6a0926041fd75413433178bc571ab17b1d942
@@ -116,15 +116,15 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
116
116
  // Set tracking attributes on the input field. These can be used by the containing form's
117
117
  // analytics module to track the user's interaction with the autocomplete component.
118
118
  setTrackingAttributes (query, results) {
119
- // Only set the suggestions attribute when results actually come back (so this attribute
120
- // tracks the last seen non-empty suggestions, even if the user then amends their query to one
121
- // that doesn't generate any)
119
+ // Only set the suggestions and trigger input attributes when results actually come back (so
120
+ // these attributes track the last seen non-empty suggestions and input used to trigger them,
121
+ // even if the user then amends their query to one that doesn't generate any)
122
122
  if (results.length > 0) {
123
123
  const formattedResults = results.slice(0, 5).join('|')
124
124
  this.$autocompleteInput.dataset.autocompleteSuggestions = formattedResults
125
+ this.$autocompleteInput.dataset.autocompleteTriggerInput = query
125
126
  }
126
127
 
127
- this.$autocompleteInput.dataset.autocompleteTriggerInput = query
128
128
  this.$autocompleteInput.dataset.autocompleteSuggestionsCount = results.length
129
129
  this.$autocompleteInput.dataset.autocompleteAccepted = false
130
130
  }
@@ -4,25 +4,26 @@
4
4
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
5
 
6
6
  hint_text ||= ""
7
- id ||= nil
8
7
  is_radio_label ||= false
9
8
  bold ||= false
10
9
  heading_size = false unless shared_helper.valid_heading_size?(heading_size)
11
10
  is_page_heading ||= false
12
11
  right_to_left ||= false
13
12
 
14
- css_classes = %w[gem-c-label govuk-label]
15
- css_classes << "govuk-label--s" if bold
16
- css_classes << "govuk-radios__label" if is_radio_label
17
- css_classes << "govuk-label--#{heading_size}" if heading_size
13
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
+ component_helper.add_class("gem-c-label govuk-label")
15
+ component_helper.add_class("govuk-label--s") if bold
16
+ component_helper.add_class("govuk-radios__label") if is_radio_label
17
+ component_helper.add_class("govuk-label--#{heading_size}") if heading_size
18
+ component_helper.set_dir("rtl") if right_to_left
18
19
  %>
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, dir: right_to_left ? "rtl" : nil %>
23
+ <%= tag.label text, for: html_for, **component_helper.all_attributes %>
23
24
  <% end %>
24
25
  <% else %>
25
- <%= tag.label text, id: id, for: html_for, class: css_classes, dir: right_to_left ? "rtl" : nil %>
26
+ <%= tag.label text, for: html_for, **component_helper.all_attributes %>
26
27
  <% end %>
27
28
 
28
29
  <% if hint_text.present? %>
@@ -5,12 +5,13 @@
5
5
  inverse ||= false
6
6
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
7
7
 
8
- custom_margin_bottom_class = shared_helper.get_margin_bottom if [*0..9].include?(local_assigns[:margin_bottom])
9
-
10
- classes = %w(gem-c-lead-paragraph)
11
- classes << "gem-c-lead-paragraph--inverse" if inverse
12
- classes << custom_margin_bottom_class if local_assigns[:margin_bottom]
8
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
9
+ component_helper.add_class("gem-c-lead-paragraph")
10
+ component_helper.add_class("gem-c-lead-paragraph--inverse") if inverse
11
+ component_helper.add_class(shared_helper.get_margin_bottom) if [*0..9].include?(local_assigns[:margin_bottom])
13
12
  %>
14
13
  <% if text.present? %>
15
- <%= content_tag :p, text, class: classes %>
14
+ <%= tag.p(**component_helper.all_attributes) do %>
15
+ <%= text %>
16
+ <% end %>
16
17
  <% end %>
@@ -2,6 +2,7 @@ name: Form label
2
2
  description: Use labels for all form fields.
3
3
  body: |
4
4
  For use with other form inputs e.g. [Radio buttons](/component-guide/radio)
5
+ uses_component_wrapper_helper: true
5
6
  accessibility_criteria: |
6
7
  All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
7
8
 
@@ -1,5 +1,6 @@
1
1
  name: Lead paragraph
2
2
  description: The opening paragraph of content. Typically a content item’s description field.
3
+ uses_component_wrapper_helper: true
3
4
  accessibility_criteria: |
4
5
  The lead paragraph must be visually distinct from other paragraphs.
5
6
 
@@ -10,6 +11,7 @@ examples:
10
11
  text: 'UK Visas and Immigration is making changes to the Immigration Rules affecting various categories.'
11
12
  right_to_left:
12
13
  data:
14
+ dir: 'rtl'
13
15
  text: 'قرارات تحقيقات وزارة الدفاع في الانتهاكات المزعومة للمادة ٢ والمادة ٣ من المعاهدة الاوروبية لحقوق الانسان خلال العمليات العسكرية في العراق.'
14
16
  context:
15
17
  right_to_left: true
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "45.7.0".freeze
2
+ VERSION = "45.8.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 45.7.0
4
+ version: 45.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-22 00:00:00.000000000 Z
11
+ date: 2024-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chartkick