govuk_publishing_components 9.6.0 → 9.7.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/components/radio.js +32 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +4 -31
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +13 -42
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +4 -32
- data/app/assets/stylesheets/govuk_publishing_components/components/_label.scss +4 -23
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +0 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +5 -129
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +5 -3
- data/app/views/govuk_publishing_components/components/_back_link.html.erb +7 -6
- data/app/views/govuk_publishing_components/components/_button.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_input.html.erb +32 -25
- data/app/views/govuk_publishing_components/components/_label.html.erb +13 -31
- data/app/views/govuk_publishing_components/components/_radio.html.erb +54 -38
- data/app/views/govuk_publishing_components/components/docs/radio.yml +14 -2
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/all.js +172 -172
- data/node_modules/govuk-frontend/components/checkboxes/README.md +92 -4
- data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +7 -1
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +356 -1
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +15 -3
- data/node_modules/govuk-frontend/components/date-input/README.md +3 -3
- data/node_modules/govuk-frontend/components/file-upload/README.md +3 -3
- data/node_modules/govuk-frontend/components/header/_header.scss +5 -3
- data/node_modules/govuk-frontend/components/input/README.md +3 -3
- data/node_modules/govuk-frontend/components/phase-banner/README.md +1 -1
- data/node_modules/govuk-frontend/components/radios/README.md +176 -3
- data/node_modules/govuk-frontend/components/radios/_radios.scss +15 -1
- data/node_modules/govuk-frontend/components/radios/radios.js +356 -1
- data/node_modules/govuk-frontend/components/radios/template.njk +19 -3
- data/node_modules/govuk-frontend/components/select/README.md +3 -3
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +4 -4
- data/node_modules/govuk-frontend/components/tabs/tabs.js +1 -1
- data/node_modules/govuk-frontend/components/textarea/README.md +3 -3
- data/node_modules/govuk-frontend/package.json +18 -18
- data/node_modules/govuk-frontend/template.njk +4 -2
- data/node_modules/govuk-frontend/tools/_font-url.scss +1 -1
- data/node_modules/govuk-frontend/tools/_image-url.scss +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f3131ba99a3b7dd9d31bf4334388ab00549d24e094139aa9ca894fe992bdbb1
|
4
|
+
data.tar.gz: 9649c4163ee5badbcb2ad66fe321293c106010068bad671db17a59b625075a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f393badabcf4a976abc0fa696026351809a10c7158b6ea5146c6c105dcf1c2cc80e2c5c66717a06cd7dc5d83b6c8514619c1413fb3bb919cf70ff068b054b240
|
7
|
+
data.tar.gz: 45801c06bfda33cd98104c7031a308ff9459a522a8879c4cd2486f6f85244b1953b2c03648d110e4bcdef9e57802ca1b7c2e3ce0d99c6e3040d0fe462e48c752
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// This component relies on JavaScript from GOV.UK Frontend
|
2
|
+
//= require components/radios/radios.js
|
3
|
+
|
4
|
+
window.GOVUK = window.GOVUK || {}
|
5
|
+
window.GOVUK.FrontendModules = window.GOVUK.FrontendModules || {};
|
6
|
+
|
7
|
+
(function (global, GOVUK) {
|
8
|
+
'use strict'
|
9
|
+
|
10
|
+
/**
|
11
|
+
* TODO: Ideally this would be a NodeList.prototype.forEach polyfill
|
12
|
+
*
|
13
|
+
* See: https://github.com/imagitama/nodelist-foreach-polyfill
|
14
|
+
* but the polyfill doesn't work in IE8 and needs more investigation
|
15
|
+
*/
|
16
|
+
function nodeListForEach (nodes, callback) {
|
17
|
+
if (window.NodeList.prototype.forEach) {
|
18
|
+
return nodes.forEach(callback)
|
19
|
+
}
|
20
|
+
for (var i = 0; i < nodes.length; i++) {
|
21
|
+
callback.call(window, nodes[i], i, nodes)
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
GOVUK.FrontendModules.Radios = window.GOVUKFrontend
|
26
|
+
|
27
|
+
var $radios = document.querySelectorAll('[data-module="radios"]')
|
28
|
+
|
29
|
+
nodeListForEach($radios, function ($radio) {
|
30
|
+
new GOVUK.FrontendModules.Radios($radio).init()
|
31
|
+
})
|
32
|
+
})(window, window.GOVUK)
|
@@ -1,33 +1,6 @@
|
|
1
|
-
|
1
|
+
// This component relies on styles from GOV.UK Frontend
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
display: inline-block;
|
6
|
-
margin-top: $gem-spacing-scale-3;
|
7
|
-
margin-bottom: $gem-spacing-scale-3;
|
8
|
-
font-size: 16px;
|
9
|
-
line-height: 1.25;
|
3
|
+
// Specify the functions used to resolve assets paths in SCSS
|
4
|
+
$govuk-font-url-function: "font-url";
|
10
5
|
|
11
|
-
|
12
|
-
border-bottom: 1px solid currentColor;
|
13
|
-
|
14
|
-
&:link,
|
15
|
-
&:link:focus,
|
16
|
-
&:visited,
|
17
|
-
&:active {
|
18
|
-
color: currentColor;
|
19
|
-
}
|
20
|
-
|
21
|
-
&:hover {
|
22
|
-
color: $link-colour;
|
23
|
-
}
|
24
|
-
|
25
|
-
&::before {
|
26
|
-
content: "";
|
27
|
-
display: inline-block;
|
28
|
-
margin-right: .3em;
|
29
|
-
border-top: 0.3125em solid transparent;
|
30
|
-
border-right: 0.375em solid currentColor;
|
31
|
-
border-bottom: 0.3125em solid transparent;
|
32
|
-
}
|
33
|
-
}
|
6
|
+
@import "../../../../node_modules/govuk-frontend/components/back-link/back-link";
|
@@ -1,20 +1,18 @@
|
|
1
|
-
|
2
|
-
@import "mixins/media-down";
|
3
|
-
@import "mixins/margins";
|
1
|
+
// This component relies on styles from GOV.UK Frontend
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
// Specify the functions used to resolve assets paths in SCSS
|
4
|
+
$govuk-image-url-function: "image-url";
|
5
|
+
$govuk-font-url-function: "font-url";
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
text-align: center;
|
13
|
-
}
|
7
|
+
@import "../../../../node_modules/govuk-frontend/components/button/button";
|
8
|
+
|
9
|
+
@import "mixins/margins";
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
// Because govuk-frontend adds a responsive bottom margin by default for each component
|
12
|
+
// we reset it to zero so we can set it separately using `gem-c-button--bottom-margin`
|
13
|
+
// If we decide to use responsive margins consistently across components we can remove this
|
14
|
+
.gem-c-button {
|
15
|
+
margin-bottom: 0;
|
18
16
|
}
|
19
17
|
|
20
18
|
// this will be moved and extended into a model for general component spacing
|
@@ -24,35 +22,8 @@
|
|
24
22
|
@include responsive-bottom-margin;
|
25
23
|
}
|
26
24
|
|
27
|
-
%gem-c-button--start,
|
28
|
-
.gem-c-button--start {
|
29
|
-
@include bold-24($line-height: (24 / 20));
|
30
|
-
display: inline-block;
|
31
|
-
padding: 0.6em 1.7em 0.45em 0.67em;
|
32
|
-
|
33
|
-
@include media(tablet) {
|
34
|
-
padding-top: 0.3em;
|
35
|
-
padding-bottom: 0.15em;
|
36
|
-
}
|
37
|
-
|
38
|
-
background-image: image-url("govuk_publishing_components/icon-pointer.png");
|
39
|
-
background-position: 100% 50%;
|
40
|
-
background-repeat: no-repeat;
|
41
|
-
|
42
|
-
@include media-down(mobile) {
|
43
|
-
background-position: center right -.35em;
|
44
|
-
}
|
45
|
-
|
46
|
-
@include device-pixel-ratio() {
|
47
|
-
background-image: image-url("govuk_publishing_components/icon-pointer-2x.png");
|
48
|
-
background-size: 30px 19px;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
// scss-lint:disable SelectorFormat
|
53
25
|
.gem-c-button__info-text {
|
54
26
|
display: block;
|
55
|
-
margin-top: .5em;
|
56
27
|
max-width: 14em;
|
28
|
+
margin-top: .5em;
|
57
29
|
}
|
58
|
-
// scss-lint:enable SelectorFormat
|
@@ -1,34 +1,6 @@
|
|
1
|
-
//
|
2
|
-
.gem-c-input,
|
1
|
+
// This component relies on styles from GOV.UK Frontend
|
3
2
|
|
4
|
-
//
|
5
|
-
|
6
|
-
// This can be removed once everything is using `core_layout`.
|
7
|
-
input[type=text].gem-c-input {
|
8
|
-
@include core-19;
|
3
|
+
// Specify the functions used to resolve assets paths in SCSS
|
4
|
+
$govuk-font-url-function: "font-url";
|
9
5
|
|
10
|
-
|
11
|
-
width: 100%;
|
12
|
-
height: 2.10526em;
|
13
|
-
|
14
|
-
margin: 0; // Override unwanted global cascaded styles
|
15
|
-
margin-bottom: 20px;
|
16
|
-
|
17
|
-
padding: $gem-spacing-scale-1;
|
18
|
-
// setting any background-color makes text invisible when changing colours to dark backgrounds in Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=1335476)
|
19
|
-
// as background-color and color need to always be set together, color should not be set either
|
20
|
-
border: $gem-border-width-form-element solid;
|
21
|
-
border-radius: 0;
|
22
|
-
|
23
|
-
// Disable inner shadow and remove rounded corners
|
24
|
-
appearance: none;
|
25
|
-
|
26
|
-
&.gem-c-input:focus {
|
27
|
-
outline: $gem-focus-width solid $gem-focus-colour;
|
28
|
-
}
|
29
|
-
|
30
|
-
&.gem-c-input--error {
|
31
|
-
border: $gem-border-width-error solid $gem-error-colour;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
// scss-lint:enable QualifyingElement
|
6
|
+
@import "../../../../node_modules/govuk-frontend/components/input/input";
|
@@ -1,25 +1,6 @@
|
|
1
|
-
|
1
|
+
// This component relies on styles from GOV.UK Frontend
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
color: $gem-text-colour;
|
6
|
-
@include core-19;
|
7
|
-
}
|
3
|
+
// Specify the functions used to resolve assets paths in SCSS
|
4
|
+
$govuk-font-url-function: "font-url";
|
8
5
|
|
9
|
-
|
10
|
-
font-weight: 700;
|
11
|
-
}
|
12
|
-
|
13
|
-
// Hint text sits inside a label, to be read by AT
|
14
|
-
.gem-c-label__hint {
|
15
|
-
display: block;
|
16
|
-
color: $gem-secondary-text-colour;
|
17
|
-
font-weight: 400;
|
18
|
-
}
|
19
|
-
|
20
|
-
// TODO: Replace this with the error message component.
|
21
|
-
.gem-c-label__error {
|
22
|
-
font-weight: bold;
|
23
|
-
color: $gem-error-colour;
|
24
|
-
padding-top: 4px;
|
25
|
-
}
|
6
|
+
@import "../../../../node_modules/govuk-frontend/components/label/label";
|
@@ -10,14 +10,6 @@
|
|
10
10
|
border-bottom-color: govuk-colour("grey-1");
|
11
11
|
}
|
12
12
|
|
13
|
-
// Fix header component's reliance on markup whitespace
|
14
|
-
// https://github.com/alphagov/govuk-frontend/pull/884/files
|
15
|
-
//
|
16
|
-
// Remove this fix after updating to GOV.UK Frontend 1.1.0
|
17
|
-
.govuk-header__container {
|
18
|
-
@include govuk-clearfix;
|
19
|
-
}
|
20
|
-
|
21
13
|
.govuk-header__logo {
|
22
14
|
@include mq ($from: desktop) {
|
23
15
|
float: left;
|
@@ -1,131 +1,7 @@
|
|
1
|
-
|
2
|
-
@import "helpers/px-to-em";
|
1
|
+
// This component relies on styles from GOV.UK Frontend
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
// Specify the functions used to resolve assets paths in SCSS
|
4
|
+
$govuk-image-url-function: "image-url";
|
5
|
+
$govuk-font-url-function: "font-url";
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
margin-bottom: $gem-spacing-scale-2;
|
10
|
-
padding: 0 0 0 em(40px, 19px);
|
11
|
-
|
12
|
-
clear: left;
|
13
|
-
|
14
|
-
@include core-19;
|
15
|
-
}
|
16
|
-
|
17
|
-
.gem-c-radio:last-child,
|
18
|
-
.gem-c-radio:last-of-type {
|
19
|
-
margin-bottom: 0;
|
20
|
-
}
|
21
|
-
|
22
|
-
.gem-c-radio--inline {
|
23
|
-
margin-right: $gem-spacing-scale-4;
|
24
|
-
float: left;
|
25
|
-
clear: none;
|
26
|
-
}
|
27
|
-
|
28
|
-
.gem-c-radio__input {
|
29
|
-
font-size: inherit;
|
30
|
-
position: absolute;
|
31
|
-
|
32
|
-
z-index: 1;
|
33
|
-
top: 0;
|
34
|
-
left: 0;
|
35
|
-
|
36
|
-
width: em(40px, 19px);
|
37
|
-
height: em(40px, 19px);
|
38
|
-
|
39
|
-
cursor: pointer;
|
40
|
-
|
41
|
-
// IE8 doesn’t support pseudoelements, so we don’t want to hide native elements there. Double colons get ommited by IE8.
|
42
|
-
@if ($is-ie == false) or ($ie-version == 9) {
|
43
|
-
margin: 0;
|
44
|
-
opacity: 0;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
.gem-c-radio__label {
|
49
|
-
display: block;
|
50
|
-
border: 2px solid transparent;
|
51
|
-
}
|
52
|
-
|
53
|
-
.gem-c-radio__label__text {
|
54
|
-
cursor: pointer;
|
55
|
-
// remove 300ms pause on mobile
|
56
|
-
-ms-touch-action: manipulation;
|
57
|
-
touch-action: manipulation;
|
58
|
-
|
59
|
-
display: block;
|
60
|
-
padding-top: em(8px, 19px);
|
61
|
-
padding-bottom: em($gem-spacing-scale-1, 19px);
|
62
|
-
}
|
63
|
-
|
64
|
-
.gem-c-radio__label__text,
|
65
|
-
.gem-c-radio__label__hint {
|
66
|
-
padding-left: em($gem-spacing-scale-3, 19px);
|
67
|
-
padding-right: em($gem-spacing-scale-3, 19px);
|
68
|
-
}
|
69
|
-
|
70
|
-
.gem-c-radio__input + .gem-c-radio__label::before {
|
71
|
-
content: "";
|
72
|
-
box-sizing: border-box;
|
73
|
-
position: absolute;
|
74
|
-
top: 0;
|
75
|
-
left: 0;
|
76
|
-
|
77
|
-
width: em(40px, 19px);
|
78
|
-
height: em(40px, 19px);
|
79
|
-
|
80
|
-
border: $gem-border-width-form-element solid;
|
81
|
-
border-radius: 50%;
|
82
|
-
background: transparent;
|
83
|
-
}
|
84
|
-
|
85
|
-
.gem-c-radio__input + .gem-c-radio__label::after {
|
86
|
-
content: "";
|
87
|
-
|
88
|
-
position: absolute;
|
89
|
-
top: em($gem-spacing-scale-2, 19px);
|
90
|
-
left: em($gem-spacing-scale-2, 19px);
|
91
|
-
|
92
|
-
width: 0;
|
93
|
-
height: 0;
|
94
|
-
|
95
|
-
border: em($gem-spacing-scale-2, 19px) solid;
|
96
|
-
border-radius: 50%;
|
97
|
-
background: currentColor;
|
98
|
-
opacity: 0;
|
99
|
-
}
|
100
|
-
|
101
|
-
// Focused state
|
102
|
-
.gem-c-radio__input:focus + .gem-c-radio__label::before {
|
103
|
-
box-shadow: 0 0 0 4px $gem-focus-colour;
|
104
|
-
}
|
105
|
-
|
106
|
-
// Selected state
|
107
|
-
.gem-c-radio__input:checked + .gem-c-radio__label::after {
|
108
|
-
opacity: 1;
|
109
|
-
}
|
110
|
-
|
111
|
-
// Disabled state
|
112
|
-
.gem-c-radio__input:disabled,
|
113
|
-
.gem-c-radio__input:disabled + .gem-c-radio__label__text {
|
114
|
-
cursor: default;
|
115
|
-
}
|
116
|
-
|
117
|
-
.gem-c-radio__input:disabled + .gem-c-radio__label {
|
118
|
-
opacity: .5;
|
119
|
-
}
|
120
|
-
|
121
|
-
// TODO: Can be replaced by spacing + typography helpers from GOV.UK Frontend
|
122
|
-
.gem-c-radio--margin-bottom-0 {
|
123
|
-
margin-bottom: $gem-spacing-scale-0 !important;
|
124
|
-
}
|
125
|
-
|
126
|
-
// TODO: Can be replaced by spacing + typography helpers from GOV.UK Frontend
|
127
|
-
.gem-c-radio__block-text {
|
128
|
-
display: block;
|
129
|
-
@include core-19;
|
130
|
-
margin-bottom: $gem-spacing-scale-3;
|
131
|
-
}
|
7
|
+
@import "../../../../node_modules/govuk-frontend/components/radios/radios";
|
@@ -1,11 +1,13 @@
|
|
1
|
-
@import "
|
1
|
+
@import "../../../../node_modules/govuk-frontend/components/button/button";
|
2
2
|
|
3
|
+
// scss-lint:disable PlaceholderInExtend
|
3
4
|
.gem-c-govspeak {
|
4
5
|
.button {
|
5
|
-
@extend
|
6
|
+
@extend .govuk-button;
|
6
7
|
}
|
7
8
|
|
8
9
|
.button-start {
|
9
|
-
@extend
|
10
|
+
@extend .govuk-button--start;
|
10
11
|
}
|
11
12
|
}
|
13
|
+
// scss-lint:enable PlaceholderInExtend
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<%= link_to t('components.back_link.back'),
|
2
|
+
href,
|
3
|
+
class: %w(
|
4
|
+
gem-c-back-link
|
5
|
+
govuk-back-link
|
6
|
+
)
|
7
|
+
%>
|
@@ -7,8 +7,8 @@
|
|
7
7
|
margin_bottom ||= false
|
8
8
|
data_attributes ||= false
|
9
9
|
title ||= false
|
10
|
-
css_classes = %w(gem-c-button)
|
11
|
-
css_classes << "
|
10
|
+
css_classes = %w(gem-c-button govuk-button)
|
11
|
+
css_classes << "govuk-button--start" if start
|
12
12
|
css_classes << "gem-c-button--bottom-margin" if margin_bottom
|
13
13
|
css_classes = css_classes.join(" ")
|
14
14
|
html_options = { class: css_classes }
|
@@ -1,35 +1,42 @@
|
|
1
1
|
<%
|
2
2
|
id ||= "input-#{SecureRandom.hex(4)}"
|
3
3
|
hint_id ||= "hint-#{SecureRandom.hex(4)}"
|
4
|
-
value ||=
|
4
|
+
value ||= nil
|
5
5
|
error_message ||= false
|
6
6
|
label ||= {}
|
7
7
|
type ||= "text"
|
8
8
|
describedby ||= false
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
html_for: id,
|
14
|
-
hint_text: error_message,
|
15
|
-
hint_text_classes: "gem-c-label__error",
|
16
|
-
hint_id: hint_id,
|
17
|
-
bold: error_message ? true : false,
|
18
|
-
} %>
|
9
|
+
ariadescribedby ||= nil
|
10
|
+
css_classes = %w(gem-c-input govuk-input)
|
11
|
+
css_classes << "govuk-input--error" if error_message
|
12
|
+
hint_text_css_classes = "govuk-error-message" if error_message
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
if error_message
|
15
|
+
ariadescribedby = hint_id
|
16
|
+
elsif describedby
|
17
|
+
ariadescribedby = describedby
|
18
|
+
end
|
19
|
+
%>
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
21
|
+
<%= content_tag :div, class: "govuk-form-group" do %>
|
22
|
+
<%= render "govuk_publishing_components/components/label", {
|
23
|
+
text: label[:text],
|
24
|
+
html_for: id,
|
25
|
+
hint_text: error_message,
|
26
|
+
hint_text_classes: hint_text_css_classes,
|
27
|
+
hint_id: hint_id,
|
28
|
+
bold: error_message ? true : false,
|
29
|
+
} %>
|
31
30
|
|
32
|
-
|
33
|
-
value
|
34
|
-
|
35
|
-
|
31
|
+
<%= text_field_tag name,
|
32
|
+
value,
|
33
|
+
{
|
34
|
+
class: css_classes,
|
35
|
+
id: id,
|
36
|
+
type: type,
|
37
|
+
aria: {
|
38
|
+
describedby: ariadescribedby
|
39
|
+
}
|
40
|
+
}
|
41
|
+
%>
|
42
|
+
<% end %>
|