govuk_publishing_components 21.60.2 → 21.63.1
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/checkboxes.js +102 -73
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +402 -340
- data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -5
- data/app/assets/javascripts/govuk_publishing_components/ie.js +2 -0
- data/app/assets/javascripts/govuk_publishing_components/lib.js +1 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +126 -65
- data/app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js +4 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/json2.js +487 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js +23 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js +9 -0
- data/app/assets/stylesheets/component_guide/application.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss +3 -16
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +8 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +87 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_panel.scss +7 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +46 -0
- data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +8 -0
- data/app/models/govuk_publishing_components/component_example.rb +4 -0
- data/app/views/govuk_publishing_components/component_guide/component_doc/_component.html.erb +1 -0
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +4 -1
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_document_list.html.erb +18 -9
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +32 -21
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +76 -0
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +39 -51
- data/app/views/govuk_publishing_components/components/_panel.html.erb +13 -11
- data/app/views/govuk_publishing_components/components/_search.html.erb +10 -5
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +9 -9
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +18 -0
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +5 -1
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +29 -0
- data/app/views/govuk_publishing_components/components/docs/layout_header.yml +34 -0
- data/app/views/govuk_publishing_components/components/docs/search.yml +6 -0
- data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +6 -6
- data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +6 -6
- data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +8 -10
- data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +23 -0
- data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +17 -0
- data/app/views/govuk_publishing_components/components/layout_header/_search.html.erb +9 -0
- data/config/initializers/assets.rb +8 -0
- data/config/locales/en.yml +18 -0
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +5 -0
- data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +1 -0
- data/lib/govuk_publishing_components/presenters/image_card_helper.rb +1 -1
- data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +380 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +0 -4
- data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +33 -33
- data/node_modules/govuk-frontend/package.json +1 -1
- metadata +14 -2
@@ -0,0 +1,23 @@
|
|
1
|
+
// https://plainjs.com/javascript/traversing/get-closest-element-by-selector-39/
|
2
|
+
// matches polyfill
|
3
|
+
this.Element && function(ElementPrototype) {
|
4
|
+
ElementPrototype.matches = ElementPrototype.matches ||
|
5
|
+
ElementPrototype.matchesSelector ||
|
6
|
+
ElementPrototype.webkitMatchesSelector ||
|
7
|
+
ElementPrototype.msMatchesSelector ||
|
8
|
+
function(selector) {
|
9
|
+
var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1;
|
10
|
+
while (nodes[++i] && nodes[i] != node);
|
11
|
+
return !!nodes[i];
|
12
|
+
}
|
13
|
+
}(Element.prototype);
|
14
|
+
|
15
|
+
// closest polyfill
|
16
|
+
this.Element && function(ElementPrototype) {
|
17
|
+
ElementPrototype.closest = ElementPrototype.closest ||
|
18
|
+
function(selector) {
|
19
|
+
var el = this;
|
20
|
+
while (el.matches && !el.matches(selector)) el = el.parentNode;
|
21
|
+
return el.matches ? el : null;
|
22
|
+
}
|
23
|
+
}(Element.prototype);
|
@@ -44,6 +44,7 @@
|
|
44
44
|
@import "components/label";
|
45
45
|
@import "components/layout-footer";
|
46
46
|
@import "components/layout-for-admin";
|
47
|
+
@import "components/layout-for-public";
|
47
48
|
@import "components/layout-header";
|
48
49
|
@import "components/lead-paragraph";
|
49
50
|
@import "components/metadata";
|
@@ -21,37 +21,24 @@
|
|
21
21
|
border-color: govuk-colour("white");
|
22
22
|
}
|
23
23
|
|
24
|
-
.
|
24
|
+
.govuk-breadcrumbs--collapse-on-mobile {
|
25
25
|
@include govuk-media-query($until: tablet) {
|
26
|
-
.govuk-breadcrumbs__list {
|
27
|
-
display: flex;
|
28
|
-
}
|
29
|
-
|
30
|
-
.govuk-breadcrumbs__list-item:not(:last-child):not(:first-child) {
|
31
|
-
display: none;
|
32
|
-
}
|
33
|
-
|
34
26
|
.govuk-breadcrumbs__list-item {
|
35
27
|
padding-top: 14px;
|
36
28
|
padding-bottom: 14px;
|
37
29
|
}
|
38
30
|
|
39
31
|
.govuk-breadcrumbs__list-item:before {
|
40
|
-
margin: 0;
|
41
32
|
top: 18px;
|
42
33
|
}
|
43
34
|
|
44
|
-
.govuk-breadcrumbs__link {
|
45
|
-
position: relative;
|
46
|
-
}
|
47
|
-
|
48
35
|
.govuk-breadcrumbs__link:after {
|
49
36
|
content: "";
|
50
37
|
position: absolute;
|
51
|
-
top:
|
38
|
+
top: 0;
|
52
39
|
right: 0;
|
53
40
|
left: 0;
|
54
|
-
bottom:
|
41
|
+
bottom: 0;
|
55
42
|
}
|
56
43
|
}
|
57
44
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@import "govuk_publishing_components/components/search";
|
2
|
+
@import "govuk_publishing_components/components/skip-link";
|
1
3
|
@import "govuk/components/header/header";
|
2
4
|
@import "govuk/components/tag/tag";
|
3
5
|
|
@@ -18,8 +20,80 @@
|
|
18
20
|
border-bottom-color: govuk-colour("dark-grey", $legacy: "grey-1");
|
19
21
|
}
|
20
22
|
|
23
|
+
.gem-c-layout-header--no-bottom-border,
|
24
|
+
.gem-c-layout-header--no-bottom-border .govuk-header__container {
|
25
|
+
margin-bottom: 0;
|
26
|
+
border-bottom: 0;
|
27
|
+
|
28
|
+
@include govuk-media-query($until: tablet) {
|
29
|
+
padding-bottom: govuk-spacing(1);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
.gem-c-layout-header--search-left {
|
34
|
+
.gem-c-header__menu-button {
|
35
|
+
margin-top: - govuk-spacing(7);
|
36
|
+
left: 0;
|
37
|
+
}
|
38
|
+
|
39
|
+
.gem-c-header__nav-wrapper {
|
40
|
+
position: relative;
|
41
|
+
padding-left: 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
.govuk-header__navigation--end {
|
45
|
+
padding-top: 0;
|
46
|
+
text-align: left;
|
47
|
+
}
|
48
|
+
|
49
|
+
.gem-c-layout-header__search {
|
50
|
+
margin-bottom: govuk-spacing(2);
|
51
|
+
padding-bottom: govuk-spacing(5);
|
52
|
+
}
|
53
|
+
|
54
|
+
.gem-c-header__content {
|
55
|
+
position: relative;
|
56
|
+
width: 100%;
|
57
|
+
padding-bottom: govuk-spacing(2);
|
58
|
+
}
|
59
|
+
|
60
|
+
@include govuk-media-query($from: desktop) {
|
61
|
+
.gem-c-layout-header__search {
|
62
|
+
padding-bottom: govuk-spacing(1);
|
63
|
+
}
|
64
|
+
|
65
|
+
.govuk-header__navigation-item {
|
66
|
+
padding: 0 0 govuk-spacing(1) 0;
|
67
|
+
}
|
68
|
+
|
69
|
+
.gem-c-header__logo {
|
70
|
+
margin-top: 0;
|
71
|
+
}
|
72
|
+
|
73
|
+
.gem-c-header__content {
|
74
|
+
@include govuk-grid-column(two-thirds);
|
75
|
+
padding-left: govuk-spacing(6);
|
76
|
+
padding-right: govuk-spacing(1);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
.gem-c-layout-header__logo,
|
82
|
+
.gem-c-layout-header__search {
|
83
|
+
padding: 0;
|
84
|
+
|
85
|
+
@include govuk-media-query($until: "tablet") {
|
86
|
+
margin-bottom: govuk-spacing(3);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
21
90
|
.gem-c-header__logo {
|
22
|
-
|
91
|
+
margin-top: govuk-spacing(1);
|
92
|
+
margin-bottom: govuk-spacing(3);
|
93
|
+
|
94
|
+
@include govuk-media-query($from: desktop) {
|
95
|
+
white-space: nowrap;
|
96
|
+
}
|
23
97
|
}
|
24
98
|
|
25
99
|
.gem-c-header__content {
|
@@ -68,3 +142,15 @@
|
|
68
142
|
display: none;
|
69
143
|
}
|
70
144
|
}
|
145
|
+
|
146
|
+
.gem-c-layout-header__search-form {
|
147
|
+
display: none;
|
148
|
+
|
149
|
+
&.js-visible {
|
150
|
+
display: block;
|
151
|
+
}
|
152
|
+
|
153
|
+
@include govuk-media-query($from: tablet) {
|
154
|
+
display: block;
|
155
|
+
}
|
156
|
+
}
|
@@ -9,6 +9,12 @@
|
|
9
9
|
@include govuk-font($size: 24, $weight: bold);
|
10
10
|
}
|
11
11
|
|
12
|
-
.gem-c-panel__prepend ~ .govuk-panel__title {
|
12
|
+
.gem-c-panel__prepend ~ .govuk-panel__title-text {
|
13
13
|
margin-bottom: govuk-spacing(3);
|
14
14
|
}
|
15
|
+
|
16
|
+
.gem-c-panel__append,
|
17
|
+
.gem-c-panel__prepend,
|
18
|
+
.govuk-panel__title-text {
|
19
|
+
display: block;
|
20
|
+
}
|
@@ -179,6 +179,12 @@ $large-input-size: 50px;
|
|
179
179
|
}
|
180
180
|
}
|
181
181
|
|
182
|
+
.gem-c-search--no-border {
|
183
|
+
.gem-c-search__input[type="search"] {
|
184
|
+
border: 0;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
182
188
|
.gem-c-search--large {
|
183
189
|
.gem-c-search__label {
|
184
190
|
@include govuk-font($size: 19, $line-height: $large-input-size);
|
@@ -208,3 +214,43 @@ $large-input-size: 50px;
|
|
208
214
|
padding-left: 0;
|
209
215
|
}
|
210
216
|
}
|
217
|
+
|
218
|
+
.search-toggle {
|
219
|
+
background-color: govuk-colour("blue");
|
220
|
+
background-image: image-url("govuk_publishing_components/search-button.png");
|
221
|
+
background-position: 0 50%;
|
222
|
+
background-repeat: no-repeat;
|
223
|
+
display: block;
|
224
|
+
float: right;
|
225
|
+
height: 30px;
|
226
|
+
margin: -46px 0;
|
227
|
+
overflow: hidden;
|
228
|
+
padding: 0;
|
229
|
+
text-indent: -5000px;
|
230
|
+
width: 36px;
|
231
|
+
|
232
|
+
&:focus {
|
233
|
+
border-width: 0;
|
234
|
+
box-shadow: inset 0 0 0 4px $govuk-input-border-colour;
|
235
|
+
outline: $govuk-focus-width solid $govuk-focus-colour;
|
236
|
+
outline-offset: 0;
|
237
|
+
}
|
238
|
+
|
239
|
+
&:focus,
|
240
|
+
&:hover {
|
241
|
+
background-color: lighten(govuk-colour("blue"), 5%);
|
242
|
+
}
|
243
|
+
|
244
|
+
&.js-hidden {
|
245
|
+
display: none;
|
246
|
+
}
|
247
|
+
|
248
|
+
@include govuk-device-pixel-ratio {
|
249
|
+
background-size: 52.5px 35px;
|
250
|
+
background-position: 100% 50%;
|
251
|
+
}
|
252
|
+
|
253
|
+
@include govuk-media-query($from: tablet) {
|
254
|
+
display: none;
|
255
|
+
}
|
256
|
+
}
|
data/app/views/govuk_publishing_components/component_guide/component_doc/_component.html.erb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
<div class="component-guide-preview
|
2
2
|
<% if example.right_to_left? %>direction-rtl<% end %>
|
3
3
|
<% if example.dark_background? %>dark-background<% end %>
|
4
|
+
<% if example.black_background? %>black-background<% end %>
|
4
5
|
<% if preview_page %>component-guide-preview--simple<% end %>" data-content="EXAMPLE">
|
5
6
|
<%= render "govuk_publishing_components/component_guide/component_doc/component_output", example: example, component_doc: component_doc %>
|
6
7
|
</div>
|
@@ -12,7 +12,10 @@
|
|
12
12
|
<div class="component-markdown">
|
13
13
|
<%= raw(@component_example.html_description) %>
|
14
14
|
</div>
|
15
|
-
<h2 class="component-doc-h2">
|
15
|
+
<h2 class="component-doc-h2">
|
16
|
+
How it looks
|
17
|
+
<small>(<a href="<%= component_preview_path(@component_doc.id, @component_example.id) %>" class="govuk-link">preview</a>)</small>
|
18
|
+
</h2>
|
16
19
|
<%= render partial: "govuk_publishing_components/component_guide/component_doc/preview", locals: { component_doc: @component_doc, example: @component_example } %>
|
17
20
|
|
18
21
|
<h2 class="component-doc-h2">How to call this example</h2>
|
@@ -29,7 +29,9 @@
|
|
29
29
|
</div>
|
30
30
|
</div>
|
31
31
|
|
32
|
-
<h2 class="component-doc-h2">
|
32
|
+
<h2 class="component-doc-h2">
|
33
|
+
<a href="<%= component_example_path(@component_doc.id, "default") %>" class="govuk-link">How it looks</a>
|
34
|
+
<small>(<a href="<%= component_preview_path(@component_doc.id, "default") %>" class="govuk-link">preview</a>)</small>
|
33
35
|
<small>(<a href="<%= component_preview_all_path(@component_doc.id) %>" class="govuk-link">preview all</a>)</small>
|
34
36
|
</h2>
|
35
37
|
<%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, example: @component_doc.example %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs)
|
6
6
|
|
7
7
|
classes = "gem-c-breadcrumbs govuk-breadcrumbs"
|
8
|
-
classes << "
|
8
|
+
classes << " govuk-breadcrumbs--collapse-on-mobile" if collapse_on_mobile
|
9
9
|
classes << " gem-c-breadcrumbs--inverse" if inverse
|
10
10
|
%>
|
11
11
|
|
@@ -66,7 +66,7 @@
|
|
66
66
|
</div>
|
67
67
|
|
68
68
|
<div class="gem-c-cookie-banner__confirmation govuk-width-container" tabindex="-1">
|
69
|
-
<p class="gem-c-cookie-banner__confirmation-message"><%= confirmation_message %></p>
|
69
|
+
<p class="gem-c-cookie-banner__confirmation-message" role="alert"><%= confirmation_message %></p>
|
70
70
|
<button class="gem-c-cookie-banner__hide-button" data-hide-cookie-banner="true" data-module="track-click" data-track-category="cookieBanner" data-track-action="Hide cookie banner">Hide</button>
|
71
71
|
</div>
|
72
72
|
</div>
|
@@ -33,6 +33,7 @@
|
|
33
33
|
item[:link][:path],
|
34
34
|
data: item[:link][:data_attributes],
|
35
35
|
class: "#{item_classes} gem-c-document-list__item-link",
|
36
|
+
lang: item[:link][:locale].presence
|
36
37
|
)
|
37
38
|
else
|
38
39
|
content_tag(
|
@@ -54,16 +55,24 @@
|
|
54
55
|
|
55
56
|
<% if item[:metadata] %>
|
56
57
|
<ul class="gem-c-document-list__item-metadata">
|
57
|
-
<% item[:metadata].compact.each do |item_metadata_key, item_metadata_value| %>
|
58
|
-
|
59
|
-
<%
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
<% item[:metadata].compact.each do |item_metadata_key, item_metadata_value| %>
|
59
|
+
<% if !item_metadata_key.to_s.eql?("locale") %>
|
60
|
+
<% lang = item[:metadata][:locale].present? && item[:metadata][:locale][item_metadata_key].present? ? item[:metadata][:locale][item_metadata_key] : nil %>
|
61
|
+
|
62
|
+
<%= content_tag(
|
63
|
+
:li, item_metadata_value,
|
64
|
+
class: "gem-c-document-list__attribute",
|
65
|
+
lang: lang
|
66
|
+
) do %>
|
67
|
+
<% if item_metadata_key.to_s.eql?("public_updated_at") %>
|
68
|
+
<time datetime="<%= item_metadata_value.iso8601 %>">
|
69
|
+
<%= l(item_metadata_value, format: '%e %B %Y') %>
|
70
|
+
</time>
|
71
|
+
<% else %>
|
72
|
+
<%= item_metadata_value %>
|
73
|
+
<% end %>
|
65
74
|
<% end %>
|
66
|
-
|
75
|
+
<% end %>
|
67
76
|
<% end %>
|
68
77
|
</ul>
|
69
78
|
<% end %>
|
@@ -1,36 +1,47 @@
|
|
1
1
|
<%
|
2
2
|
meta ||= []
|
3
3
|
navigation ||= []
|
4
|
+
with_border ||= false
|
4
5
|
%>
|
5
|
-
<footer class="gem-c-layout-footer govuk-footer" role="contentinfo">
|
6
|
+
<footer class="gem-c-layout-footer govuk-footer <%= "gem-c-layout-footer--border" if with_border %> role="contentinfo">
|
6
7
|
<div class="govuk-width-container ">
|
7
8
|
<% if navigation.any? %>
|
8
9
|
<div class="govuk-footer__navigation">
|
9
10
|
<% navigation.each do |item| %>
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
11
|
+
<% if item[:items] %>
|
12
|
+
<%
|
13
|
+
case item[:columns]
|
14
|
+
when 2
|
15
|
+
width_class = "govuk-grid-column-two-thirds"
|
16
|
+
when 3
|
17
|
+
width_class = "govuk-grid-column-full"
|
18
|
+
else
|
19
|
+
width_class = "govuk-grid-column-one-third"
|
20
|
+
end
|
21
|
+
|
22
|
+
list_classes = %w( govuk-footer__list )
|
23
|
+
list_classes << "govuk-footer__list--columns-#{item[:columns]}" if item[:columns]
|
24
|
+
%>
|
25
|
+
<div class="<%= width_class %>">
|
26
|
+
<h2 class="govuk-footer__heading govuk-heading-m"><%= item[:title] %></h2>
|
27
|
+
<ul class="<%= list_classes.join(' ') %>">
|
28
|
+
<% item[:items].each do |item| %>
|
29
|
+
<% if item[:href] && item[:text] %>
|
30
|
+
<li class="govuk-footer__list-item">
|
31
|
+
<%
|
32
|
+
attributes = { class: "govuk-footer__link" }.merge(item.fetch(:attributes, {}))
|
33
|
+
attributes[:rel] = "noopener" if attributes[:target] == "_blank" && !attributes[:rel]
|
34
|
+
%>
|
35
|
+
<%= link_to item[:text], item[:href], attributes %>
|
36
|
+
</li>
|
37
|
+
<% end %>
|
27
38
|
<% end %>
|
28
|
-
|
29
|
-
|
39
|
+
</ul>
|
40
|
+
</div>
|
30
41
|
<% end %>
|
31
|
-
</div>
|
32
42
|
<% end %>
|
33
43
|
</div>
|
44
|
+
|
34
45
|
<hr class="govuk-footer__section-break">
|
35
46
|
<% end %>
|
36
47
|
<div class="govuk-footer__meta">
|