govuk_publishing_components 21.0.0 → 21.1.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/_search.scss +77 -62
- data/app/views/govuk_publishing_components/components/_select.html.erb +7 -4
- data/app/views/govuk_publishing_components/components/docs/select.yml +24 -1
- 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: eba6273d64031399b770ec443b7502a8cde512cc2127af47d08f3046c6389238
|
4
|
+
data.tar.gz: f49f10c2ec3166a2c28fa24d370745aa7f45503e66e878653303466d82e604a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee746fd4ccd8f7a590361a1854456a8b68af731788a8f686880c61cb23274dea632164565cf325146914d172bcdbcafabb5a230ba0e53a737bbc26c53c9890b4
|
7
|
+
data.tar.gz: 5aa2a3af8b027dd77950d30a826e2bd61dae09b2dc6f1706d3fa6d2d13d563478e52d75b883d2707ca8810e970cb08ae16d76e76df45666767d1a1abbf75a4d1
|
@@ -7,22 +7,37 @@ $large-input-size: 50px;
|
|
7
7
|
}
|
8
8
|
|
9
9
|
.gem-c-search__label {
|
10
|
+
@include govuk-font($size: 19, $line-height: $input-size);
|
10
11
|
display: block;
|
11
12
|
|
12
13
|
h1 {
|
13
14
|
@include govuk-font($size: 19, $line-height: $input-size);
|
14
15
|
margin: 0;
|
15
16
|
}
|
17
|
+
|
18
|
+
.js-enabled & {
|
19
|
+
position: absolute;
|
20
|
+
left: govuk-spacing(3);
|
21
|
+
top: 1px;
|
22
|
+
z-index: 1;
|
23
|
+
color: $govuk-secondary-text-colour;
|
24
|
+
}
|
25
|
+
|
26
|
+
// match label colour with the label component colour
|
27
|
+
// when javascript is enabled and inline_label option is set to false
|
28
|
+
.js-enabled .gem-c-search--separate-label & {
|
29
|
+
color: $govuk-text-colour;
|
30
|
+
}
|
16
31
|
}
|
17
32
|
|
18
33
|
.gem-c-search__input[type="search"] { // overly specific to prevent some overrides from outside
|
19
34
|
@include govuk-font($size: 19, $line-height: (28 / 19));
|
20
35
|
|
21
36
|
padding: 6px;
|
22
|
-
margin:
|
37
|
+
margin: 0;
|
23
38
|
width: 100%;
|
24
39
|
height: $input-size;
|
25
|
-
border:
|
40
|
+
border: $govuk-border-width-form-element solid $govuk-input-border-colour;
|
26
41
|
background: govuk-colour("white");
|
27
42
|
border-radius: 0; //otherwise iphones apply an automatic border radius
|
28
43
|
box-sizing: border-box;
|
@@ -30,32 +45,66 @@ $large-input-size: 50px;
|
|
30
45
|
-moz-appearance: none;
|
31
46
|
appearance: none;
|
32
47
|
|
48
|
+
// the .focus class is added by JS and ensures that the input remains above the label once clicked/filled in
|
49
|
+
&:focus,
|
50
|
+
&.focus {
|
51
|
+
z-index: 2;
|
52
|
+
}
|
53
|
+
|
33
54
|
&:focus {
|
34
55
|
outline: $govuk-focus-width solid $govuk-focus-colour;
|
35
|
-
outline
|
56
|
+
// Ensure outline appears outside of the element
|
57
|
+
outline-offset: 0;
|
58
|
+
// Double the border by adding its width again. Use `box-shadow` for this // instead of changing `border-width`
|
59
|
+
// Also, `outline` cannot be utilised here as it is already used for the yellow focus state.
|
60
|
+
box-shadow: inset 0 0 0 $govuk-border-width-form-element;
|
61
|
+
|
62
|
+
@include govuk-if-ie8 {
|
63
|
+
// IE8 doesn't support `box-shadow` so double the border with
|
64
|
+
// `border-width`.
|
65
|
+
border-width: $govuk-border-width-form-element * 2;
|
66
|
+
}
|
36
67
|
}
|
37
68
|
}
|
38
69
|
|
39
70
|
.gem-c-search__submit {
|
40
|
-
padding: 6px;
|
41
71
|
border: 0;
|
42
72
|
cursor: pointer;
|
43
73
|
border-radius: 0;
|
74
|
+
position: relative;
|
75
|
+
padding: 0;
|
76
|
+
width: $input-size;
|
77
|
+
height: $input-size;
|
78
|
+
background-image: image-url("govuk_publishing_components/search-button.png");
|
79
|
+
background-repeat: no-repeat;
|
80
|
+
background-position: 2px 50%;
|
81
|
+
text-indent: -5000px;
|
82
|
+
overflow: hidden;
|
83
|
+
|
84
|
+
@include govuk-device-pixel-ratio {
|
85
|
+
background-size: 52.5px auto;
|
86
|
+
background-position: 115% 50%;
|
87
|
+
}
|
44
88
|
|
45
89
|
&:focus {
|
90
|
+
z-index: 2;
|
46
91
|
outline: $govuk-focus-width solid $govuk-focus-colour;
|
92
|
+
// Ensure outline appears outside of the element
|
93
|
+
outline-offset: 0;
|
94
|
+
// Double the border by adding its width again. Use `box-shadow` for this // instead of changing `border-width` - this is for consistency with
|
95
|
+
// Also, `outline` cannot be utilised
|
96
|
+
// here as it is already used for the yellow focus state.
|
97
|
+
box-shadow: inset 0 0 0 $govuk-border-width-form-element * 2 govuk-colour("black");
|
98
|
+
|
99
|
+
@include govuk-if-ie8 {
|
100
|
+
// IE8 doesn't support `box-shadow` so double the border with
|
101
|
+
// `border-width`.
|
102
|
+
border-width: $govuk-border-width-form-element * 2;
|
103
|
+
}
|
47
104
|
}
|
48
|
-
}
|
49
|
-
|
50
|
-
.js-enabled {
|
51
|
-
.gem-c-search__label {
|
52
|
-
@include govuk-font($size: 19, $line-height: $input-size);
|
53
105
|
|
54
|
-
|
55
|
-
|
56
|
-
top: 1px;
|
57
|
-
z-index: 1;
|
58
|
-
color: $govuk-secondary-text-colour;
|
106
|
+
&::-moz-focus-inner {
|
107
|
+
border: 0;
|
59
108
|
}
|
60
109
|
}
|
61
110
|
|
@@ -72,50 +121,25 @@ $large-input-size: 50px;
|
|
72
121
|
vertical-align: top;
|
73
122
|
}
|
74
123
|
|
75
|
-
.gem-c-search__input[type="search"] {
|
76
|
-
margin: 0;
|
77
|
-
|
78
|
-
// the .focus class is added by JS and ensures that the input remains above the label once clicked/filled in
|
79
|
-
&:focus,
|
80
|
-
&.focus {
|
81
|
-
z-index: 2;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
124
|
.gem-c-search__submit-wrapper {
|
86
125
|
width: 1%;
|
87
126
|
}
|
88
127
|
|
89
|
-
.gem-c-search__submit {
|
90
|
-
position: relative;
|
91
|
-
padding: 0;
|
92
|
-
width: $input-size;
|
93
|
-
height: $input-size;
|
94
|
-
background-image: image-url("govuk_publishing_components/search-button.png");
|
95
|
-
background-repeat: no-repeat;
|
96
|
-
background-position: 2px 50%;
|
97
|
-
text-indent: -5000px;
|
98
|
-
overflow: hidden;
|
99
|
-
|
100
|
-
&:focus {
|
101
|
-
z-index: 2;
|
102
|
-
}
|
103
|
-
|
104
|
-
&::-moz-focus-inner {
|
105
|
-
border: 0;
|
106
|
-
}
|
107
|
-
|
108
|
-
@include govuk-device-pixel-ratio {
|
109
|
-
background-size: 52.5px auto;
|
110
|
-
background-position: 115% 50%;
|
111
|
-
}
|
112
|
-
}
|
113
|
-
|
114
128
|
.gem-c-search--on-govuk-blue {
|
115
129
|
.gem-c-search__label {
|
116
130
|
color: govuk-colour("white");
|
117
131
|
}
|
118
132
|
|
133
|
+
.gem-c-search__input {
|
134
|
+
border-width: 0;
|
135
|
+
|
136
|
+
// no need for black outline as there is enough contrast
|
137
|
+
// with the blue background
|
138
|
+
&:focus {
|
139
|
+
box-shadow: none;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
119
143
|
.gem-c-search__submit {
|
120
144
|
background-color: govuk-colour("black");
|
121
145
|
color: govuk-colour("white");
|
@@ -132,15 +156,7 @@ $large-input-size: 50px;
|
|
132
156
|
}
|
133
157
|
}
|
134
158
|
|
135
|
-
|
136
159
|
.gem-c-search--on-white {
|
137
|
-
.gem-c-search__label {
|
138
|
-
color: govuk-colour("black");
|
139
|
-
}
|
140
|
-
|
141
|
-
.gem-c-search__input[type="search"] {
|
142
|
-
border: solid 1px govuk-colour("mid-grey", $legacy: "grey-2");
|
143
|
-
}
|
144
160
|
|
145
161
|
.gem-c-search__submit {
|
146
162
|
background-color: govuk-colour("light-blue");
|
@@ -152,12 +168,11 @@ $large-input-size: 50px;
|
|
152
168
|
}
|
153
169
|
|
154
170
|
.gem-c-search__input[type="search"] {
|
155
|
-
border-right: 0;
|
156
|
-
}
|
171
|
+
border-right-width: 0;
|
157
172
|
|
158
|
-
|
159
|
-
|
160
|
-
|
173
|
+
// add the border once focused
|
174
|
+
&:focus {
|
175
|
+
border-right-width: 2px;
|
161
176
|
}
|
162
177
|
}
|
163
178
|
}
|
@@ -3,16 +3,19 @@
|
|
3
3
|
id ||= false
|
4
4
|
label ||= false
|
5
5
|
full_width ||= false
|
6
|
+
name ||= id
|
7
|
+
heading_size = '' unless ['s', 'm', 'l', 'xl'].include?(heading_size)
|
8
|
+
|
9
|
+
label_classes = %w(govuk-label)
|
10
|
+
label_classes << "govuk-label--#{heading_size}" if heading_size
|
6
11
|
|
7
12
|
select_helper = GovukPublishingComponents::Presenters::SelectHelper.new(options)
|
8
13
|
data_module = "data-module=track-select-change" unless select_helper.data_tracking?.eql?(false)
|
9
14
|
%>
|
10
15
|
<% if options.any? && id && label %>
|
11
16
|
<div class="govuk-form-group gem-c-select">
|
12
|
-
|
13
|
-
|
14
|
-
</label>
|
15
|
-
<select class="govuk-select <%= 'gem-c-select__select--full-width' if full_width %>" id="<%= id %>" name="<%= id %>" <%= data_module %> >
|
17
|
+
<%= label_tag(id, label, class: label_classes) %>
|
18
|
+
<select class="govuk-select <%= 'gem-c-select__select--full-width' if full_width %>" id="<%= id %>" name="<%= name %>" <%= data_module %> >
|
16
19
|
<%= options_for_select(select_helper.option_markup, select_helper.selected_option) %>
|
17
20
|
</select>
|
18
21
|
</div>
|
@@ -19,6 +19,17 @@ examples:
|
|
19
19
|
value: 'option2'
|
20
20
|
- text: 'Option three'
|
21
21
|
value: 'option3'
|
22
|
+
with_different_id_and_name:
|
23
|
+
description: If no name is provided, name defaults to the (required) value of id.
|
24
|
+
data:
|
25
|
+
id: 'dropdown1-1'
|
26
|
+
label: 'My Dropdown'
|
27
|
+
name: 'dropdown[1]'
|
28
|
+
options:
|
29
|
+
- text: 'Option one'
|
30
|
+
value: 'option1'
|
31
|
+
- text: 'Option two'
|
32
|
+
value: 'option2'
|
22
33
|
with_preselect:
|
23
34
|
data:
|
24
35
|
id: 'dropdown2'
|
@@ -92,4 +103,16 @@ examples:
|
|
92
103
|
value: 'option2'
|
93
104
|
- text: 'Option three'
|
94
105
|
value: 'option3'
|
95
|
-
|
106
|
+
with_custom_label_size:
|
107
|
+
description: Make the label different sizes. Valid options are 's', 'm', 'l' and 'xl'.
|
108
|
+
data:
|
109
|
+
id: 'dropdown6'
|
110
|
+
label: 'Bigger!'
|
111
|
+
heading_size: 'xl'
|
112
|
+
options:
|
113
|
+
- text: 'Option one'
|
114
|
+
value: 'option1'
|
115
|
+
- text: 'Option two'
|
116
|
+
value: 'option2'
|
117
|
+
- text: 'Option three'
|
118
|
+
value: 'option3'
|
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: 21.
|
4
|
+
version: 21.1.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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|