govuk_publishing_components 57.2.0 → 57.3.0

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: fc35380bef3675b6001b4827358013c9c54218a696fbe7170625d5c0c9f33bdd
4
- data.tar.gz: 77f96614f15a6e7978e3265bf3f3275e25826f7cd3a629cc90bbb55cb2675c30
3
+ metadata.gz: ffe0c2fbfcd53a9c25e9ab76f80625ebae91d098a528892118b658c9142a7641
4
+ data.tar.gz: f69ad84e0d5cc39772ddb557f50771e229db6a09c5a0e384adadfcc8630ccd7f
5
5
  SHA512:
6
- metadata.gz: 765da3cf1fb7d292acb42f840bc373166360790f30cb869334629750042fe0e7869ff310115e21019757f8bce65f5b3ad6e2ecaca1ac5f06d39f93592370d4ac
7
- data.tar.gz: fe864e55147fd9faf3986d951c5af9b91d96c218563b2a1a080fb742c14ed0aca1dddc3ec01e281259a32e628cc0745644c54ab7ed558c87e62066c44818d582
6
+ metadata.gz: 6fb6267d1fb31f6f7e557ee3259a1808739e9ad9a9803102790729b139cd9d96683983136105588b3b576e57e41f8884315a041fe89a06a7231f5cf641e041e2
7
+ data.tar.gz: d349cc3c24e05d6af50dc4eb6dfe528a3954ce7f535b8deb255682125c03f9d943f98d58c2867a9b1716000eff05c40f40d7e8d01a79c31e00e028b7838e748c
@@ -150,8 +150,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
150
150
  For example, .csv/preview or .mp4/preview will be matched.
151
151
  Regex is used over JS string methods as this should work with anchor links, query string parameters and files that may have 'preview' in their name.
152
152
  */
153
- var previewRegex = /\.\w+\/preview/i
154
- return previewRegex.test(href) || href.startsWith('https://www.gov.uk/csv-preview/')
153
+ var previewRegex = /\.\w+\/preview|(\/csv-preview\/)/i
154
+ return previewRegex.test(href)
155
155
  },
156
156
 
157
157
  hrefPointsToDownloadPath: function (href) {
@@ -6,7 +6,6 @@ module GovukPublishingComponents
6
6
  if gem_data[:gem_found]
7
7
  @applications_using_static = %w[
8
8
  collections
9
- feedback
10
9
  finder-frontend
11
10
  frontend
12
11
  government-frontend
@@ -7,12 +7,16 @@
7
7
  name ||= id
8
8
  is_page_heading ||= false
9
9
  data_attributes ||= {}
10
+ aria_controls ||= nil
10
11
 
11
12
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
12
13
  heading_size = false unless shared_helper.valid_heading_size?(heading_size)
13
14
  select_helper = GovukPublishingComponents::Presenters::SelectHelper.new(local_assigns)
14
15
 
15
- aria_describedby = { describedby: select_helper.describedby }
16
+ aria_attributes = {
17
+ controls: aria_controls,
18
+ describedby: select_helper.describedby
19
+ }
16
20
  %>
17
21
  <% if select_helper.options.any? && id && label %>
18
22
  <%= content_tag :div, class: select_helper.css_classes do %>
@@ -40,6 +44,6 @@
40
44
  } %>
41
45
  <% end %>
42
46
 
43
- <%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_helper.select_classes, aria: aria_describedby, data: data_attributes %>
47
+ <%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_helper.select_classes, aria: aria_attributes, data: data_attributes %>
44
48
  <% end %>
45
49
  <% end %>
@@ -42,6 +42,19 @@ examples:
42
42
  selected: true
43
43
  - text: Option three
44
44
  value: option3
45
+ with_disabled_options:
46
+ description: Options can be disabled using the `disabled` parameter. Note that it is possible to have an option that is both disabled and selected.
47
+ data:
48
+ id: dropdown2-0
49
+ label: Option 3 disabled
50
+ options:
51
+ - text: Option one
52
+ value: option1
53
+ - text: Option two
54
+ value: option2
55
+ - text: Option three
56
+ value: option3
57
+ disabled: true
45
58
  with_hint:
46
59
  description: When a hint is included the `aria-describedby` attribute of the select is included to point to the hint. When an error and a hint are present, that attribute includes the IDs of both the hint and the error.
47
60
  data:
@@ -54,6 +67,18 @@ examples:
54
67
  value: option1
55
68
  - text: Something else
56
69
  value: option2
70
+ with_aria_controls:
71
+ data:
72
+ id: dropdown4-4
73
+ label: My Dropdown
74
+ aria_controls: dropdown4-3
75
+ options:
76
+ - text: Option one
77
+ value: option1
78
+ - text: Option two
79
+ value: option2
80
+ - text: Option three
81
+ value: option3
57
82
  with_data_attributes:
58
83
  description: Data attributes can be passed to the select component if needed.
59
84
  data:
@@ -44,13 +44,15 @@ module GovukPublishingComponents
44
44
  [
45
45
  option[:text],
46
46
  option[:value],
47
- options_data_attribute(option[:data_attributes]),
47
+ options_extra_attributes(option[:data_attributes], option[:disabled]),
48
48
  ]
49
49
  end
50
50
  end
51
51
 
52
- def options_data_attribute(attributes)
53
- return {} if attributes.nil?
52
+ def options_extra_attributes(attributes, disabled)
53
+ attrs = {}
54
+ attrs[:disabled] = true if disabled
55
+ return attrs if attributes.nil?
54
56
 
55
57
  attrs = {}
56
58
  attributes.each do |key, value|
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "57.2.0".freeze
2
+ VERSION = "57.3.0".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: 57.2.0
4
+ version: 57.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev