govuk-components 2.1.2 → 3.0.0b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/govuk_component/accordion_component/section_component.rb +1 -3
- data/app/components/govuk_component/back_link_component.rb +2 -2
- data/app/components/govuk_component/breadcrumbs_component.rb +5 -4
- data/app/components/govuk_component/cookie_banner_component/message_component.rb +1 -1
- data/app/components/govuk_component/cookie_banner_component.rb +7 -6
- data/app/components/govuk_component/details_component.rb +1 -1
- data/app/components/govuk_component/footer_component.html.erb +13 -4
- data/app/components/govuk_component/footer_component.rb +2 -1
- data/app/components/govuk_component/header_component.html.erb +15 -9
- data/app/components/govuk_component/header_component.rb +28 -10
- data/app/components/govuk_component/phase_banner_component.rb +1 -1
- data/app/components/govuk_component/tab_component.rb +1 -3
- data/app/components/govuk_component/table_component/caption_component.rb +1 -3
- data/app/components/govuk_component/table_component/cell_component.rb +3 -9
- data/app/components/govuk_component/warning_text_component.rb +4 -4
- data/lib/govuk/components/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9916c5fc5a9e7cc9929b62cb227c0a0b39fdf5cb5d3c9108fc95cb6184ce3ea8
|
4
|
+
data.tar.gz: 6b9da5d40f0966423d06e68c948cb71d8ead87335dbcb5ce4f8a9131bd8980a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d42827c400d5747af53352388f928d546919be9a74d88dcbcb657cbe12c8b7fb924c59df73bde3936760e4596cbacd62b23252a70b45574c3c27f216be0d5b55
|
7
|
+
data.tar.gz: ac8158fdd29aa936270a833ea3c351a6e8374dd932456610532b070fc70af4e8f1e0e22eff32a1c6d75dbdfa939269a1c9e297c52823c397bea1ea00c7fff858
|
@@ -34,8 +34,6 @@ class GovukComponent::AccordionComponent::SectionComponent < GovukComponent::Bas
|
|
34
34
|
private
|
35
35
|
|
36
36
|
def default_classes
|
37
|
-
|
38
|
-
classes.append("govuk-accordion__section--expanded") if expanded?
|
39
|
-
end
|
37
|
+
class_names("govuk-accordion__section", "govuk-accordion__section--expanded" => expanded?).split
|
40
38
|
end
|
41
39
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class GovukComponent::BackLinkComponent < GovukComponent::Base
|
2
2
|
attr_reader :text, :href
|
3
3
|
|
4
|
-
def initialize(href:, text:
|
4
|
+
def initialize(href:, text: 'Back', classes: nil, html_attributes: {})
|
5
5
|
super(classes: classes, html_attributes: html_attributes)
|
6
6
|
|
7
7
|
@text = text
|
@@ -15,7 +15,7 @@ class GovukComponent::BackLinkComponent < GovukComponent::Base
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def link_content
|
18
|
-
|
18
|
+
content || text || fail(ArgumentError, "no text or content")
|
19
19
|
end
|
20
20
|
|
21
21
|
def default_classes
|
@@ -12,10 +12,11 @@ class GovukComponent::BreadcrumbsComponent < GovukComponent::Base
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def default_classes
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
class_names(
|
16
|
+
"govuk-breadcrumbs",
|
17
|
+
"govuk-!-display-none-print" => hide_in_print,
|
18
|
+
"govuk-breadcrumbs--collapse-on-mobile" => collapse_on_mobile
|
19
|
+
).split
|
19
20
|
end
|
20
21
|
|
21
22
|
def build_list(breadcrumbs)
|
@@ -1,17 +1,18 @@
|
|
1
1
|
class GovukComponent::CookieBannerComponent < GovukComponent::Base
|
2
2
|
renders_many :messages, GovukComponent::CookieBannerComponent::MessageComponent
|
3
3
|
|
4
|
-
attr_accessor :aria_label, :hidden
|
4
|
+
attr_accessor :aria_label, :hidden, :hide_in_print
|
5
5
|
|
6
|
-
def initialize(aria_label: "Cookie banner", hidden: false, classes: [], html_attributes: {})
|
6
|
+
def initialize(aria_label: "Cookie banner", hidden: false, hide_in_print: true, classes: [], html_attributes: {})
|
7
7
|
super(classes: classes, html_attributes: html_attributes)
|
8
8
|
|
9
|
-
@aria_label
|
10
|
-
@hidden
|
9
|
+
@aria_label = aria_label
|
10
|
+
@hidden = hidden
|
11
|
+
@hide_in_print = hide_in_print
|
11
12
|
end
|
12
13
|
|
13
14
|
def call
|
14
|
-
tag.div(class: classes, role: "region", aria: { label: aria_label }, hidden: hidden, **html_attributes) do
|
15
|
+
tag.div(class: classes, role: "region", aria: { label: aria_label }, data: { nosnippet: true }, hidden: hidden, **html_attributes) do
|
15
16
|
safe_join(messages)
|
16
17
|
end
|
17
18
|
end
|
@@ -19,6 +20,6 @@ class GovukComponent::CookieBannerComponent < GovukComponent::Base
|
|
19
20
|
private
|
20
21
|
|
21
22
|
def default_classes
|
22
|
-
|
23
|
+
class_names("govuk-cookie-banner", "govuk-!-display-none-print" => hide_in_print).split
|
23
24
|
end
|
24
25
|
end
|
@@ -3,7 +3,7 @@ class GovukComponent::DetailsComponent < GovukComponent::Base
|
|
3
3
|
|
4
4
|
renders_one :summary_html
|
5
5
|
|
6
|
-
def initialize(summary_text
|
6
|
+
def initialize(summary_text: nil, text: nil, classes: [], id: nil, open: nil, html_attributes: {})
|
7
7
|
super(classes: classes, html_attributes: html_attributes)
|
8
8
|
|
9
9
|
@summary_text = summary_text
|
@@ -1,5 +1,13 @@
|
|
1
1
|
<%= tag.footer(class: classes, role: 'contentinfo', **html_attributes) do %>
|
2
2
|
<%= tag.div(class: container_classes, **container_html_attributes) do %>
|
3
|
+
<% if navigation.present? %>
|
4
|
+
<div class="govuk-footer__navigation">
|
5
|
+
<%= navigation %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<hr class="govuk-footer__section-break">
|
9
|
+
<% end %>
|
10
|
+
|
3
11
|
<%= tag.div(class: meta_classes, **meta_html_attributes) do %>
|
4
12
|
<% if meta.present? %>
|
5
13
|
<%= meta %>
|
@@ -28,12 +36,13 @@
|
|
28
36
|
<% end %>
|
29
37
|
|
30
38
|
<% if meta_content.present? %>
|
31
|
-
|
39
|
+
<div class="govuk-footer__meta-custom">
|
40
|
+
<%= meta_content %>
|
41
|
+
</div>
|
32
42
|
<% end %>
|
33
43
|
</div>
|
34
|
-
|
35
|
-
|
36
|
-
</div>
|
44
|
+
|
45
|
+
<%= tag.div(copyright, class: "govuk-footer__meta-item") %>
|
37
46
|
<% end %>
|
38
47
|
<% end %>
|
39
48
|
<% end %>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class GovukComponent::FooterComponent < GovukComponent::Base
|
2
2
|
renders_one :meta_html
|
3
3
|
renders_one :meta
|
4
|
+
renders_one :navigation
|
4
5
|
|
5
6
|
attr_reader :meta_items, :meta_text, :meta_items_title, :meta_licence, :copyright, :custom_container_classes
|
6
7
|
|
@@ -76,7 +77,7 @@ private
|
|
76
77
|
end
|
77
78
|
|
78
79
|
def default_copright_text
|
79
|
-
raw(%(
|
80
|
+
raw(%(© Crown copyright))
|
80
81
|
end
|
81
82
|
|
82
83
|
def default_copyright_url
|
@@ -7,11 +7,19 @@
|
|
7
7
|
<%= custom_logo %>
|
8
8
|
<% else %>
|
9
9
|
<% if crown %>
|
10
|
+
<!--[if gt IE 8]><!-->
|
10
11
|
<svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 132 97" height="30" width="36">
|
11
12
|
<path fill="currentColor" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.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.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
|
12
|
-
<image src="/assets/images/govuk-logotype-crown.png" xlink:href="" class="govuk-header__logotype-crown-fallback-image" width="36" height="32"></image>
|
13
13
|
</svg>
|
14
|
+
<!--<![endif]-->
|
14
15
|
<% end %>
|
16
|
+
|
17
|
+
<% if crown_fallback_image_path.present? %>
|
18
|
+
<!--[if IE 8]>
|
19
|
+
<%= image_tag(crown_fallback_image_path, **crown_fallback_image_attributes) %>
|
20
|
+
<![endif]-->
|
21
|
+
<% end %>
|
22
|
+
|
15
23
|
<%= tag.span(logotype, class: "govuk-header__logotype-text") %>
|
16
24
|
<% end %>
|
17
25
|
</span>
|
@@ -28,16 +36,14 @@
|
|
28
36
|
<% end %>
|
29
37
|
|
30
38
|
<% if navigation_items.any? %>
|
31
|
-
<%= tag.
|
32
|
-
|
33
|
-
|
39
|
+
<%= tag.nav(class: navigation_classes, aria: { label: navigation_label }) do %>
|
40
|
+
<%= tag.button("Menu", type: "button", class: %w(govuk-header__menu-button govuk-js-header-toggle), aria: { controls: "navigation", label: menu_button_label }) %>
|
41
|
+
<ul id="navigation" class="govuk-header__navigation-list">
|
34
42
|
<% navigation_items.each do |item| %>
|
35
|
-
<%=
|
36
|
-
<%= item %>
|
37
|
-
<% end %>
|
43
|
+
<%= item %>
|
38
44
|
<% end %>
|
39
|
-
|
40
|
-
|
45
|
+
</ul>
|
46
|
+
<% end %>
|
41
47
|
<% end %>
|
42
48
|
</div>
|
43
49
|
<% end %>
|
@@ -5,6 +5,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
5
5
|
|
6
6
|
attr_reader :logotype,
|
7
7
|
:crown,
|
8
|
+
:crown_fallback_image_path,
|
8
9
|
:homepage_url,
|
9
10
|
:service_name,
|
10
11
|
:service_url,
|
@@ -17,6 +18,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
17
18
|
html_attributes: {},
|
18
19
|
logotype: 'GOV.UK',
|
19
20
|
crown: true,
|
21
|
+
crown_fallback_image_path: nil,
|
20
22
|
homepage_url: '/',
|
21
23
|
menu_button_label: 'Show or hide navigation menu',
|
22
24
|
navigation_classes: [],
|
@@ -29,6 +31,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
29
31
|
|
30
32
|
@logotype = logotype
|
31
33
|
@crown = crown
|
34
|
+
@crown_fallback_image_path = crown_fallback_image_path
|
32
35
|
@homepage_url = homepage_url
|
33
36
|
@service_name = service_name
|
34
37
|
@service_url = service_url
|
@@ -52,6 +55,14 @@ private
|
|
52
55
|
combine_classes(%w(govuk-header__container govuk-width-container), custom_container_classes)
|
53
56
|
end
|
54
57
|
|
58
|
+
def crown_fallback_image_attributes
|
59
|
+
{
|
60
|
+
class: "govuk-header__logotype-crown-fallback-image",
|
61
|
+
width: "36",
|
62
|
+
height: "32",
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
55
66
|
class NavigationItem < GovukComponent::Base
|
56
67
|
attr_reader :text, :href, :options, :active
|
57
68
|
|
@@ -61,17 +72,16 @@ private
|
|
61
72
|
@text = text
|
62
73
|
@href = href
|
63
74
|
@options = options
|
64
|
-
@active = active
|
65
|
-
end
|
66
75
|
|
67
|
-
|
68
|
-
|
76
|
+
@active_override = active
|
77
|
+
end
|
69
78
|
|
70
|
-
|
79
|
+
def before_render
|
80
|
+
@active = active?(@active_override)
|
71
81
|
end
|
72
82
|
|
73
83
|
def active_class
|
74
|
-
%w(govuk-header__navigation-item--active) if active
|
84
|
+
%w(govuk-header__navigation-item--active) if @active
|
75
85
|
end
|
76
86
|
|
77
87
|
def link?
|
@@ -79,15 +89,23 @@ private
|
|
79
89
|
end
|
80
90
|
|
81
91
|
def call
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
92
|
+
tag.li(class: classes.append(active_class), **html_attributes) do
|
93
|
+
if link?
|
94
|
+
link_to(text, href, **options, class: "govuk-header__link")
|
95
|
+
else
|
96
|
+
text
|
97
|
+
end
|
86
98
|
end
|
87
99
|
end
|
88
100
|
|
89
101
|
private
|
90
102
|
|
103
|
+
def active?(active_override)
|
104
|
+
return current_page?(href) if active_override.nil?
|
105
|
+
|
106
|
+
active_override
|
107
|
+
end
|
108
|
+
|
91
109
|
def default_classes
|
92
110
|
%w(govuk-header__navigation-item)
|
93
111
|
end
|
@@ -9,7 +9,7 @@ class GovukComponent::PhaseBannerComponent < GovukComponent::Base
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def phase_tag_component
|
12
|
-
GovukComponent::TagComponent.new(classes: "govuk-phase-banner__content__tag"
|
12
|
+
GovukComponent::TagComponent.new(**phase_tag.deep_merge(classes: "govuk-phase-banner__content__tag"))
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
@@ -35,9 +35,7 @@ private
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def li_classes(i = nil)
|
38
|
-
|
39
|
-
c.append("govuk-tabs__list-item--selected") if i&.zero?
|
40
|
-
end
|
38
|
+
class_names("govuk-tabs__list-item", "govuk-tabs__list-item--selected" => i&.zero?).split
|
41
39
|
end
|
42
40
|
|
43
41
|
def li_link
|
@@ -37,19 +37,13 @@ private
|
|
37
37
|
|
38
38
|
def default_classes
|
39
39
|
if header
|
40
|
-
|
41
|
-
c << "govuk-table__header--numeric" if numeric?
|
42
|
-
c << width_class if width?
|
43
|
-
end
|
40
|
+
class_names("govuk-table__header", "govuk-table__header--numeric" => numeric?, width_class => width?).split
|
44
41
|
else
|
45
|
-
|
46
|
-
c << "govuk-table__cell--numeric" if numeric?
|
47
|
-
c << width_class if width?
|
48
|
-
end
|
42
|
+
class_names("govuk-table__cell", "govuk-table__cell--numeric" => numeric?, width_class => width?).split
|
49
43
|
end
|
50
44
|
end
|
51
45
|
|
52
46
|
def width_class
|
53
|
-
WIDTHS.fetch(width)
|
47
|
+
WIDTHS.fetch(width, nil)
|
54
48
|
end
|
55
49
|
end
|
@@ -3,7 +3,7 @@ class GovukComponent::WarningTextComponent < GovukComponent::Base
|
|
3
3
|
|
4
4
|
ICON = '!'.freeze
|
5
5
|
|
6
|
-
def initialize(text
|
6
|
+
def initialize(text: nil, icon_fallback_text: 'Warning', classes: [], html_attributes: {})
|
7
7
|
super(classes: classes, html_attributes: html_attributes)
|
8
8
|
|
9
9
|
@text = text
|
@@ -12,7 +12,7 @@ class GovukComponent::WarningTextComponent < GovukComponent::Base
|
|
12
12
|
|
13
13
|
def call
|
14
14
|
tag.div(class: classes, **html_attributes) do
|
15
|
-
safe_join([icon,
|
15
|
+
safe_join([icon, warning_text])
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -22,9 +22,9 @@ private
|
|
22
22
|
tag.span(ICON, class: 'govuk-warning-text__icon', aria: { hidden: true })
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def warning_text
|
26
26
|
tag.strong(class: 'govuk-warning-text__text') do
|
27
|
-
safe_join([assistive, text])
|
27
|
+
safe_join([assistive, (content || text)])
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk-components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0b1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DfE developers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -220,7 +220,7 @@ homepage: https://github.com/DFE-Digital/govuk-components
|
|
220
220
|
licenses:
|
221
221
|
- MIT
|
222
222
|
metadata: {}
|
223
|
-
post_install_message:
|
223
|
+
post_install_message:
|
224
224
|
rdoc_options: []
|
225
225
|
require_paths:
|
226
226
|
- lib
|
@@ -231,12 +231,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: '0'
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - ">"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 1.3.1
|
237
237
|
requirements: []
|
238
|
-
rubygems_version: 3.
|
239
|
-
signing_key:
|
238
|
+
rubygems_version: 3.2.3
|
239
|
+
signing_key:
|
240
240
|
specification_version: 4
|
241
241
|
summary: Lightweight set of reusable GOV.UK Design System components
|
242
242
|
test_files: []
|