govuk_publishing_components 20.3.0 → 20.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +11 -1
- data/app/views/govuk_publishing_components/components/_radio.html.erb +7 -2
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +14 -2
- data/app/views/govuk_publishing_components/components/docs/radio.yml +16 -4
- data/config/locales/en.yml +1 -1
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +6 -3
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be9c34e0c68a4a32acc65f384dd54ac57e84773a5fc4099bdd9c12d20eedbbdd
|
4
|
+
data.tar.gz: e6fcf672363a3b0feee426acc8135e65948802b9dc983d9c8b2eb44a8624b228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b56ee33a9621f7e751f113b61505dcadc0590a284374b3af27d33ba0a6d5aea313ed012a64ae156edef9297e7f0a54265da6ce79543ab712b8b3d7bcae4841f2
|
7
|
+
data.tar.gz: 90b2345ffb9bf05079648ef713fbcac8a18899d7cdc361d58c0b4fcad852a91d8d75bfd44c0bf09e19e5f8c3fab454fbf2c26392668e6cad9579e670baa360f7
|
@@ -69,6 +69,13 @@ $govuk-cookie-banner-text-green: #00823b;
|
|
69
69
|
display: none;
|
70
70
|
position: relative;
|
71
71
|
padding: govuk-spacing(1);
|
72
|
+
|
73
|
+
|
74
|
+
// This element is focused using JavaScript so that it's being read out by screen readers
|
75
|
+
// for this reason we don't want to show the default outline or emphasise it visually using `govuk-focused-text`
|
76
|
+
&:focus {
|
77
|
+
outline: none;
|
78
|
+
}
|
72
79
|
}
|
73
80
|
|
74
81
|
.gem-c-cookie-banner__confirmation-message,
|
@@ -98,12 +105,15 @@ $govuk-cookie-banner-text-green: #00823b;
|
|
98
105
|
padding: govuk-spacing(0);
|
99
106
|
margin-top: govuk-spacing(2);
|
100
107
|
|
101
|
-
|
102
108
|
&:hover {
|
103
109
|
color: $govuk-link-hover-colour;
|
104
110
|
cursor: pointer;
|
105
111
|
}
|
106
112
|
|
113
|
+
&:focus {
|
114
|
+
@include govuk-focused-text;
|
115
|
+
}
|
116
|
+
|
107
117
|
@include govuk-media-query($from: desktop) {
|
108
118
|
margin-top: govuk-spacing(0);
|
109
119
|
position: absolute;
|
@@ -7,6 +7,8 @@
|
|
7
7
|
small ||= false
|
8
8
|
inline ||= false
|
9
9
|
is_page_heading ||= false
|
10
|
+
heading_size = 'm' unless ['s', 'm', 'l', 'xl'].include?(heading_size)
|
11
|
+
|
10
12
|
description ||= nil
|
11
13
|
hint ||= nil
|
12
14
|
error_message ||= nil
|
@@ -23,6 +25,9 @@
|
|
23
25
|
radio_classes << "govuk-radios--small" if small
|
24
26
|
radio_classes << "govuk-radios--inline" if inline
|
25
27
|
|
28
|
+
legend_classes = %w(govuk-fieldset__legend)
|
29
|
+
legend_classes << "govuk-fieldset__legend--#{heading_size}"
|
30
|
+
|
26
31
|
aria = "#{hint_id} #{"#{error_id}" if has_error}".strip if hint or has_error
|
27
32
|
|
28
33
|
# check if any item is set as being conditional
|
@@ -33,11 +38,11 @@
|
|
33
38
|
|
34
39
|
<% if heading.present? %>
|
35
40
|
<% if is_page_heading %>
|
36
|
-
<%= tag.legend class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title
|
41
|
+
<%= tag.legend class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title" do %>
|
37
42
|
<%= tag.h1 heading, class: "gem-c-title__text" %>
|
38
43
|
<% end %>
|
39
44
|
<% else %>
|
40
|
-
<%= tag.legend heading, class:
|
45
|
+
<%= tag.legend heading, class: legend_classes %>
|
41
46
|
<% end %>
|
42
47
|
<% end %>
|
43
48
|
|
@@ -73,7 +73,7 @@ examples:
|
|
73
73
|
heading: "Choose your favourite skittles"
|
74
74
|
description: |
|
75
75
|
Skittles consist of hard sugar shells imprinted with the letter "S".
|
76
|
-
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
76
|
+
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
77
77
|
palm kernel oil along with fruit juice, citric acid, natural and artificial flavors.
|
78
78
|
hint_text: "Taste the rainbow"
|
79
79
|
items:
|
@@ -94,7 +94,7 @@ examples:
|
|
94
94
|
is_page_heading: true
|
95
95
|
description: |
|
96
96
|
Skittles consist of hard sugar shells imprinted with the letter "S".
|
97
|
-
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
97
|
+
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
98
98
|
palm kernel oil along with fruit juice, citric acid, natural and artificial flavors.
|
99
99
|
hint_text: "Taste the rainbow"
|
100
100
|
items:
|
@@ -164,6 +164,18 @@ examples:
|
|
164
164
|
value: "green"
|
165
165
|
- label: "Blue"
|
166
166
|
value: "blue"
|
167
|
+
with_custom_heading_size:
|
168
|
+
data:
|
169
|
+
name: "favourite_colour"
|
170
|
+
heading: "What is your favourite colour?"
|
171
|
+
heading_size: "s"
|
172
|
+
items:
|
173
|
+
- label: "Red"
|
174
|
+
value: "red"
|
175
|
+
- label: "Green"
|
176
|
+
value: "green"
|
177
|
+
- label: "Blue"
|
178
|
+
value: "blue"
|
167
179
|
checkboxes_with_data_attributes:
|
168
180
|
description: Data attributes such as tracking can be applied if required. This will fire tracking identical tracking events on check and uncheck. See below to send different events on uncheck.
|
169
181
|
data:
|
@@ -126,7 +126,7 @@ examples:
|
|
126
126
|
heading: "What is your favourite colour?"
|
127
127
|
description: |
|
128
128
|
Skittles consist of hard sugar shells imprinted with the letter "S".
|
129
|
-
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
129
|
+
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
130
130
|
palm kernel oil along with fruit juice, citric acid, natural and artificial flavors.
|
131
131
|
items:
|
132
132
|
- value: "red"
|
@@ -141,7 +141,7 @@ examples:
|
|
141
141
|
heading: "What is your favourite colour?"
|
142
142
|
description: |
|
143
143
|
Skittles consist of hard sugar shells imprinted with the letter "S".
|
144
|
-
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
144
|
+
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
145
145
|
palm kernel oil along with fruit juice, citric acid, natural and artificial flavors.
|
146
146
|
hint: "Choose the colour"
|
147
147
|
items:
|
@@ -158,7 +158,7 @@ examples:
|
|
158
158
|
is_page_heading: true
|
159
159
|
description: |
|
160
160
|
Skittles consist of hard sugar shells imprinted with the letter "S".
|
161
|
-
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
161
|
+
The interior consists mainly of sugar, corn syrup, and hydrogenated
|
162
162
|
palm kernel oil along with fruit juice, citric acid, natural and artificial flavors.
|
163
163
|
hint: "Choose the colour"
|
164
164
|
items:
|
@@ -168,6 +168,19 @@ examples:
|
|
168
168
|
text: "Green"
|
169
169
|
- value: "blue"
|
170
170
|
text: "Blue"
|
171
|
+
with_custom_heading_size:
|
172
|
+
data:
|
173
|
+
name: "radio-group-description"
|
174
|
+
heading: "What is your favourite colour?"
|
175
|
+
heading_size: "s"
|
176
|
+
items:
|
177
|
+
- value: "red"
|
178
|
+
text: "Red"
|
179
|
+
- value: "green"
|
180
|
+
text: "Green"
|
181
|
+
- value: "blue"
|
182
|
+
text: "Blue"
|
183
|
+
|
171
184
|
with_hint_text_on_radios:
|
172
185
|
data:
|
173
186
|
name: "radio-group-hint-text"
|
@@ -308,4 +321,3 @@ examples:
|
|
308
321
|
text: "On"
|
309
322
|
- value: "off"
|
310
323
|
text: "Off"
|
311
|
-
|
data/config/locales/en.yml
CHANGED
@@ -24,7 +24,7 @@ en:
|
|
24
24
|
translations: "Translations"
|
25
25
|
components:
|
26
26
|
attachment:
|
27
|
-
opendocument_html: "This file is in an <a href='https://www.gov.uk/guidance/open-document-
|
27
|
+
opendocument_html: "This file is in an <a href='https://www.gov.uk/guidance/using-open-document-formats-odf-in-your-organisation' target=%{target} class='govuk-link'>OpenDocument</a> format"
|
28
28
|
request_format_text: "This file may not be suitable for users of assistive technology."
|
29
29
|
request_format_cta: "Request a different format"
|
30
30
|
request_format_details_html: "If you use assistive technology and need a version of this document in a more accessible format, please email <a href='mailto:%{alternative_format_contact_email}' target='_blank' class='govuk-link'>%{alternative_format_contact_email}</a>. Please tell us what format you need. It will help us if you say what assistive technology you use."
|
@@ -4,7 +4,7 @@ module GovukPublishingComponents
|
|
4
4
|
include ActionView::Helpers
|
5
5
|
include ActionView::Context
|
6
6
|
|
7
|
-
attr_reader :items, :name, :css_classes, :list_classes, :error, :has_conditional, :has_nested, :id, :hint_text, :description
|
7
|
+
attr_reader :items, :name, :css_classes, :list_classes, :error, :has_conditional, :has_nested, :id, :hint_text, :description, :heading_size
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
@items = options[:items] || []
|
@@ -22,6 +22,8 @@ module GovukPublishingComponents
|
|
22
22
|
|
23
23
|
@id = options[:id] || "checkboxes-#{SecureRandom.hex(4)}"
|
24
24
|
@heading = options[:heading] || nil
|
25
|
+
@heading_size = options[:heading_size]
|
26
|
+
@heading_size = 'm' unless %w(s m l xl).include?(@heading_size)
|
25
27
|
@is_page_heading = options[:is_page_heading]
|
26
28
|
@description = options[:description] || nil
|
27
29
|
@no_hint_text = options[:no_hint_text]
|
@@ -50,12 +52,13 @@ module GovukPublishingComponents
|
|
50
52
|
if @is_page_heading
|
51
53
|
content_tag(
|
52
54
|
:legend,
|
53
|
-
class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title
|
55
|
+
class: "govuk-fieldset__legend govuk-fieldset__legend--xl gem-c-title"
|
54
56
|
) do
|
55
57
|
content_tag(:h1, @heading, class: "gem-c-title__text")
|
56
58
|
end
|
57
59
|
else
|
58
|
-
classes = %w(govuk-fieldset__legend
|
60
|
+
classes = %w(govuk-fieldset__legend)
|
61
|
+
classes << "govuk-fieldset__legend--#{@heading_size}"
|
59
62
|
classes << "gem-c-checkboxes__legend--hidden" if @visually_hide_heading
|
60
63
|
|
61
64
|
content_tag(:legend, @heading, class: classes)
|
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: 20.
|
4
|
+
version: 20.4.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: 2019-09-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|