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 +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +2 -2
- data/app/models/govuk_publishing_components/audit_comparer.rb +0 -1
- data/app/views/govuk_publishing_components/components/_select.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/docs/select.yml +25 -0
- data/lib/govuk_publishing_components/presenters/select_helper.rb +5 -3
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffe0c2fbfcd53a9c25e9ab76f80625ebae91d098a528892118b658c9142a7641
|
4
|
+
data.tar.gz: f69ad84e0d5cc39772ddb557f50771e229db6a09c5a0e384adadfcc8630ccd7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fb6267d1fb31f6f7e557ee3259a1808739e9ad9a9803102790729b139cd9d96683983136105588b3b576e57e41f8884315a041fe89a06a7231f5cf641e041e2
|
7
|
+
data.tar.gz: d349cc3c24e05d6af50dc4eb6dfe528a3954ce7f535b8deb255682125c03f9d943f98d58c2867a9b1716000eff05c40f40d7e8d01a79c31e00e028b7838e748c
|
data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js
CHANGED
@@ -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)
|
153
|
+
var previewRegex = /\.\w+\/preview|(\/csv-preview\/)/i
|
154
|
+
return previewRegex.test(href)
|
155
155
|
},
|
156
156
|
|
157
157
|
hrefPointsToDownloadPath: function (href) {
|
@@ -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
|
-
|
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:
|
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
|
-
|
47
|
+
options_extra_attributes(option[:data_attributes], option[:disabled]),
|
48
48
|
]
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
53
|
-
|
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|
|