govuk_publishing_components 16.10.1 → 16.11.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/javascripts/govuk_publishing_components/lib/header-navigation.js +1 -1
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/_radio.html.erb +5 -1
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +10 -0
- data/app/views/govuk_publishing_components/components/docs/radio.yml +9 -0
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +4 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/accessible-autocomplete/package.json +1 -1
- data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +174 -25
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +4 -4
- data/node_modules/govuk-frontend/components/fieldset/template.njk +2 -2
- data/node_modules/govuk-frontend/components/radios/_radios.scss +186 -25
- data/node_modules/govuk-frontend/objects/_form-group.scss +1 -0
- data/node_modules/govuk-frontend/package.json +18 -18
- data/node_modules/govuk-frontend/settings/_colours-applied.scss +8 -0
- data/node_modules/govuk-frontend/settings/_measurements.scss +7 -0
- 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: b0f7149647a844701e08e1592bfcfcd345a5e91d7d9bf7f8a3b56dd65665d30a
|
4
|
+
data.tar.gz: 3154dd32d9da143993c2cdda363dac84607647af7fd463c3ca1d46429ca31fa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f7ca0eeab97cc5be4c1df01908791947ef3cf76e64f863a2bf769e6b5fd90e91746a86f7862b7add278e00cdae26d03b32f3e1d740ce0559a2e3d14e0aaa75a
|
7
|
+
data.tar.gz: 035105c93e8e29651565ea190f571fb30fa2b029f8895624f661dcd4e5ecf9a8943cafa116a6ace28c9220a94ab1b117a04f30471c3c0db26d154650a832381b
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<%
|
2
|
+
# cb_helper.css_classes generates "gem-c-checkboxes"
|
2
3
|
cb_helper = GovukPublishingComponents::Presenters::CheckboxesHelper.new(local_assigns)
|
3
4
|
id = cb_helper.id
|
4
5
|
%>
|
@@ -17,7 +18,7 @@
|
|
17
18
|
<%= tag.span error, id: "#{id}-error", class: "govuk-error-message" %>
|
18
19
|
<% end %>
|
19
20
|
|
20
|
-
<%= tag.ul class:
|
21
|
+
<%= tag.ul class: cb_helper.list_classes, data: {
|
21
22
|
module: ('checkboxes' if cb_helper.has_conditional),
|
22
23
|
nested: ('true' if cb_helper.has_nested),
|
23
24
|
} do %>
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
label ||= nil
|
6
6
|
heading ||= nil
|
7
|
+
small ||= false
|
7
8
|
is_page_heading ||= false
|
8
9
|
hint ||= nil
|
9
10
|
error_message ||= nil
|
@@ -16,6 +17,9 @@
|
|
16
17
|
form_group_css_classes = %w(govuk-form-group)
|
17
18
|
form_group_css_classes << "govuk-form-group--error" if has_error
|
18
19
|
|
20
|
+
radio_classes = %w(govuk-radios)
|
21
|
+
radio_classes << "govuk-radios--small" if small
|
22
|
+
|
19
23
|
aria = "#{hint_id} #{"#{error_id}" if has_error}".strip if hint or has_error
|
20
24
|
|
21
25
|
# check if any item is set as being conditional
|
@@ -53,7 +57,7 @@
|
|
53
57
|
} %>
|
54
58
|
<% end %>
|
55
59
|
|
56
|
-
<%= content_tag :div, class:
|
60
|
+
<%= content_tag :div, class: radio_classes,
|
57
61
|
data: {
|
58
62
|
module: ('radios' if has_conditional)
|
59
63
|
} do %>
|
@@ -32,6 +32,16 @@ examples:
|
|
32
32
|
value: "green"
|
33
33
|
- label: "Blue"
|
34
34
|
value: "blue"
|
35
|
+
with_small_checkboxes:
|
36
|
+
data:
|
37
|
+
name: "favourite_small_synonym"
|
38
|
+
heading: "What is your favourite synonym for small?"
|
39
|
+
small: true
|
40
|
+
items:
|
41
|
+
- label: "Tiny"
|
42
|
+
value: "tiny"
|
43
|
+
- label: "Little"
|
44
|
+
value: "little"
|
35
45
|
with_a_heading_on_one_checkbox:
|
36
46
|
description: One checkbox does not require a fieldset and therefore does not require a legend. However, if a heading is supplied, a fieldset will be included in the component and the heading used as the legend, as shown.
|
37
47
|
data:
|
@@ -44,6 +44,15 @@ examples:
|
|
44
44
|
text: "Use Government Gateway"
|
45
45
|
- value: "govuk-verify"
|
46
46
|
text: "Use GOV.UK Verify"
|
47
|
+
with_small_radios:
|
48
|
+
data:
|
49
|
+
name: "radio-group"
|
50
|
+
small: true
|
51
|
+
items:
|
52
|
+
- value: "government-gateway"
|
53
|
+
text: "Use Government Gateway"
|
54
|
+
- value: "govuk-verify"
|
55
|
+
text: "Use GOV.UK Verify"
|
47
56
|
with_bold:
|
48
57
|
description: 'Used to provide better contrast between long labels and hint text, Note that the `:or` option [is documented as a string due to a bug](https://github.com/alphagov/govuk_publishing_components/issues/102)'
|
49
58
|
data:
|
@@ -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, :error, :has_conditional, :has_nested, :id, :hint_text
|
7
|
+
attr_reader :items, :name, :css_classes, :list_classes, :error, :has_conditional, :has_nested, :id, :hint_text
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
@items = options[:items] || []
|
@@ -13,6 +13,9 @@ module GovukPublishingComponents
|
|
13
13
|
@css_classes << "govuk-form-group--error" if options[:error]
|
14
14
|
@error = true if options[:error]
|
15
15
|
|
16
|
+
@list_classes = %w(govuk-checkboxes gem-c-checkboxes__list)
|
17
|
+
@list_classes << "govuk-checkboxes--small" if options[:small]
|
18
|
+
|
16
19
|
# check if any item is set as being conditional
|
17
20
|
@has_conditional = options[:items].any? { |item| item.is_a?(Hash) && item[:conditional] }
|
18
21
|
@has_nested = options[:items].any? { |item| item.is_a?(Hash) && item[:items] }
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"/"
|
50
50
|
],
|
51
51
|
"_resolved": "git://github.com/alphagov/accessible-autocomplete.git#0c518b4fa79b9a95b544410858486ed9e6403c84",
|
52
|
-
"_shasum": "
|
52
|
+
"_shasum": "8110fa374a6fa8c8f301c94e46d4513f8bb0131c",
|
53
53
|
"_shrinkwrap": null,
|
54
54
|
"_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
|
55
55
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
@@ -8,7 +8,10 @@
|
|
8
8
|
@import "../label/label";
|
9
9
|
|
10
10
|
@include govuk-exports("govuk/component/checkboxes") {
|
11
|
-
|
11
|
+
|
12
|
+
$govuk-touch-target-size: 44px;
|
13
|
+
$govuk-checkboxes-size: 40px;
|
14
|
+
$govuk-small-checkboxes-size: 24px;
|
12
15
|
$govuk-checkboxes-label-padding-left-right: govuk-spacing(3);
|
13
16
|
|
14
17
|
.govuk-checkboxes__item {
|
@@ -20,7 +23,7 @@
|
|
20
23
|
min-height: $govuk-checkboxes-size;
|
21
24
|
|
22
25
|
margin-bottom: govuk-spacing(2);
|
23
|
-
padding:
|
26
|
+
padding-left: $govuk-checkboxes-size;
|
24
27
|
|
25
28
|
clear: left;
|
26
29
|
}
|
@@ -31,25 +34,33 @@
|
|
31
34
|
}
|
32
35
|
|
33
36
|
.govuk-checkboxes__input {
|
34
|
-
|
35
|
-
|
36
|
-
z-index: 1;
|
37
|
-
top: 0;
|
38
|
-
left: 0;
|
39
|
-
|
40
|
-
width: $govuk-checkboxes-size;
|
41
|
-
height: $govuk-checkboxes-size;
|
37
|
+
$input-offset: ($govuk-touch-target-size - $govuk-checkboxes-size) / 2;
|
42
38
|
|
43
39
|
cursor: pointer;
|
44
40
|
|
45
|
-
// IE8 doesn’t support
|
41
|
+
// IE8 doesn’t support pseudo-elements, so we don’t want to hide native
|
42
|
+
// elements there.
|
46
43
|
@include govuk-not-ie8 {
|
44
|
+
position: absolute;
|
45
|
+
|
46
|
+
z-index: 1;
|
47
|
+
top: $input-offset * -1;
|
48
|
+
left: $input-offset * -1;
|
49
|
+
|
50
|
+
width: $govuk-touch-target-size;
|
51
|
+
height: $govuk-touch-target-size;
|
47
52
|
margin: 0;
|
53
|
+
|
48
54
|
opacity: 0;
|
49
55
|
}
|
50
56
|
|
51
|
-
// add focus outline to input element for IE8
|
52
57
|
@include govuk-if-ie8 {
|
58
|
+
margin-top: 10px;
|
59
|
+
margin-right: $govuk-checkboxes-size / -2;
|
60
|
+
margin-left: $govuk-checkboxes-size / -2;
|
61
|
+
float: left;
|
62
|
+
|
63
|
+
// add focus outline to input
|
53
64
|
&:focus {
|
54
65
|
outline: $govuk-focus-width solid $govuk-focus-colour;
|
55
66
|
}
|
@@ -63,16 +74,11 @@
|
|
63
74
|
cursor: pointer;
|
64
75
|
// remove 300ms pause on mobile
|
65
76
|
-ms-touch-action: manipulation;
|
66
|
-
|
77
|
+
touch-action: manipulation;
|
67
78
|
}
|
68
79
|
|
69
|
-
|
70
|
-
|
71
|
-
padding-right: $govuk-checkboxes-label-padding-left-right;
|
72
|
-
padding-left: $govuk-checkboxes-label-padding-left-right;
|
73
|
-
}
|
74
|
-
|
75
|
-
.govuk-checkboxes__input + .govuk-checkboxes__label::before {
|
80
|
+
// [ ] Check box
|
81
|
+
.govuk-checkboxes__label::before {
|
76
82
|
content: "";
|
77
83
|
box-sizing: border-box;
|
78
84
|
position: absolute;
|
@@ -82,11 +88,13 @@
|
|
82
88
|
height: $govuk-checkboxes-size;
|
83
89
|
border: $govuk-border-width-form-element solid currentColor;
|
84
90
|
background: transparent;
|
85
|
-
|
86
|
-
// padding-bottom: 1px;
|
87
91
|
}
|
88
92
|
|
89
|
-
|
93
|
+
// ✔ Check mark
|
94
|
+
//
|
95
|
+
// The check mark is a box with a border on the left and bottom side (└──),
|
96
|
+
// rotated 45 degrees
|
97
|
+
.govuk-checkboxes__label::after {
|
90
98
|
content: "";
|
91
99
|
|
92
100
|
position: absolute;
|
@@ -111,10 +119,16 @@
|
|
111
119
|
background: transparent;
|
112
120
|
}
|
113
121
|
|
122
|
+
.govuk-checkboxes__hint {
|
123
|
+
display: block;
|
124
|
+
padding-right: $govuk-checkboxes-label-padding-left-right;
|
125
|
+
padding-left: $govuk-checkboxes-label-padding-left-right;
|
126
|
+
}
|
127
|
+
|
114
128
|
// Focused state
|
115
129
|
.govuk-checkboxes__input:focus + .govuk-checkboxes__label::before {
|
116
|
-
// Since box-shadows are removed when users customise their colours
|
117
|
-
//
|
130
|
+
// Since box-shadows are removed when users customise their colours, we set
|
131
|
+
// a transparent outline that is shown instead.
|
118
132
|
// https://accessibility.blog.gov.uk/2017/03/27/how-users-change-colours-on-websites/
|
119
133
|
outline: $govuk-focus-width solid transparent;
|
120
134
|
outline-offset: $govuk-focus-width;
|
@@ -136,6 +150,10 @@
|
|
136
150
|
opacity: .5;
|
137
151
|
}
|
138
152
|
|
153
|
+
// =========================================================
|
154
|
+
// Conditional reveals
|
155
|
+
// =========================================================
|
156
|
+
|
139
157
|
$conditional-border-width: $govuk-border-width-mobile;
|
140
158
|
// Calculate the amount of padding needed to keep the border centered against the checkbox.
|
141
159
|
$conditional-border-padding: ($govuk-checkboxes-size / 2) - ($conditional-border-width / 2);
|
@@ -158,4 +176,135 @@
|
|
158
176
|
margin-bottom: 0;
|
159
177
|
}
|
160
178
|
}
|
179
|
+
|
180
|
+
// =========================================================
|
181
|
+
// Small checkboxes
|
182
|
+
// =========================================================
|
183
|
+
|
184
|
+
.govuk-checkboxes--small {
|
185
|
+
|
186
|
+
$input-offset: ($govuk-touch-target-size - $govuk-small-checkboxes-size) / 2;
|
187
|
+
$label-offset: $govuk-touch-target-size - $input-offset;
|
188
|
+
|
189
|
+
.govuk-checkboxes__item {
|
190
|
+
@include govuk-clearfix;
|
191
|
+
min-height: 0;
|
192
|
+
margin-bottom: 0;
|
193
|
+
padding-left: $label-offset;
|
194
|
+
float: left;
|
195
|
+
}
|
196
|
+
|
197
|
+
// Shift the touch target into the left margin so that the visible edge of
|
198
|
+
// the control is aligned
|
199
|
+
//
|
200
|
+
// ┆What colours do you like?
|
201
|
+
// ┌┆───┐
|
202
|
+
// │┆[] │ Purple
|
203
|
+
// └┆▲──┘
|
204
|
+
// ▲┆└─ Check box pseudo element, aligned with margin
|
205
|
+
// └─── Touch target (invisible input), shifted into the margin
|
206
|
+
.govuk-checkboxes__input {
|
207
|
+
@include govuk-not-ie8 {
|
208
|
+
left: $input-offset * -1;
|
209
|
+
}
|
210
|
+
|
211
|
+
@include govuk-if-ie8 {
|
212
|
+
margin-left: $govuk-small-checkboxes-size * -1;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
// Adjust the size and position of the label.
|
217
|
+
//
|
218
|
+
// Unlike larger checkboxes, we also have to float the label in order to
|
219
|
+
// 'shrink' it, preventing the hover state from kicking in across the full
|
220
|
+
// width of the parent element.
|
221
|
+
.govuk-checkboxes__label {
|
222
|
+
margin-top: -2px;
|
223
|
+
padding: 13px govuk-spacing(3) 13px 1px;
|
224
|
+
float: left;
|
225
|
+
|
226
|
+
@include govuk-media-query($from: tablet) {
|
227
|
+
padding: 11px govuk-spacing(3) 10px 1px;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
// [ ] Check box
|
232
|
+
//
|
233
|
+
// Reduce the size of the check box [1], vertically center it within the
|
234
|
+
// touch target [2]
|
235
|
+
.govuk-checkboxes__label::before {
|
236
|
+
top: $input-offset - $govuk-border-width-form-element; // 2
|
237
|
+
width: $govuk-small-checkboxes-size; // 1
|
238
|
+
height: $govuk-small-checkboxes-size; // 1
|
239
|
+
}
|
240
|
+
|
241
|
+
// ✔ Check mark
|
242
|
+
//
|
243
|
+
// Reduce the size of the check mark and re-align within the checkbox
|
244
|
+
.govuk-checkboxes__label::after {
|
245
|
+
top: 15px;
|
246
|
+
left: 6px;
|
247
|
+
width: 9px;
|
248
|
+
height: 3.5px;
|
249
|
+
border-width: 0 0 3px 3px;
|
250
|
+
}
|
251
|
+
|
252
|
+
// Fix position of hint with small checkboxes
|
253
|
+
//
|
254
|
+
// Do not use hints with small checkboxes – because they're within the input
|
255
|
+
// wrapper they trigger the hover state, but clicking them doesn't actually
|
256
|
+
// activate the control.
|
257
|
+
//
|
258
|
+
// (If you do use them, they won't look completely broken... but seriously,
|
259
|
+
// don't use them)
|
260
|
+
.govuk-checkboxes__hint {
|
261
|
+
padding: 0;
|
262
|
+
clear: both;
|
263
|
+
}
|
264
|
+
|
265
|
+
// Align conditional reveals with small checkboxes
|
266
|
+
.govuk-checkboxes__conditional {
|
267
|
+
$margin-left: ($govuk-small-checkboxes-size / 2) - ($conditional-border-width / 2);
|
268
|
+
margin-left: $margin-left;
|
269
|
+
padding-left: $label-offset - ($margin-left + $conditional-border-width);
|
270
|
+
clear: both;
|
271
|
+
}
|
272
|
+
|
273
|
+
// Hover state for small checkboxes.
|
274
|
+
//
|
275
|
+
// We use a hover state for small checkboxes because the touch target size
|
276
|
+
// is so much larger than their visible size, and so we need to provide
|
277
|
+
// feedback to the user as to which checkbox they will select when their
|
278
|
+
// cursor is outside of the visible area.
|
279
|
+
.govuk-checkboxes__item:hover .govuk-checkboxes__input:not(:disabled) + .govuk-checkboxes__label::before {
|
280
|
+
box-shadow: 0 0 0 $govuk-hover-width $govuk-hover-colour;
|
281
|
+
}
|
282
|
+
|
283
|
+
// Because we've overridden the border-shadow provided by the focus state,
|
284
|
+
// we need to redefine that too.
|
285
|
+
//
|
286
|
+
// We use two box shadows, one that restores the original focus state [1]
|
287
|
+
// and another that then applies the hover state [2].
|
288
|
+
.govuk-checkboxes__item:hover .govuk-checkboxes__input:focus + .govuk-checkboxes__label::before {
|
289
|
+
// sass-lint:disable indentation
|
290
|
+
box-shadow: 0 0 0 $govuk-focus-width $govuk-focus-colour, // 1
|
291
|
+
0 0 0 $govuk-hover-width $govuk-hover-colour; // 2
|
292
|
+
}
|
293
|
+
|
294
|
+
// For devices that explicitly don't support hover, don't provide a hover
|
295
|
+
// state (e.g. on touch devices like iOS).
|
296
|
+
//
|
297
|
+
// We can't use `@media (hover: hover)` because we wouldn't get the hover
|
298
|
+
// state in browsers that don't support `@media (hover)` (like Internet
|
299
|
+
// Explorer) – so we have to 'undo' the hover state instead.
|
300
|
+
@media (hover: none), (pointer: coarse) {
|
301
|
+
.govuk-checkboxes__item:hover .govuk-checkboxes__input:not(:disabled) + .govuk-checkboxes__label::before {
|
302
|
+
box-shadow: initial;
|
303
|
+
}
|
304
|
+
|
305
|
+
.govuk-checkboxes__item:hover .govuk-checkboxes__input:focus + .govuk-checkboxes__label::before {
|
306
|
+
box-shadow: 0 0 0 $govuk-focus-width $govuk-focus-colour;
|
307
|
+
}
|
308
|
+
}
|
309
|
+
}
|
161
310
|
}
|
@@ -54,15 +54,15 @@
|
|
54
54
|
{% set name = item.name if item.name else params.name %}
|
55
55
|
{% set conditionalId = "conditional-" + id %}
|
56
56
|
{% set hasHint = true if item.hint.text or item.hint.html %}
|
57
|
-
{% set itemHintId = id +
|
57
|
+
{% set itemHintId = id + "-item-hint" if hasHint else "" %}
|
58
|
+
{% set itemDescribedBy = describedBy if not hasFieldset else "" %}
|
59
|
+
{% set itemDescribedBy = (itemDescribedBy + " " + itemHintId) | trim %}
|
58
60
|
<div class="govuk-checkboxes__item">
|
59
61
|
<input class="govuk-checkboxes__input" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
|
60
62
|
{{-" checked" if item.checked }}
|
61
63
|
{{-" disabled" if item.disabled }}
|
62
|
-
{#- fieldset is false by default -#}
|
63
|
-
{%- if (not hasFieldset) and ((describedBy | length) > 0) %} aria-describedby="{{ describedBy }}"{% endif -%}
|
64
64
|
{%- if item.conditional %} data-aria-controls="{{ conditionalId }}"{% endif -%}
|
65
|
-
{%- if
|
65
|
+
{%- if itemDescribedBy %} aria-describedby="{{ itemDescribedBy }}"{% endif -%}
|
66
66
|
{%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
67
67
|
{{ govukLabel({
|
68
68
|
html: item.html,
|
@@ -4,13 +4,13 @@
|
|
4
4
|
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
5
5
|
{% if params.legend.html or params.legend.text %}
|
6
6
|
<legend class="govuk-fieldset__legend {%- if params.legend.classes %} {{ params.legend.classes }}{% endif %}">
|
7
|
-
{
|
7
|
+
{% if params.legend.isPageHeading %}
|
8
8
|
<h1 class="govuk-fieldset__heading">
|
9
9
|
{{ params.legend.html | safe if params.legend.html else params.legend.text }}
|
10
10
|
</h1>
|
11
11
|
{% else %}
|
12
12
|
{{ params.legend.html | safe if params.legend.html else params.legend.text }}
|
13
|
-
{% endif
|
13
|
+
{% endif %}
|
14
14
|
</legend>
|
15
15
|
{% endif %}
|
16
16
|
{{ caller() if caller }} {#- if statement allows usage of `call` to be optional -#}
|
@@ -8,7 +8,10 @@
|
|
8
8
|
@import "../label/label";
|
9
9
|
|
10
10
|
@include govuk-exports("govuk/component/radios") {
|
11
|
-
|
11
|
+
|
12
|
+
$govuk-touch-target-size: 44px;
|
13
|
+
$govuk-radios-size: 40px;
|
14
|
+
$govuk-small-radios-size: 24px;
|
12
15
|
$govuk-radios-label-padding-left-right: govuk-spacing(3);
|
13
16
|
// When the default focus width is used on a curved edge it looks visually smaller.
|
14
17
|
// So for the circular radios we bump the default to make it look visually consistent.
|
@@ -18,13 +21,12 @@
|
|
18
21
|
@include govuk-font($size: 19);
|
19
22
|
|
20
23
|
display: block;
|
21
|
-
|
22
24
|
position: relative;
|
23
25
|
|
24
26
|
min-height: $govuk-radios-size;
|
25
27
|
|
26
28
|
margin-bottom: govuk-spacing(2);
|
27
|
-
padding:
|
29
|
+
padding-left: $govuk-radios-size;
|
28
30
|
|
29
31
|
clear: left;
|
30
32
|
}
|
@@ -35,25 +37,33 @@
|
|
35
37
|
}
|
36
38
|
|
37
39
|
.govuk-radios__input {
|
38
|
-
|
39
|
-
|
40
|
-
z-index: 1;
|
41
|
-
top: 0;
|
42
|
-
left: 0;
|
43
|
-
|
44
|
-
width: $govuk-radios-size;
|
45
|
-
height: $govuk-radios-size;
|
40
|
+
$input-offset: ($govuk-touch-target-size - $govuk-radios-size) / 2;
|
46
41
|
|
47
42
|
cursor: pointer;
|
48
43
|
|
49
|
-
// IE8 doesn’t support
|
44
|
+
// IE8 doesn’t support pseudo-elements, so we don’t want to hide native
|
45
|
+
// elements there.
|
50
46
|
@include govuk-not-ie8 {
|
47
|
+
position: absolute;
|
48
|
+
|
49
|
+
z-index: 1;
|
50
|
+
top: $input-offset * -1;
|
51
|
+
left: $input-offset * -1;
|
52
|
+
|
53
|
+
width: $govuk-touch-target-size;
|
54
|
+
height: $govuk-touch-target-size;
|
51
55
|
margin: 0;
|
56
|
+
|
52
57
|
opacity: 0;
|
53
58
|
}
|
54
59
|
|
55
|
-
// add focus outline to input element for IE8
|
56
60
|
@include govuk-if-ie8 {
|
61
|
+
margin-top: 10px;
|
62
|
+
margin-right: $govuk-radios-size / -2;
|
63
|
+
margin-left: $govuk-radios-size / -2;
|
64
|
+
float: left;
|
65
|
+
|
66
|
+
// add focus outline to input
|
57
67
|
&:focus {
|
58
68
|
outline: $govuk-focus-width solid $govuk-focus-colour;
|
59
69
|
}
|
@@ -67,16 +77,11 @@
|
|
67
77
|
cursor: pointer;
|
68
78
|
// remove 300ms pause on mobile
|
69
79
|
-ms-touch-action: manipulation;
|
70
|
-
|
71
|
-
}
|
72
|
-
|
73
|
-
.govuk-radios__hint {
|
74
|
-
display: block;
|
75
|
-
padding-right: $govuk-radios-label-padding-left-right;
|
76
|
-
padding-left: $govuk-radios-label-padding-left-right;
|
80
|
+
touch-action: manipulation;
|
77
81
|
}
|
78
82
|
|
79
|
-
|
83
|
+
// ( ) Radio ring
|
84
|
+
.govuk-radios__label::before {
|
80
85
|
content: "";
|
81
86
|
box-sizing: border-box;
|
82
87
|
position: absolute;
|
@@ -91,7 +96,11 @@
|
|
91
96
|
background: transparent;
|
92
97
|
}
|
93
98
|
|
94
|
-
|
99
|
+
// • Radio button
|
100
|
+
//
|
101
|
+
// We create the 'button' entirely out of 'border' so that they remain
|
102
|
+
// 'filled' even when colours are overridden in the browser.
|
103
|
+
.govuk-radios__label::after {
|
95
104
|
content: "";
|
96
105
|
|
97
106
|
position: absolute;
|
@@ -107,10 +116,16 @@
|
|
107
116
|
background: currentColor;
|
108
117
|
}
|
109
118
|
|
119
|
+
.govuk-radios__hint {
|
120
|
+
display: block;
|
121
|
+
padding-right: $govuk-radios-label-padding-left-right;
|
122
|
+
padding-left: $govuk-radios-label-padding-left-right;
|
123
|
+
}
|
124
|
+
|
110
125
|
// Focused state
|
111
126
|
.govuk-radios__input:focus + .govuk-radios__label::before {
|
112
|
-
// Since box-shadows are removed when users customise their colours
|
113
|
-
//
|
127
|
+
// Since box-shadows are removed when users customise their colours we set a
|
128
|
+
// transparent outline that is shown instead.
|
114
129
|
// https://accessibility.blog.gov.uk/2017/03/27/how-users-change-colours-on-websites/
|
115
130
|
outline: $govuk-focus-width solid transparent;
|
116
131
|
outline-offset: $govuk-focus-width;
|
@@ -132,7 +147,10 @@
|
|
132
147
|
opacity: .5;
|
133
148
|
}
|
134
149
|
|
135
|
-
//
|
150
|
+
// =========================================================
|
151
|
+
// Inline radios
|
152
|
+
// =========================================================
|
153
|
+
|
136
154
|
.govuk-radios--inline {
|
137
155
|
@include mq ($from: tablet) {
|
138
156
|
@include govuk-clearfix;
|
@@ -153,6 +171,10 @@
|
|
153
171
|
}
|
154
172
|
}
|
155
173
|
|
174
|
+
// =========================================================
|
175
|
+
// Dividers ('or')
|
176
|
+
// =========================================================
|
177
|
+
|
156
178
|
.govuk-radios__divider {
|
157
179
|
$govuk-divider-size: $govuk-radios-size !default;
|
158
180
|
@include govuk-font($size: 19);
|
@@ -162,6 +184,10 @@
|
|
162
184
|
text-align: center;
|
163
185
|
}
|
164
186
|
|
187
|
+
// =========================================================
|
188
|
+
// Conditional reveals
|
189
|
+
// =========================================================
|
190
|
+
|
165
191
|
$conditional-border-width: $govuk-border-width-mobile;
|
166
192
|
// Calculate the amount of padding needed to keep the border centered against the radios.
|
167
193
|
$conditional-border-padding: ($govuk-radios-size / 2) - ($conditional-border-width / 2);
|
@@ -184,4 +210,139 @@
|
|
184
210
|
margin-bottom: 0;
|
185
211
|
}
|
186
212
|
}
|
213
|
+
|
214
|
+
// =========================================================
|
215
|
+
// Small checkboxes
|
216
|
+
// =========================================================
|
217
|
+
|
218
|
+
.govuk-radios--small {
|
219
|
+
|
220
|
+
$input-offset: ($govuk-touch-target-size - $govuk-small-radios-size) / 2;
|
221
|
+
$label-offset: $govuk-touch-target-size - $input-offset;
|
222
|
+
|
223
|
+
.govuk-radios__item {
|
224
|
+
@include govuk-clearfix;
|
225
|
+
min-height: 0;
|
226
|
+
margin-bottom: 0;
|
227
|
+
padding-left: $label-offset;
|
228
|
+
float: left;
|
229
|
+
}
|
230
|
+
|
231
|
+
// Shift the touch target into the left margin so that the visible edge of
|
232
|
+
// the control is aligned
|
233
|
+
//
|
234
|
+
// ┆Which colour is your favourite?
|
235
|
+
// ┌┆───┐
|
236
|
+
// │┆() │ Purple
|
237
|
+
// └┆▲──┘
|
238
|
+
// ▲┆└─ Radio pseudo element, aligned with margin
|
239
|
+
// └─── Touch target (invisible input), shifted into the margin
|
240
|
+
.govuk-radios__input {
|
241
|
+
@include govuk-not-ie8 {
|
242
|
+
left: $input-offset * -1;
|
243
|
+
}
|
244
|
+
|
245
|
+
@include govuk-if-ie8 {
|
246
|
+
margin-left: $govuk-small-radios-size * -1;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
// Adjust the size and position of the label.
|
251
|
+
//
|
252
|
+
// Unlike larger radios, we also have to float the label in order to
|
253
|
+
// 'shrink' it, preventing the hover state from kicking in across the full
|
254
|
+
// width of the parent element.
|
255
|
+
.govuk-radios__label {
|
256
|
+
margin-top: -2px;
|
257
|
+
padding: 13px govuk-spacing(3) 13px 1px;
|
258
|
+
float: left;
|
259
|
+
|
260
|
+
@include govuk-media-query($from: tablet) {
|
261
|
+
padding: 11px govuk-spacing(3) 10px 1px;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
// ( ) Radio ring
|
266
|
+
//
|
267
|
+
// Reduce the size of the control [1], vertically centering it within the
|
268
|
+
// touch target [2]
|
269
|
+
.govuk-radios__label::before {
|
270
|
+
top: $input-offset - $govuk-border-width-form-element; // 2
|
271
|
+
width: $govuk-small-radios-size; // 1
|
272
|
+
height: $govuk-small-radios-size; // 1
|
273
|
+
}
|
274
|
+
|
275
|
+
// • Radio button
|
276
|
+
//
|
277
|
+
// Reduce the size of the 'button' and center it within the ring
|
278
|
+
.govuk-radios__label::after {
|
279
|
+
top: 14px;
|
280
|
+
left: 6px;
|
281
|
+
border-width: 6px;
|
282
|
+
}
|
283
|
+
|
284
|
+
// Fix position of hint with small radios
|
285
|
+
//
|
286
|
+
// Do not use hints with small radios – because they're within the input
|
287
|
+
// wrapper they trigger the hover state, but clicking them doesn't actually
|
288
|
+
// activate the control.
|
289
|
+
//
|
290
|
+
// (If you do use them, they won't look completely broken... but seriously,
|
291
|
+
// don't use them)
|
292
|
+
.govuk-radios__hint {
|
293
|
+
padding: 0;
|
294
|
+
clear: both;
|
295
|
+
pointer-events: none;
|
296
|
+
}
|
297
|
+
|
298
|
+
// Align conditional reveals with small radios
|
299
|
+
.govuk-radios__conditional {
|
300
|
+
$margin-left: ($govuk-small-radios-size / 2) - ($conditional-border-width / 2);
|
301
|
+
margin-left: $margin-left;
|
302
|
+
padding-left: $label-offset - ($margin-left + $conditional-border-width);
|
303
|
+
clear: both;
|
304
|
+
}
|
305
|
+
|
306
|
+
.govuk-radios__divider {
|
307
|
+
width: $govuk-small-radios-size;
|
308
|
+
margin-bottom: govuk-spacing(1);
|
309
|
+
}
|
310
|
+
|
311
|
+
// Hover state for small radios.
|
312
|
+
//
|
313
|
+
// We use a hover state for small radios because the touch target size
|
314
|
+
// is so much larger than their visible size, and so we need to provide
|
315
|
+
// feedback to the user as to which radio they will select when their
|
316
|
+
// cursor is outside of the visible area.
|
317
|
+
.govuk-radios__item:hover .govuk-radios__input:not(:disabled) + .govuk-radios__label::before {
|
318
|
+
box-shadow: 0 0 0 $govuk-hover-width $govuk-hover-colour;
|
319
|
+
}
|
320
|
+
|
321
|
+
// Because we've overridden the border-shadow provided by the focus state,
|
322
|
+
// we need to redefine that too.
|
323
|
+
//
|
324
|
+
// We use two box shadows, one that restores the original focus state [1]
|
325
|
+
// and another that then applies the hover state [2].
|
326
|
+
.govuk-radios__item:hover .govuk-radios__input:focus + .govuk-radios__label::before {
|
327
|
+
// sass-lint:disable indentation
|
328
|
+
box-shadow: 0 0 0 $govuk-radios-focus-width $govuk-focus-colour, // 1
|
329
|
+
0 0 0 $govuk-hover-width $govuk-hover-colour; // 2
|
330
|
+
}
|
331
|
+
|
332
|
+
// For devices that explicitly don't support hover, don't provide a hover
|
333
|
+
// state (e.g. on touch devices like iOS).
|
334
|
+
//
|
335
|
+
// We can't use `@media (hover: hover)` because we wouldn't get the hover
|
336
|
+
// state in browsers that don't support `@media (hover)` (like Internet
|
337
|
+
// Explorer) – so we have to 'undo' the hover state instead.
|
338
|
+
@media (hover: none), (pointer: coarse) {
|
339
|
+
.govuk-radios__item:hover .govuk-radios__input:not(:disabled) + .govuk-radios__label::before {
|
340
|
+
box-shadow: initial;
|
341
|
+
}
|
342
|
+
|
343
|
+
.govuk-radios__item:hover .govuk-radios__input:focus + .govuk-radios__label::before {
|
344
|
+
box-shadow: 0 0 0 $govuk-radios-focus-width $govuk-focus-colour;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
187
348
|
}
|
@@ -2,26 +2,26 @@
|
|
2
2
|
"_args": [
|
3
3
|
[
|
4
4
|
{
|
5
|
-
"raw": "govuk-frontend@2.
|
5
|
+
"raw": "govuk-frontend@2.10.0",
|
6
6
|
"scope": null,
|
7
7
|
"escapedName": "govuk-frontend",
|
8
8
|
"name": "govuk-frontend",
|
9
|
-
"rawSpec": "2.
|
10
|
-
"spec": "2.
|
9
|
+
"rawSpec": "2.10.0",
|
10
|
+
"spec": "2.10.0",
|
11
11
|
"type": "version"
|
12
12
|
},
|
13
13
|
"/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ"
|
14
14
|
]
|
15
15
|
],
|
16
|
-
"_from": "govuk-frontend@2.
|
16
|
+
"_from": "govuk-frontend@2.10.0",
|
17
17
|
"_hasShrinkwrap": false,
|
18
|
-
"_id": "govuk-frontend@2.
|
18
|
+
"_id": "govuk-frontend@2.10.0",
|
19
19
|
"_inCache": true,
|
20
20
|
"_location": "/govuk-frontend",
|
21
21
|
"_nodeVersion": "10.15.1",
|
22
22
|
"_npmOperationalInternal": {
|
23
23
|
"host": "s3://npm-registry-packages",
|
24
|
-
"tmp": "tmp/govuk-frontend_2.
|
24
|
+
"tmp": "tmp/govuk-frontend_2.10.0_1555055585302_0.0635054432296085"
|
25
25
|
},
|
26
26
|
"_npmUser": {
|
27
27
|
"name": "govuk-patterns-and-tools",
|
@@ -30,21 +30,21 @@
|
|
30
30
|
"_npmVersion": "6.4.1",
|
31
31
|
"_phantomChildren": {},
|
32
32
|
"_requested": {
|
33
|
-
"raw": "govuk-frontend@2.
|
33
|
+
"raw": "govuk-frontend@2.10.0",
|
34
34
|
"scope": null,
|
35
35
|
"escapedName": "govuk-frontend",
|
36
36
|
"name": "govuk-frontend",
|
37
|
-
"rawSpec": "2.
|
38
|
-
"spec": "2.
|
37
|
+
"rawSpec": "2.10.0",
|
38
|
+
"spec": "2.10.0",
|
39
39
|
"type": "version"
|
40
40
|
},
|
41
41
|
"_requiredBy": [
|
42
42
|
"/"
|
43
43
|
],
|
44
|
-
"_resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.
|
45
|
-
"_shasum": "
|
44
|
+
"_resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.10.0.tgz",
|
45
|
+
"_shasum": "c3302db7187696797ca52541d7cb16cadee7d485",
|
46
46
|
"_shrinkwrap": null,
|
47
|
-
"_spec": "govuk-frontend@2.
|
47
|
+
"_spec": "govuk-frontend@2.10.0",
|
48
48
|
"_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
|
49
49
|
"author": {
|
50
50
|
"name": "GOV.UK Design System Team",
|
@@ -59,12 +59,12 @@
|
|
59
59
|
"devDependencies": {},
|
60
60
|
"directories": {},
|
61
61
|
"dist": {
|
62
|
-
"integrity": "sha512-
|
63
|
-
"shasum": "
|
64
|
-
"tarball": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.
|
62
|
+
"integrity": "sha512-Tfo76yz5ybFMX1heojeiWAyxUx0gABM2/hfMk1zu+9hWvApmfxeTaQOJkje4jeo1ybRo+FhgKFqqAzkBOOUnqg==",
|
63
|
+
"shasum": "c3302db7187696797ca52541d7cb16cadee7d485",
|
64
|
+
"tarball": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.10.0.tgz",
|
65
65
|
"fileCount": 257,
|
66
|
-
"unpackedSize":
|
67
|
-
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\
|
66
|
+
"unpackedSize": 1365294,
|
67
|
+
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcsEPiCRA9TVsSAnZWagAABYcQAJk38n/9YbuZlUtjPNJq\n08cGptMVEFy4DWvQed/wf0nBmlKX07sWUPwAOs0T2fB9E7jVqfATsG9fOdlT\nzfX6vmrWWMZMZ6TklvDf8qIg6mxp8PGy6yemZoP+maoZ4Ab+fHw54MxU2SIJ\nIPFQ/ky3VthzSZo2jdPiEB0UgmJJEK4wmBITVgp8f8lMukkpSpmHPqWeXEoH\nkec4D/2ga6ICbu1JhdTmwu//P+I0BW8M7Xfv4pCY3tJ56F3ZBIVReM5vfM2p\n4J3tl+2+RNXZ/tERmGUmYg/fp3YNx2hE6EWfpQDTs2bewTf1iYZBV5mExmnv\nNKY3cVC7/gYm49Sc7e3edZAwN7QAgujUrcVcE0h7yWGUcx9dcCqMaHHOcQ1i\nh7bc9V2VCyJs4uaEGc5S5YCE1Jzm0hTV5+bQ4i7oKF9WyEWaYpj+UzOb8h1d\nwzd3Jd9VxnWV4Ahzy1r4hwt0BNrZo+9dB2gcVi/Nb+H5yQdC7CpZm38YVAy1\nsY8X8dMBQPjNdzd9j/fcM3QYlWB2xWqRXAhx/YQhw91TpAsvqPQ1Xeh8NQX8\nHQHtRmXHMgItO72nueLPEyDbgjqGfLIYVSYqdSHytWe7uczcKTg4AQPMWK9K\nZ6/KwDuDCysJngFNfdR7lJPFD1hAucp8fujBuezk48HAr1jbGKrMj2+c/EDT\nRNaI\r\n=YoFh\r\n-----END PGP SIGNATURE-----\r\n"
|
68
68
|
},
|
69
69
|
"engines": {
|
70
70
|
"node": ">= 4.2.0"
|
@@ -92,5 +92,5 @@
|
|
92
92
|
"url": "git+https://github.com/alphagov/govuk-frontend.git"
|
93
93
|
},
|
94
94
|
"sass": "all.scss",
|
95
|
-
"version": "2.
|
95
|
+
"version": "2.10.0"
|
96
96
|
}
|
@@ -105,6 +105,14 @@ $govuk-border-colour: govuk-colour("grey-2") !default;
|
|
105
105
|
|
106
106
|
$govuk-input-border-colour: govuk-colour("black") !default;
|
107
107
|
|
108
|
+
/// Input hover colour
|
109
|
+
///
|
110
|
+
/// Used for hover states on form controls
|
111
|
+
///
|
112
|
+
/// @type Colour
|
113
|
+
/// @access public
|
114
|
+
|
115
|
+
$govuk-hover-colour: govuk-colour("grey-3") !default;
|
108
116
|
|
109
117
|
|
110
118
|
// =============================================================================
|
@@ -97,3 +97,10 @@ $govuk-border-width-form-group-error: $govuk-border-width !default;
|
|
97
97
|
/// @access public
|
98
98
|
|
99
99
|
$govuk-focus-width: 3px !default;
|
100
|
+
|
101
|
+
/// Hover width for form controls with a hover state
|
102
|
+
///
|
103
|
+
/// @type Number
|
104
|
+
/// @access public
|
105
|
+
|
106
|
+
$govuk-hover-width: 10px !default;
|
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: 16.
|
4
|
+
version: 16.11.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-04-
|
11
|
+
date: 2019-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govspeak
|