govuk_publishing_components 27.14.2 → 27.15.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/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +9 -8
- data/app/views/govuk_publishing_components/components/_button.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/radio.yml +40 -33
- data/lib/govuk_publishing_components/presenters/button_helper.rb +24 -0
- 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: e405833a40d51e34a480d411380a552a68d49a9c398fa89fa694716e0a22131f
|
|
4
|
+
data.tar.gz: c6f710970b8ecae4c214851ee2e250b80673e38ec004bf161a1ca1042a44af3b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a24c9485202f161b46daff7ec6b081148c8e58d52f8fed9cab8ab6f2d90b016b1d06e81abf0ffd157b75c7331d7b5151b018bbe58f580c6d8bdf94f23ee0dcab
|
|
7
|
+
data.tar.gz: b63635bfda7d6ccb8ee7e88d810f19e97343d6cb7a08075bba620764cfd609ad0b1043361e1a5b84b49c1787263119b521316b44435dd8c6566754e5635c7b0c
|
|
@@ -102,6 +102,7 @@ $icon-size: 20px;
|
|
|
102
102
|
$chevron-indent-spacing: 7px;
|
|
103
103
|
$black-bar-height: 50px;
|
|
104
104
|
$search-width-or-height: $black-bar-height;
|
|
105
|
+
$pseudo-underline-height: 3px;
|
|
105
106
|
|
|
106
107
|
@mixin chevron($colour, $update: false) {
|
|
107
108
|
@if ($update == true) {
|
|
@@ -111,7 +112,7 @@ $search-width-or-height: $black-bar-height;
|
|
|
111
112
|
@include prefixed-transform($rotate: 45deg, $translateY: -35%);
|
|
112
113
|
border-bottom: 2px solid $colour;
|
|
113
114
|
border-right: 2px solid $colour;
|
|
114
|
-
content: "
|
|
115
|
+
content: "";
|
|
115
116
|
display: inline-block;
|
|
116
117
|
height: 8px;
|
|
117
118
|
margin: 0 8px 0 2px;
|
|
@@ -123,7 +124,7 @@ $search-width-or-height: $black-bar-height;
|
|
|
123
124
|
@mixin make-selectable-area-bigger {
|
|
124
125
|
background: none;
|
|
125
126
|
bottom: 0;
|
|
126
|
-
content: "
|
|
127
|
+
content: "";
|
|
127
128
|
left: 0;
|
|
128
129
|
position: absolute;
|
|
129
130
|
right: 0;
|
|
@@ -133,11 +134,11 @@ $search-width-or-height: $black-bar-height;
|
|
|
133
134
|
@mixin pseudo-underline {
|
|
134
135
|
background: none;
|
|
135
136
|
bottom: 0;
|
|
136
|
-
content: "
|
|
137
|
-
height:
|
|
138
|
-
left: govuk-spacing(
|
|
137
|
+
content: "";
|
|
138
|
+
height: $pseudo-underline-height;
|
|
139
|
+
left: govuk-spacing(5);
|
|
139
140
|
position: absolute;
|
|
140
|
-
right: govuk-spacing(
|
|
141
|
+
right: govuk-spacing(6);
|
|
141
142
|
top: auto;
|
|
142
143
|
}
|
|
143
144
|
|
|
@@ -441,7 +442,7 @@ $search-width-or-height: $black-bar-height;
|
|
|
441
442
|
font-size: govuk-px-to-rem(16px);
|
|
442
443
|
}
|
|
443
444
|
height: $black-bar-height;
|
|
444
|
-
padding: govuk-spacing(3);
|
|
445
|
+
padding: govuk-spacing(3) govuk-spacing(6) govuk-spacing(3) govuk-spacing(5);
|
|
445
446
|
position: relative;
|
|
446
447
|
text-decoration: none;
|
|
447
448
|
|
|
@@ -762,7 +763,7 @@ $search-width-or-height: $black-bar-height;
|
|
|
762
763
|
|
|
763
764
|
&:hover {
|
|
764
765
|
background: govuk-colour("black");
|
|
765
|
-
border-bottom:
|
|
766
|
+
border-bottom: $pseudo-underline-height solid govuk-colour("mid-grey");
|
|
766
767
|
color: govuk-colour("mid-grey");
|
|
767
768
|
}
|
|
768
769
|
|
|
@@ -69,7 +69,7 @@ examples:
|
|
|
69
69
|
<h2 class="govuk-heading-l">This is a title</h2>
|
|
70
70
|
<p class="govuk-body">This is some body text with <a href="https://example.com">a link</a>.
|
|
71
71
|
with_current_account_navigation:
|
|
72
|
-
description: "The account layout renders with an account-specific nav to help users navigate different areas of their account. This flag is here to allow control over which option in the nav is highlighted as `current`. Valid options are currently `your-account
|
|
72
|
+
description: "The account layout renders with an account-specific nav to help users navigate different areas of their account. This flag is here to allow control over which option in the nav is highlighted as `current`. Valid options are currently `your-account` and `manage`."
|
|
73
73
|
data:
|
|
74
74
|
show_account_layout: true
|
|
75
75
|
account_nav_location: "manage"
|
|
@@ -37,6 +37,7 @@ govuk_frontend_components:
|
|
|
37
37
|
examples:
|
|
38
38
|
default:
|
|
39
39
|
data:
|
|
40
|
+
heading: How do you want to sign in?
|
|
40
41
|
name: "radio-group"
|
|
41
42
|
items:
|
|
42
43
|
- value: "government-gateway"
|
|
@@ -45,6 +46,7 @@ examples:
|
|
|
45
46
|
text: "Use GOV.UK Verify"
|
|
46
47
|
with_small_radios:
|
|
47
48
|
data:
|
|
49
|
+
heading: How do you want to sign in?
|
|
48
50
|
name: "radio-group"
|
|
49
51
|
small: true
|
|
50
52
|
items:
|
|
@@ -52,9 +54,10 @@ examples:
|
|
|
52
54
|
text: "Use Government Gateway"
|
|
53
55
|
- value: "govuk-verify"
|
|
54
56
|
text: "Use GOV.UK Verify"
|
|
55
|
-
|
|
56
|
-
description: Used to provide better contrast between long labels and hint text
|
|
57
|
+
with_bold_labels:
|
|
58
|
+
description: Used to provide better contrast between long labels and hint text.
|
|
57
59
|
data:
|
|
60
|
+
heading: How do you want to sign in?
|
|
58
61
|
name: "radio-group-bold"
|
|
59
62
|
items:
|
|
60
63
|
- value: "government-gateway"
|
|
@@ -65,9 +68,10 @@ examples:
|
|
|
65
68
|
text: "Use GOV.UK Verify"
|
|
66
69
|
hint_text: "You'll have an account if you've already proved your identity with a certified company, such as the Post Office."
|
|
67
70
|
bold: true
|
|
68
|
-
|
|
71
|
+
with_custom_bottom_margin:
|
|
69
72
|
description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to a margin bottom of `30px` (`6`).
|
|
70
73
|
data:
|
|
74
|
+
heading: How do you want to sign in?
|
|
71
75
|
name: "radio-group"
|
|
72
76
|
margin_bottom: 9
|
|
73
77
|
items:
|
|
@@ -77,6 +81,7 @@ examples:
|
|
|
77
81
|
text: "Use GOV.UK Verify"
|
|
78
82
|
with_hint_on_form_group:
|
|
79
83
|
data:
|
|
84
|
+
heading: How do you want to sign in?
|
|
80
85
|
name: "radio-group-error"
|
|
81
86
|
id_prefix: "hint"
|
|
82
87
|
hint: "You’ll need to prove your identity using one of the following methods"
|
|
@@ -97,10 +102,10 @@ examples:
|
|
|
97
102
|
text: "Yes"
|
|
98
103
|
- value: "no"
|
|
99
104
|
text: "No"
|
|
100
|
-
|
|
105
|
+
with_custom_heading_size:
|
|
101
106
|
description: |
|
|
102
|
-
By default, text supplied for the `legend` is wrapped inside a `h2`.
|
|
103
|
-
|
|
107
|
+
By default, text supplied for the `legend` is wrapped inside a `h2`.
|
|
108
|
+
|
|
104
109
|
The font size of this heading can be changed using the `heading_size` option. Valid options are `s`, `m`, `l`, `xl`, defaulting to `m` if no option is passed.
|
|
105
110
|
data:
|
|
106
111
|
name: "radio-group-description"
|
|
@@ -113,10 +118,10 @@ examples:
|
|
|
113
118
|
text: "Green"
|
|
114
119
|
- value: "blue"
|
|
115
120
|
text: "Blue"
|
|
116
|
-
|
|
121
|
+
with_custom_heading_level:
|
|
117
122
|
description: |
|
|
118
123
|
By default, text supplied for the `legend` is wrapped inside a `h2`. This can be changed using the `heading_level` option.
|
|
119
|
-
|
|
124
|
+
|
|
120
125
|
If `heading_level` is `1` and `heading_size` is not set, the text size will be `xl`.
|
|
121
126
|
data:
|
|
122
127
|
name: "radio-group-description"
|
|
@@ -129,22 +134,10 @@ examples:
|
|
|
129
134
|
text: "Green"
|
|
130
135
|
- value: "blue"
|
|
131
136
|
text: "Blue"
|
|
132
|
-
|
|
133
|
-
data:
|
|
134
|
-
name: "radio-group-heading"
|
|
135
|
-
heading: "What is your favourite colour?"
|
|
136
|
-
hint: "If your favourite is not below, pick the colour closest to it."
|
|
137
|
-
items:
|
|
138
|
-
- value: "red"
|
|
139
|
-
text: "Red"
|
|
140
|
-
- value: "green"
|
|
141
|
-
text: "Green"
|
|
142
|
-
- value: "blue"
|
|
143
|
-
text: "Blue"
|
|
144
|
-
with_page_header_and_caption:
|
|
137
|
+
with_page_heading_and_caption:
|
|
145
138
|
description: |
|
|
146
139
|
A caption can be added using the `heading_caption` option. Captions will only be displayed if text for the heading option is present.
|
|
147
|
-
|
|
140
|
+
|
|
148
141
|
The pattern is used across GOV.UK to show a high-level section that this page belongs to.
|
|
149
142
|
data:
|
|
150
143
|
name: "radio-group-heading"
|
|
@@ -167,7 +160,7 @@ examples:
|
|
|
167
160
|
text: "Yes"
|
|
168
161
|
- value: "no"
|
|
169
162
|
text: "No"
|
|
170
|
-
|
|
163
|
+
with_description:
|
|
171
164
|
data:
|
|
172
165
|
name: "radio-group-description"
|
|
173
166
|
heading: "What is your favourite colour?"
|
|
@@ -217,6 +210,7 @@ examples:
|
|
|
217
210
|
text: "Blue"
|
|
218
211
|
with_hint_text_on_radios:
|
|
219
212
|
data:
|
|
213
|
+
heading: How do you want to sign in?
|
|
220
214
|
name: "radio-group-hint-text"
|
|
221
215
|
items:
|
|
222
216
|
- value: "government-gateway"
|
|
@@ -227,6 +221,7 @@ examples:
|
|
|
227
221
|
text: "Use GOV.UK Verify"
|
|
228
222
|
with_checked_option:
|
|
229
223
|
data:
|
|
224
|
+
heading: How do you want to sign in?
|
|
230
225
|
name: "radio-group-checked"
|
|
231
226
|
items:
|
|
232
227
|
- value: "government-gateway"
|
|
@@ -236,15 +231,17 @@ examples:
|
|
|
236
231
|
checked: true
|
|
237
232
|
with_data_attributes:
|
|
238
233
|
data:
|
|
234
|
+
heading: How do you want to sign in?
|
|
239
235
|
name: "radio-group-data-attributes"
|
|
240
236
|
items:
|
|
241
|
-
- value: "
|
|
242
|
-
text: "
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
- value: "government-gateway"
|
|
238
|
+
text: "Use Government Gateway"
|
|
239
|
+
- value: "govuk-verify"
|
|
240
|
+
text: "Use GOV.UK Verify"
|
|
241
|
+
data_attributes: { "contextual-guidance": "government-gateway" }
|
|
246
242
|
with_custom_id_prefix:
|
|
247
243
|
data:
|
|
244
|
+
heading: How do you want to sign in?
|
|
248
245
|
id_prefix: 'custom'
|
|
249
246
|
name: "radio-custom-id-prefix"
|
|
250
247
|
items:
|
|
@@ -255,6 +252,7 @@ examples:
|
|
|
255
252
|
with_or_divider:
|
|
256
253
|
description: "See [related service manual guidance for this pattern](https://www.gov.uk/service-manual/design/writing-for-user-interfaces#ask-questions-that-users-can-understand)"
|
|
257
254
|
data:
|
|
255
|
+
heading: How do you want to sign in?
|
|
258
256
|
name: "radio-group-or-divider"
|
|
259
257
|
items:
|
|
260
258
|
- value: "government-gateway"
|
|
@@ -267,6 +265,7 @@ examples:
|
|
|
267
265
|
extreme:
|
|
268
266
|
description: 'Note that the `:or` option [is documented as a string due to a bug](https://github.com/alphagov/govuk_publishing_components/issues/102)'
|
|
269
267
|
data:
|
|
268
|
+
heading: How do you want to sign in?
|
|
270
269
|
id_prefix: 'extreme'
|
|
271
270
|
name: "radio-custom-extreme"
|
|
272
271
|
items:
|
|
@@ -289,6 +288,7 @@ examples:
|
|
|
289
288
|
bold: true
|
|
290
289
|
with_error_on_form_group:
|
|
291
290
|
data:
|
|
291
|
+
heading: How do you want to sign in?
|
|
292
292
|
name: "radio-group-error"
|
|
293
293
|
id_prefix: "error"
|
|
294
294
|
error_message: "Please select one option"
|
|
@@ -300,6 +300,7 @@ examples:
|
|
|
300
300
|
with_error_and_hint_on_form_group:
|
|
301
301
|
description: ""
|
|
302
302
|
data:
|
|
303
|
+
heading: How do you want to sign in?
|
|
303
304
|
name: "radio-group-error"
|
|
304
305
|
id_prefix: "error"
|
|
305
306
|
error_message: "Please select one option"
|
|
@@ -311,6 +312,7 @@ examples:
|
|
|
311
312
|
text: "Use GOV.UK Verify"
|
|
312
313
|
with_error_items_on_form_group:
|
|
313
314
|
data:
|
|
315
|
+
heading: How do you want to sign in?
|
|
314
316
|
name: "radio-group-error"
|
|
315
317
|
id_prefix: "error"
|
|
316
318
|
error_items:
|
|
@@ -325,6 +327,7 @@ examples:
|
|
|
325
327
|
text: "Use GOV.UK Verify"
|
|
326
328
|
conditional:
|
|
327
329
|
data:
|
|
330
|
+
heading: How do you want to sign in?
|
|
328
331
|
name: "radio-group-conditional"
|
|
329
332
|
id_prefix: "conditional"
|
|
330
333
|
items:
|
|
@@ -336,7 +339,8 @@ examples:
|
|
|
336
339
|
conditional: "You’ll need to prove your identity using GOV.UK Verify"
|
|
337
340
|
conditional_checked:
|
|
338
341
|
data:
|
|
339
|
-
|
|
342
|
+
heading: How do you want to sign in?
|
|
343
|
+
name: "radio-group-conditional-checked"
|
|
340
344
|
id_prefix: "conditional-checked"
|
|
341
345
|
items:
|
|
342
346
|
- value: "government-gateway"
|
|
@@ -348,6 +352,7 @@ examples:
|
|
|
348
352
|
conditional: "You’ll need to prove your identity using GOV.UK Verify"
|
|
349
353
|
tracking-url:
|
|
350
354
|
data:
|
|
355
|
+
heading: How do you want to sign in?
|
|
351
356
|
name: "radio-group-tracking-url"
|
|
352
357
|
id_prefix: "tracking-url"
|
|
353
358
|
items:
|
|
@@ -360,15 +365,17 @@ examples:
|
|
|
360
365
|
inline:
|
|
361
366
|
description: "When providing few options, radio buttons should be inline rather than stacked. We recommend this for two small options like yes and no, on and off"
|
|
362
367
|
data:
|
|
368
|
+
heading: Have you changed your name?
|
|
363
369
|
name: "inline-radios"
|
|
364
370
|
inline: true
|
|
365
371
|
items:
|
|
366
|
-
- value: "
|
|
367
|
-
text: "
|
|
368
|
-
- value: "
|
|
369
|
-
text: "
|
|
372
|
+
- value: "yes"
|
|
373
|
+
text: "Yes"
|
|
374
|
+
- value: "no"
|
|
375
|
+
text: "No"
|
|
370
376
|
with_custom_id_attribute:
|
|
371
377
|
data:
|
|
378
|
+
heading: How do you want to sign in?
|
|
372
379
|
name: "radio-group"
|
|
373
380
|
id: "radio-group"
|
|
374
381
|
items:
|
|
@@ -11,6 +11,7 @@ module GovukPublishingComponents
|
|
|
11
11
|
:rel,
|
|
12
12
|
:data_attributes,
|
|
13
13
|
:margin_bottom,
|
|
14
|
+
:id,
|
|
14
15
|
:inline_layout,
|
|
15
16
|
:target,
|
|
16
17
|
:type,
|
|
@@ -49,16 +50,39 @@ module GovukPublishingComponents
|
|
|
49
50
|
@value = local_assigns[:value]
|
|
50
51
|
@classes = local_assigns[:classes]
|
|
51
52
|
@aria_label = local_assigns[:aria_label]
|
|
53
|
+
@info_text_id = "info-text-id-#{SecureRandom.hex(4)}"
|
|
54
|
+
@button_id = "button-id-#{SecureRandom.hex(4)}"
|
|
52
55
|
end
|
|
53
56
|
|
|
54
57
|
def link?
|
|
55
58
|
href.present?
|
|
56
59
|
end
|
|
57
60
|
|
|
61
|
+
def info_text?
|
|
62
|
+
info_text.present?
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def aria_labelledby
|
|
66
|
+
if info_text?
|
|
67
|
+
text = "#{@button_id} "
|
|
68
|
+
text << @info_text_id
|
|
69
|
+
text
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def info_text_options
|
|
74
|
+
options = { class: info_text_classes }
|
|
75
|
+
options[:aria] = { hidden: true } if info_text?
|
|
76
|
+
options[:id] = @info_text_id if info_text?
|
|
77
|
+
options
|
|
78
|
+
end
|
|
79
|
+
|
|
58
80
|
def html_options
|
|
59
81
|
options = { class: css_classes }
|
|
60
82
|
options[:role] = "button" if link?
|
|
61
83
|
options[:type] = button_type
|
|
84
|
+
options[:id] = @button_id if info_text?
|
|
85
|
+
options[:aria] = { labelledby: aria_labelledby }
|
|
62
86
|
options[:rel] = rel if rel
|
|
63
87
|
options[:data] = data_attributes if data_attributes
|
|
64
88
|
options[:title] = title if title
|
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: 27.
|
|
4
|
+
version: 27.15.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: 2021-11-
|
|
11
|
+
date: 2021-11-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: govuk_app_config
|