govuk_publishing_components 36.0.0 → 36.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 773208000d7b04127bf634415ed17bbfd977ba73ab9a45e2eca5742f19eacbc6
4
- data.tar.gz: c2b77952558ca4fd34c22e87088721dffe9d55346cc1cd9a5ac8ee3f64ff2087
3
+ metadata.gz: d41ddf9d28242ee496fbf50b88e10bbf1785c27ed809bb8ee40a9cb099092068
4
+ data.tar.gz: 72d8c532895124b04ffedc228c0baffaa180828f1765d75a7cc792b4969f6ceb
5
5
  SHA512:
6
- metadata.gz: 5d2efbb677bc763e54375000098c7419ccec70d70d4ad49093e6fda016788ec22ef989d8c7a480e5e9fa00d4dba4c6ac10672bb683baa67d129a3a49da80e460
7
- data.tar.gz: 5e34040e64f3863838db6c24a5d8e2c0f0d423d62f24f6841adb204e0071899699796c07740130b6ec06205a87cffdcfed80814a177f7eb6aa93cd7112e55e1a
6
+ metadata.gz: ddd6e3b7b2dcb71844e37cb5065aea4c331c0a4e0bbf7daa38e52a9b4161bde2edea212ac24553e74df5d5b599346a8f4e72b853a1a3eb99413fec316519497b
7
+ data.tar.gz: bd76e4fbb84e10bd6d20b55bd46e499431d52b9dd794b1b152065f63798d922587b9ef22d8fca9a9b3fe6d5e77d5387ddfbd52e0dcde86b7a1bfe5948ecfcd84
@@ -7,15 +7,10 @@
7
7
  checkboxes_count_id = checkboxes_id + "-count"
8
8
  show_filter ||= false
9
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
10
  %>
14
11
 
15
12
  <% if show_filter %>
16
- <%
17
- filter_id ||= "input-#{SecureRandom.hex(4)}"
18
- %>
13
+ <% filter_id ||= "input-#{SecureRandom.hex(4)}" %>
19
14
  <% filter = capture do %>
20
15
  <%= tag.label for: filter_id, class: "govuk-label govuk-visually-hidden" do %>
21
16
  Filter <%= title %>
@@ -34,20 +29,27 @@
34
29
  <% filter_element = CGI::escapeHTML(filter) %>
35
30
  <% end %>
36
31
 
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
- >
32
+ <%
33
+ helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
34
+ helper.add_class("gem-c-option-select")
35
+ helper.add_data_attribute({ module: "option-select" })
36
+ helper.add_data_attribute({ "closed-on-load": true }) if local_assigns.include?(:closed_on_load) && closed_on_load
37
+ helper.add_data_attribute({ "closed-on-load-mobile": "true" }) if local_assigns.include?(:closed_on_load_mobile) && closed_on_load_mobile
38
+ helper.add_data_attribute({ "input-aria-controls": aria_controls_id }) if local_assigns.include?(:aria_controls_id)
39
+ helper.add_data_attribute({ "filter-element": filter_element }) if show_filter
40
+
41
+ options_container_classes = %w[gem-c-option-select__container js-options-container]
42
+ options_container_classes << "gem-c-option-select__container--large" if large
43
+ %>
44
+
45
+ <%= tag.div(**helper.all_attributes) do %>
44
46
  <h3 class="gem-c-option-select__heading js-container-heading">
45
47
  <span class="gem-c-option-select__title js-container-button" id="<%= title_id %>"><%= title %></span>
46
48
  <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
49
  <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
50
  </h3>
49
51
 
50
- <%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class: classes, id: options_container_id, tabindex: "-1") do %>
52
+ <%= content_tag(:div, role: "group", aria: { labelledby: title_id }, class: options_container_classes, id: options_container_id, tabindex: "-1") do %>
51
53
  <div class="gem-c-option-select__container-inner js-auto-height-inner">
52
54
  <% if show_filter %>
53
55
  <span id="<%= checkboxes_count_id %>"
@@ -68,4 +70,4 @@
68
70
  } %>
69
71
  </div>
70
72
  <% end %>
71
- </div>
73
+ <% end %>
@@ -22,6 +22,7 @@ accessibility_criteria: |
22
22
  - inform the user that is it an editable field
23
23
  - inform the user when there are matches, or if there are no matches
24
24
  - inform the user as the number of matches changes
25
+ uses_component_wrapper_helper: true
25
26
  examples:
26
27
  default:
27
28
  data:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "36.0.0".freeze
2
+ VERSION = "36.0.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 36.0.0
4
+ version: 36.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev