govuk_publishing_components 21.44.0 → 21.45.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/_input.scss +34 -0
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +6 -6
- data/app/views/govuk_publishing_components/components/_input.html.erb +26 -17
- data/app/views/govuk_publishing_components/components/docs/input.yml +17 -0
- data/lib/govuk_publishing_components/presenters/breadcrumbs.rb +2 -2
- data/lib/govuk_publishing_components/presenters/machine_readable/creative_work_schema.rb +5 -5
- data/lib/govuk_publishing_components/presenters/machine_readable/is_part_of_schema.rb +3 -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: a6b9b3ccb50fed59ef6f76d01f29904a100f1b3e3f5585e4884dd59c2ebe61a2
|
4
|
+
data.tar.gz: 11681141b7eb3b7904c8ee16f950370599ec2c4f4f9121ba34b6d04a57c4b522
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8be5fd215ab57c63d064a6b98f41ff4a6ecf92aafeea63e63a27a823075d72e12881b54c0d76995fc8037089b37696b64e9353940814ade22692439db3999ab8
|
7
|
+
data.tar.gz: bb193cd02f9916cdd204132eeccf7a3c155bf74503c8be662ac947a5d867bcdbd3d455e3fbede4950129c79dd7c6561ce459ff916b3198c9d80c47c1989658b7
|
@@ -16,3 +16,37 @@
|
|
16
16
|
padding-left: govuk-spacing(6);
|
17
17
|
}
|
18
18
|
}
|
19
|
+
|
20
|
+
.gem-c-input__wrapper {
|
21
|
+
display: flex;
|
22
|
+
display: -ms-flexbox; // sass-lint:disable-line no-duplicate-properties
|
23
|
+
|
24
|
+
.gem-c-input {
|
25
|
+
display: inline-block;
|
26
|
+
flex: 0 1 auto;
|
27
|
+
}
|
28
|
+
|
29
|
+
.gem-c-input:focus {
|
30
|
+
z-index: 1; // increase z-index on focus so it appears over the suffix
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
.gem-c-input__suffix {
|
35
|
+
@include govuk-font($size: 19);
|
36
|
+
|
37
|
+
background-color: govuk-colour("light-grey");
|
38
|
+
border: $govuk-border-width-form-element solid $govuk-input-border-colour;
|
39
|
+
border-left: 0;
|
40
|
+
box-sizing: border-box;
|
41
|
+
cursor: default; // emphasise non-editable status of prefixes and suffixes
|
42
|
+
display: inline-block;
|
43
|
+
flex: 0 0 0;
|
44
|
+
padding: govuk-spacing(1);
|
45
|
+
white-space: nowrap;
|
46
|
+
width: auto;
|
47
|
+
height: 40px;
|
48
|
+
@if $govuk-typography-use-rem {
|
49
|
+
height: govuk-px-to-rem(40px);
|
50
|
+
}
|
51
|
+
margin-top: 0;
|
52
|
+
}
|
@@ -21,12 +21,12 @@ module GovukPublishingComponents
|
|
21
21
|
@component_doc = component_docs.get(params[:component])
|
22
22
|
@component_example = @component_doc.examples.find { |f| f.id == params[:example] }
|
23
23
|
@guide_breadcrumbs = [
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
index_breadcrumb,
|
25
|
+
component_breadcrumb(@component_doc, @component_example),
|
26
|
+
{
|
27
|
+
title: @component_example.name,
|
28
|
+
},
|
29
|
+
]
|
30
30
|
end
|
31
31
|
|
32
32
|
def preview
|
@@ -22,6 +22,7 @@
|
|
22
22
|
error_id = "error-#{SecureRandom.hex(4)}"
|
23
23
|
search_icon ||= nil
|
24
24
|
heading_size = false unless ['s', 'm', 'l', 'xl'].include?(heading_size)
|
25
|
+
suffix ||= nil
|
25
26
|
|
26
27
|
css_classes = %w(gem-c-input govuk-input)
|
27
28
|
css_classes << "govuk-input--error" if has_error
|
@@ -72,22 +73,30 @@
|
|
72
73
|
} %>
|
73
74
|
<% end %>
|
74
75
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
76
|
+
<% input_tag = tag.input name: name,
|
77
|
+
value: value,
|
78
|
+
class: css_classes,
|
79
|
+
id: id,
|
80
|
+
type: type,
|
81
|
+
data: data,
|
82
|
+
autocomplete: autocomplete,
|
83
|
+
tabindex: tabindex,
|
84
|
+
autofocus: autofocus,
|
85
|
+
readonly: readonly,
|
86
|
+
maxlength: maxlength,
|
87
|
+
inputmode: inputmode,
|
88
|
+
pattern: pattern,
|
89
|
+
aria: {
|
90
|
+
describedby: aria_described_by,
|
91
|
+
controls: controls
|
92
|
+
}
|
92
93
|
%>
|
94
|
+
|
95
|
+
<% if suffix %>
|
96
|
+
<%= tag.div class: "gem-c-input__wrapper" do %>
|
97
|
+
<%= input_tag %><%= tag.span suffix, class: "gem-c-input__suffix", aria: { hidden: true } %>
|
98
|
+
<% end %>
|
99
|
+
<% else %>
|
100
|
+
<%= input_tag %>
|
101
|
+
<% end %>
|
93
102
|
<% end %>
|
@@ -132,3 +132,20 @@ examples:
|
|
132
132
|
text: "What is your name?"
|
133
133
|
name: "name"
|
134
134
|
heading_size: "l"
|
135
|
+
with_suffix:
|
136
|
+
description: To help users understand how the input should look like. Often used for units of measurement.
|
137
|
+
data:
|
138
|
+
label:
|
139
|
+
text: "Lead times in days"
|
140
|
+
name: "lead-times"
|
141
|
+
width: 10
|
142
|
+
suffix: "days"
|
143
|
+
with_suffix_and_error:
|
144
|
+
description: To help users understand how the input should look like. Often used for units of measurement.
|
145
|
+
data:
|
146
|
+
label:
|
147
|
+
text: "Lead times in days"
|
148
|
+
error_message: "Enter the approximate lead time in days, do not include words or symbols."
|
149
|
+
name: "lead-times"
|
150
|
+
width: 10
|
151
|
+
suffix: "days"
|
@@ -59,8 +59,8 @@ module GovukPublishingComponents
|
|
59
59
|
track_action: index,
|
60
60
|
track_label: path,
|
61
61
|
track_options: {
|
62
|
-
|
63
|
-
|
62
|
+
dimension28: breadcrumbs_length.to_s,
|
63
|
+
dimension29: crumb[:title],
|
64
64
|
},
|
65
65
|
}
|
66
66
|
|
@@ -80,7 +80,7 @@ module GovukPublishingComponents
|
|
80
80
|
return {} unless collection_pages("documents").any?
|
81
81
|
|
82
82
|
{
|
83
|
-
|
83
|
+
"hasPart" => collection_pages("documents").map { |document| HasPartSchema.new(document).structured_data },
|
84
84
|
}
|
85
85
|
end
|
86
86
|
|
@@ -101,7 +101,7 @@ module GovukPublishingComponents
|
|
101
101
|
return {} unless live_taxons.any?
|
102
102
|
|
103
103
|
{
|
104
|
-
|
104
|
+
"about" => linked_taxons,
|
105
105
|
}
|
106
106
|
end
|
107
107
|
|
@@ -115,9 +115,9 @@ module GovukPublishingComponents
|
|
115
115
|
def linked_taxons
|
116
116
|
live_taxons.map do |taxon|
|
117
117
|
{
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
"@context" => "http://schema.org",
|
119
|
+
"@type" => "Thing",
|
120
|
+
"sameAs" => taxon["web_url"],
|
121
121
|
}
|
122
122
|
end
|
123
123
|
end
|
@@ -8,9 +8,9 @@ module GovukPublishingComponents
|
|
8
8
|
def structured_data
|
9
9
|
# http://schema.org/isPartOf - minimal
|
10
10
|
{
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
"@context" => "http://schema.org",
|
12
|
+
"@type" => "CreativeWork",
|
13
|
+
"sameAs" => @is_part_of_url,
|
14
14
|
}
|
15
15
|
end
|
16
16
|
end
|
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.45.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: 2020-05-
|
11
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|