govuk-components 5.0.2 → 5.1.0b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/components/govuk_component/accordion_component/section_component.html.erb +1 -1
- data/app/components/govuk_component/accordion_component/section_component.rb +1 -1
- data/app/components/govuk_component/accordion_component.rb +12 -8
- data/app/components/govuk_component/back_link_component.rb +1 -1
- data/app/components/govuk_component/breadcrumbs_component.rb +1 -1
- data/app/components/govuk_component/cookie_banner_component/message_component.rb +2 -2
- data/app/components/govuk_component/cookie_banner_component.rb +2 -2
- data/app/components/govuk_component/details_component.rb +2 -2
- data/app/components/govuk_component/exit_this_page_component.rb +1 -1
- data/app/components/govuk_component/footer_component.rb +1 -1
- data/app/components/govuk_component/header_component.html.erb +4 -4
- data/app/components/govuk_component/header_component.rb +3 -3
- data/app/components/govuk_component/inset_text_component.rb +2 -2
- data/app/components/govuk_component/notification_banner_component.rb +3 -3
- data/app/components/govuk_component/pagination_component/adjacent_page.rb +2 -2
- data/app/components/govuk_component/pagination_component/item.rb +2 -2
- data/app/components/govuk_component/pagination_component/next_page.rb +6 -6
- data/app/components/govuk_component/pagination_component/previous_page.rb +6 -6
- data/app/components/govuk_component/pagination_component.rb +11 -11
- data/app/components/govuk_component/panel_component.rb +2 -2
- data/app/components/govuk_component/phase_banner_component.rb +1 -1
- data/app/components/govuk_component/section_break_component.rb +1 -1
- data/app/components/govuk_component/start_button_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/action_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/card_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/key_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component/row_component.rb +7 -7
- data/app/components/govuk_component/summary_list_component/value_component.rb +1 -1
- data/app/components/govuk_component/summary_list_component.rb +3 -3
- data/app/components/govuk_component/tab_component.rb +4 -4
- data/app/components/govuk_component/table_component/body_component.rb +6 -6
- data/app/components/govuk_component/table_component/caption_component.rb +1 -1
- data/app/components/govuk_component/table_component/cell_component.rb +3 -3
- data/app/components/govuk_component/table_component/col_group_component.rb +3 -3
- data/app/components/govuk_component/table_component/foot_component.rb +6 -6
- data/app/components/govuk_component/table_component/head_component.rb +4 -4
- data/app/components/govuk_component/table_component/row_component.rb +11 -11
- data/app/components/govuk_component/table_component.rb +4 -4
- data/app/components/govuk_component/tag_component.rb +1 -1
- data/app/components/govuk_component/task_list_component/item_component.rb +13 -13
- data/app/components/govuk_component/task_list_component/status_component.rb +3 -3
- data/app/components/govuk_component/task_list_component/title_component.rb +4 -4
- data/app/components/govuk_component/task_list_component.rb +8 -8
- data/app/components/govuk_component/warning_text_component.rb +1 -1
- data/app/helpers/govuk_link_helper.rb +53 -29
- data/app/helpers/govuk_visually_hidden_helper.rb +7 -1
- data/lib/govuk/components/version.rb +1 -1
- metadata +11 -12
- data/app/components/govuk_component/accordion_component.html.erb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff596addf43a14a5560a8ca78f557212b5c3f2cfcb31fa67b06ea8d67a8ff3de
|
4
|
+
data.tar.gz: 18de7df9094473d62d705d29cd729a8aec2d4d077d30d5dc05162c62c26fa0fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9c21f6ab9ffc2f992aa5d328d6506332ad0f7eeeec079ec1b8b6675bb97e4e2376c3085b2efa5da919f007a3bfdfbc95fab3f12b8a1d0596890e372cd66303b
|
7
|
+
data.tar.gz: be1a8f07e109b1c018eeb6bb577b38f0e7e42481573797c6819599f1db8c08acb99638f11ae76808d21fdf59227f0c2ea8bd514fa13e356200b1f34ead174f79
|
data/README.md
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
[![Gem](https://img.shields.io/gem/dt/govuk-components?logo=rubygems)](https://rubygems.org/gems/govuk-components)
|
7
7
|
[![Test coverage](https://api.codeclimate.com/v1/badges/cbcbc140f300b920d833/test_coverage)](https://codeclimate.com/github/x-govuk/govuk-components/test_coverage)
|
8
8
|
[![Licence](https://img.shields.io/github/license/x-govuk/govuk-components)](https://github.com/x-govuk/govuk-components/blob/main/LICENSE.txt)
|
9
|
-
[![GOV.UK Design System version](https://img.shields.io/badge/GOV.UK%20Design%20System-5.
|
9
|
+
[![GOV.UK Design System version](https://img.shields.io/badge/GOV.UK%20Design%20System-5.1.0-brightgreen)](https://design-system.service.gov.uk)
|
10
10
|
[![ViewComponent](https://img.shields.io/badge/ViewComponent-3.3.0-brightgreen)](https://viewcomponent.org/)
|
11
11
|
[![Rails](https://img.shields.io/badge/Rails-7.0.8%20%E2%95%B1%207.1.0-E16D6D)](https://weblog.rubyonrails.org/releases/)
|
12
|
-
[![Ruby](https://img.shields.io/badge/Ruby-3.
|
12
|
+
[![Ruby](https://img.shields.io/badge/Ruby-3.1.4%20%20%E2%95%B1%203.2.2%20%20%E2%95%B1%203.3.0-E16D6D)](https://www.ruby-lang.org/en/downloads/)
|
13
13
|
|
14
14
|
This gem provides a suite of reusable components for the [GOV.UK Design System](https://design-system.service.gov.uk/). It is intended to provide a lightweight alternative to the [GOV.UK Publishing Components](https://github.com/alphagov/govuk_publishing_components) library and is built with GitHub’s [ViewComponent](https://github.com/github/view_component) framework.
|
15
15
|
|
@@ -7,5 +7,5 @@
|
|
7
7
|
<%= tag.div(summary_content, id: id(suffix: 'summary'), class: "#{brand}-accordion__section-summary #{brand}-body") %>
|
8
8
|
<% end %>
|
9
9
|
</div>
|
10
|
-
<%= tag.div(content, id: id(suffix: 'content'), class: "#{brand}-accordion__section-content"
|
10
|
+
<%= tag.div(content, id: id(suffix: 'content'), class: "#{brand}-accordion__section-content") %>
|
11
11
|
<% end %>
|
@@ -13,7 +13,7 @@ class GovukComponent::AccordionComponent::SectionComponent < GovukComponent::Bas
|
|
13
13
|
@heading_level = heading_level
|
14
14
|
@accordion_id = accordion_id
|
15
15
|
|
16
|
-
super(classes
|
16
|
+
super(classes:, html_attributes:)
|
17
17
|
end
|
18
18
|
|
19
19
|
def id(suffix: nil)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class GovukComponent::AccordionComponent < GovukComponent::Base
|
2
2
|
renders_many :sections, ->(heading_text: nil, summary_text: nil, expanded: false, classes: [], html_attributes: {}, &block) do
|
3
3
|
GovukComponent::AccordionComponent::SectionComponent.new(
|
4
|
-
classes
|
5
|
-
expanded
|
6
|
-
heading_level
|
7
|
-
html_attributes
|
8
|
-
summary_text
|
9
|
-
heading_text
|
10
|
-
accordion_id
|
4
|
+
classes:,
|
5
|
+
expanded:,
|
6
|
+
heading_level:, # set once at parent level, passed to all children
|
7
|
+
html_attributes:,
|
8
|
+
summary_text:,
|
9
|
+
heading_text:,
|
10
|
+
accordion_id:,
|
11
11
|
&block
|
12
12
|
)
|
13
13
|
end
|
@@ -18,7 +18,11 @@ class GovukComponent::AccordionComponent < GovukComponent::Base
|
|
18
18
|
@heading_level = heading_tag(heading_level)
|
19
19
|
@accordion_id = html_attributes[:id]
|
20
20
|
|
21
|
-
super(classes
|
21
|
+
super(classes:, html_attributes:)
|
22
|
+
end
|
23
|
+
|
24
|
+
def call
|
25
|
+
tag.div(**html_attributes) { safe_join(sections) }
|
22
26
|
end
|
23
27
|
|
24
28
|
private
|
@@ -10,11 +10,11 @@ class GovukComponent::CookieBannerComponent::MessageComponent < GovukComponent::
|
|
10
10
|
@hidden = hidden
|
11
11
|
@role = role
|
12
12
|
|
13
|
-
super(classes
|
13
|
+
super(classes:, html_attributes:)
|
14
14
|
end
|
15
15
|
|
16
16
|
def call
|
17
|
-
tag.div(role
|
17
|
+
tag.div(role:, hidden:, **html_attributes) do
|
18
18
|
safe_join([
|
19
19
|
tag.div(class: "#{brand}-grid-row") do
|
20
20
|
tag.div(class: "#{brand}-grid-column-two-thirds") { safe_join([heading_element, message_element]) }
|
@@ -15,11 +15,11 @@ module GovukComponent
|
|
15
15
|
@hidden = hidden
|
16
16
|
@hide_in_print = hide_in_print
|
17
17
|
|
18
|
-
super(classes
|
18
|
+
super(classes:, html_attributes:)
|
19
19
|
end
|
20
20
|
|
21
21
|
def call
|
22
|
-
tag.div(role: "region", aria: { label: aria_label }, data: { nosnippet: true }, hidden
|
22
|
+
tag.div(role: "region", aria: { label: aria_label }, data: { nosnippet: true }, hidden:, **html_attributes) do
|
23
23
|
safe_join(messages)
|
24
24
|
end
|
25
25
|
end
|
@@ -9,11 +9,11 @@ class GovukComponent::DetailsComponent < GovukComponent::Base
|
|
9
9
|
@id = id
|
10
10
|
@open = open
|
11
11
|
|
12
|
-
super(classes
|
12
|
+
super(classes:, html_attributes:)
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
|
-
tag.details(id
|
16
|
+
tag.details(id:, open:, **html_attributes) do
|
17
17
|
safe_join([summary, description])
|
18
18
|
end
|
19
19
|
end
|
@@ -21,7 +21,7 @@ class GovukComponent::ExitThisPageComponent < GovukComponent::Base
|
|
21
21
|
@press_two_more_times_text = press_two_more_times_text
|
22
22
|
@press_one_more_time_text = press_one_more_time_text
|
23
23
|
|
24
|
-
super(classes
|
24
|
+
super(classes:, html_attributes:)
|
25
25
|
end
|
26
26
|
|
27
27
|
def call
|
@@ -31,7 +31,7 @@ class GovukComponent::FooterComponent < GovukComponent::Base
|
|
31
31
|
@custom_container_classes = container_classes
|
32
32
|
@custom_container_html_attributes = container_html_attributes
|
33
33
|
|
34
|
-
super(classes
|
34
|
+
super(classes:, html_attributes:)
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
@@ -10,13 +10,13 @@
|
|
10
10
|
role="img"
|
11
11
|
class="<%= brand %>-header__logotype"
|
12
12
|
xmlns="http://www.w3.org/2000/svg"
|
13
|
-
viewBox="0 0
|
13
|
+
viewBox="0 0 148 30"
|
14
14
|
height="30"
|
15
|
-
width="
|
15
|
+
width="148"
|
16
16
|
aria-label="GOV.UK"
|
17
17
|
>
|
18
|
-
|
19
|
-
|
18
|
+
<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h4.2v9.1l7.4-9.1h5.2l-7.2 8.4L148 28h-4.9l-5.5-9.4-2.7 3V28h-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z"></path>
|
20
20
|
</svg>
|
21
21
|
<% end %>
|
22
22
|
<% if product_name.present? %>
|
@@ -29,7 +29,7 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
|
|
29
29
|
@navigation_label = navigation_label
|
30
30
|
@custom_container_classes = container_classes
|
31
31
|
|
32
|
-
super(classes
|
32
|
+
super(classes:, html_attributes:)
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
@@ -57,7 +57,7 @@ private
|
|
57
57
|
@options = options
|
58
58
|
@active_override = active
|
59
59
|
|
60
|
-
super(classes
|
60
|
+
super(classes:, html_attributes:)
|
61
61
|
end
|
62
62
|
|
63
63
|
def before_render
|
@@ -104,7 +104,7 @@ private
|
|
104
104
|
def initialize(name: nil, html_attributes: {}, classes: [])
|
105
105
|
@name = name
|
106
106
|
|
107
|
-
super(classes
|
107
|
+
super(classes:, html_attributes:)
|
108
108
|
end
|
109
109
|
|
110
110
|
def render?
|
@@ -5,11 +5,11 @@ class GovukComponent::InsetTextComponent < GovukComponent::Base
|
|
5
5
|
@text = text
|
6
6
|
@id = id
|
7
7
|
|
8
|
-
super(classes
|
8
|
+
super(classes:, html_attributes:)
|
9
9
|
end
|
10
10
|
|
11
11
|
def call
|
12
|
-
tag.div(id
|
12
|
+
tag.div(id:, **html_attributes) { inset_text_content }
|
13
13
|
end
|
14
14
|
|
15
15
|
def render?
|
@@ -23,7 +23,7 @@ class GovukComponent::NotificationBannerComponent < GovukComponent::Base
|
|
23
23
|
@title_heading_level = title_heading_level
|
24
24
|
@disable_auto_focus = disable_auto_focus
|
25
25
|
|
26
|
-
super(classes
|
26
|
+
super(classes:, html_attributes:)
|
27
27
|
end
|
28
28
|
|
29
29
|
def render?
|
@@ -38,7 +38,7 @@ class GovukComponent::NotificationBannerComponent < GovukComponent::Base
|
|
38
38
|
@link_text = link_text
|
39
39
|
@link_href = link_href
|
40
40
|
|
41
|
-
super(classes
|
41
|
+
super(classes:, html_attributes:)
|
42
42
|
end
|
43
43
|
|
44
44
|
def call
|
@@ -72,7 +72,7 @@ private
|
|
72
72
|
"module" => "#{brand}-notification-banner",
|
73
73
|
"disable-auto-focus" => disable_auto_focus
|
74
74
|
},
|
75
|
-
role
|
75
|
+
role:,
|
76
76
|
aria: { labelledby: title_id },
|
77
77
|
}
|
78
78
|
end
|
@@ -9,12 +9,12 @@ class GovukComponent::PaginationComponent::AdjacentPage < GovukComponent::Base
|
|
9
9
|
@block_mode = block_mode
|
10
10
|
@suffix = suffix
|
11
11
|
|
12
|
-
super(html_attributes
|
12
|
+
super(html_attributes:, classes:)
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
16
|
tag.div(**html_attributes) do
|
17
|
-
tag.a(href
|
17
|
+
tag.a(href:, class: ["#{brand}-link", "#{brand}-pagination__link"], rel: suffix) do
|
18
18
|
safe_join([body, divider, label_content])
|
19
19
|
end
|
20
20
|
end
|
@@ -22,7 +22,7 @@ class GovukComponent::PaginationComponent::Item < GovukComponent::Base
|
|
22
22
|
# ignored
|
23
23
|
@mode = from_pagy ? pagy_mode(number) : manual_mode(ellipsis, current)
|
24
24
|
|
25
|
-
super(classes
|
25
|
+
super(classes:, html_attributes:)
|
26
26
|
end
|
27
27
|
|
28
28
|
def call
|
@@ -56,7 +56,7 @@ private
|
|
56
56
|
attributes = html_attributes.tap { |ha| ha[:class] << "#{brand}-pagination__item--current" if current }
|
57
57
|
|
58
58
|
tag.li(**attributes) do
|
59
|
-
tag.a(href
|
59
|
+
tag.a(href:, class: ["#{brand}-link", "#{brand}-pagination__link"]) { number.to_s }
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -2,12 +2,12 @@ class GovukComponent::PaginationComponent::NextPage < GovukComponent::Pagination
|
|
2
2
|
def initialize(href:, text:, label_text: nil, block_mode: true, classes: [], html_attributes: {})
|
3
3
|
super(
|
4
4
|
suffix: "next",
|
5
|
-
text
|
6
|
-
href
|
7
|
-
label_text
|
8
|
-
block_mode
|
9
|
-
classes
|
10
|
-
html_attributes:
|
5
|
+
text:,
|
6
|
+
href:,
|
7
|
+
label_text:,
|
8
|
+
block_mode:,
|
9
|
+
classes:,
|
10
|
+
html_attributes:
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -2,12 +2,12 @@ class GovukComponent::PaginationComponent::PreviousPage < GovukComponent::Pagina
|
|
2
2
|
def initialize(href:, text:, label_text: nil, block_mode: true, classes: [], html_attributes: {})
|
3
3
|
super(
|
4
4
|
suffix: "prev",
|
5
|
-
text
|
6
|
-
href
|
7
|
-
label_text
|
8
|
-
block_mode
|
9
|
-
classes
|
10
|
-
html_attributes:
|
5
|
+
text:,
|
6
|
+
href:,
|
7
|
+
label_text:,
|
8
|
+
block_mode:,
|
9
|
+
classes:,
|
10
|
+
html_attributes:
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
@@ -16,23 +16,23 @@ class GovukComponent::PaginationComponent < GovukComponent::Base
|
|
16
16
|
|
17
17
|
renders_one :next_page, ->(href:, text: default_adjacent_text(:next), label_text: nil, classes: [], html_attributes: {}) do
|
18
18
|
GovukComponent::PaginationComponent::NextPage.new(
|
19
|
-
text
|
20
|
-
href
|
21
|
-
label_text
|
19
|
+
text:,
|
20
|
+
href:,
|
21
|
+
label_text:,
|
22
22
|
block_mode: block_mode?,
|
23
|
-
classes
|
24
|
-
html_attributes:
|
23
|
+
classes:,
|
24
|
+
html_attributes:
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
28
28
|
renders_one :previous_page, ->(href:, text: default_adjacent_text(:prev), label_text: nil, classes: [], html_attributes: {}) do
|
29
29
|
GovukComponent::PaginationComponent::PreviousPage.new(
|
30
|
-
text
|
31
|
-
href
|
32
|
-
label_text
|
30
|
+
text:,
|
31
|
+
href:,
|
32
|
+
label_text:,
|
33
33
|
block_mode: block_mode?,
|
34
|
-
classes
|
35
|
-
html_attributes:
|
34
|
+
classes:,
|
35
|
+
html_attributes:
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
@@ -49,7 +49,7 @@ class GovukComponent::PaginationComponent < GovukComponent::Base
|
|
49
49
|
@block_mode = block_mode
|
50
50
|
@landmark_label = landmark_label
|
51
51
|
|
52
|
-
super(classes
|
52
|
+
super(classes:, html_attributes:)
|
53
53
|
end
|
54
54
|
|
55
55
|
def before_render
|
@@ -9,11 +9,11 @@ class GovukComponent::PanelComponent < GovukComponent::Base
|
|
9
9
|
@text = text
|
10
10
|
@id = id
|
11
11
|
|
12
|
-
super(classes
|
12
|
+
super(classes:, html_attributes:)
|
13
13
|
end
|
14
14
|
|
15
15
|
def call
|
16
|
-
tag.div(id
|
16
|
+
tag.div(id:, **html_attributes) do
|
17
17
|
safe_join([panel_title, panel_body].compact)
|
18
18
|
end
|
19
19
|
end
|
@@ -8,7 +8,7 @@ class GovukComponent::SummaryListComponent::ActionComponent < GovukComponent::Ba
|
|
8
8
|
fail(ArgumentError, "missing keyword: visually_hidden_text")
|
9
9
|
end
|
10
10
|
|
11
|
-
super(classes
|
11
|
+
super(classes:, html_attributes:)
|
12
12
|
@href = href
|
13
13
|
@text = text
|
14
14
|
@visually_hidden_action_suffix = visually_hidden_action_suffix
|
@@ -8,7 +8,7 @@ class GovukComponent::SummaryListComponent::CardComponent < GovukComponent::Base
|
|
8
8
|
@title = title
|
9
9
|
actions.each { |a| with_action { a } } if actions.any?
|
10
10
|
|
11
|
-
super(classes
|
11
|
+
super(classes:, html_attributes:)
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -4,7 +4,7 @@ class GovukComponent::SummaryListComponent::KeyComponent < GovukComponent::Base
|
|
4
4
|
def initialize(text: nil, classes: [], html_attributes: {})
|
5
5
|
@text = text
|
6
6
|
|
7
|
-
super(classes
|
7
|
+
super(classes:, html_attributes:)
|
8
8
|
end
|
9
9
|
|
10
10
|
def call
|
@@ -5,12 +5,12 @@ class GovukComponent::SummaryListComponent::RowComponent < GovukComponent::Base
|
|
5
5
|
renders_one :value, GovukComponent::SummaryListComponent::ValueComponent
|
6
6
|
renders_many :actions, ->(href: nil, text: 'Change', visually_hidden_text: false, classes: [], html_attributes: {}, &block) do
|
7
7
|
GovukComponent::SummaryListComponent::ActionComponent.new(
|
8
|
-
href
|
9
|
-
text
|
10
|
-
visually_hidden_text
|
11
|
-
visually_hidden_action_suffix
|
12
|
-
classes
|
13
|
-
html_attributes
|
8
|
+
href:,
|
9
|
+
text:,
|
10
|
+
visually_hidden_text:,
|
11
|
+
visually_hidden_action_suffix:,
|
12
|
+
classes:,
|
13
|
+
html_attributes:,
|
14
14
|
&block
|
15
15
|
)
|
16
16
|
end
|
@@ -19,7 +19,7 @@ class GovukComponent::SummaryListComponent::RowComponent < GovukComponent::Base
|
|
19
19
|
@show_actions_column = show_actions_column
|
20
20
|
@visually_hidden_action_suffix = visually_hidden_action_suffix
|
21
21
|
|
22
|
-
super(classes
|
22
|
+
super(classes:, html_attributes:)
|
23
23
|
end
|
24
24
|
|
25
25
|
def call
|
@@ -2,7 +2,7 @@ class GovukComponent::SummaryListComponent::ValueComponent < GovukComponent::Bas
|
|
2
2
|
attr_reader :text
|
3
3
|
|
4
4
|
def initialize(text: nil, classes: [], html_attributes: {})
|
5
|
-
super(classes
|
5
|
+
super(classes:, html_attributes:)
|
6
6
|
|
7
7
|
@text = text
|
8
8
|
end
|
@@ -6,8 +6,8 @@ module GovukComponent
|
|
6
6
|
GovukComponent::SummaryListComponent::RowComponent.new(
|
7
7
|
show_actions_column: @show_actions_column,
|
8
8
|
visually_hidden_action_suffix: visually_hidden_action_suffix || card&.title,
|
9
|
-
classes
|
10
|
-
html_attributes
|
9
|
+
classes:,
|
10
|
+
html_attributes:,
|
11
11
|
&block
|
12
12
|
)
|
13
13
|
end
|
@@ -18,7 +18,7 @@ module GovukComponent
|
|
18
18
|
@card = GovukComponent::SummaryListComponent::CardComponent.new(**card) if card.present?
|
19
19
|
@visually_hidden_action_suffix = visually_hidden_action_suffix
|
20
20
|
|
21
|
-
super(classes
|
21
|
+
super(classes:, html_attributes:)
|
22
22
|
|
23
23
|
return unless rows.presence
|
24
24
|
|
@@ -9,13 +9,13 @@ class GovukComponent::TabComponent < GovukComponent::Base
|
|
9
9
|
@title = title
|
10
10
|
@id = id
|
11
11
|
|
12
|
-
super(classes
|
12
|
+
super(classes:, html_attributes:)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def default_attributes
|
18
|
-
{ id
|
18
|
+
{ id:, class: "#{brand}-tabs", data: { module: "#{brand}-tabs" } }
|
19
19
|
end
|
20
20
|
|
21
21
|
class Tab < GovukComponent::Base
|
@@ -25,7 +25,7 @@ private
|
|
25
25
|
@label = label
|
26
26
|
@text = h(text)
|
27
27
|
|
28
|
-
super(classes
|
28
|
+
super(classes:, html_attributes:)
|
29
29
|
end
|
30
30
|
|
31
31
|
def id(prefix: nil)
|
@@ -47,7 +47,7 @@ private
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def default_attributes
|
50
|
-
{ id
|
50
|
+
{ id:, class: "#{brand}-tabs__panel" }
|
51
51
|
end
|
52
52
|
|
53
53
|
def combined_attributes(i)
|
@@ -1,16 +1,16 @@
|
|
1
1
|
class GovukComponent::TableComponent::BodyComponent < GovukComponent::Base
|
2
2
|
renders_many :rows, ->(cell_data: nil, first_cell_is_header: false, classes: [], html_attributes: {}, &block) do
|
3
3
|
GovukComponent::TableComponent::RowComponent.from_body(
|
4
|
-
cell_data
|
5
|
-
first_cell_is_header
|
6
|
-
classes
|
7
|
-
html_attributes
|
4
|
+
cell_data:,
|
5
|
+
first_cell_is_header:,
|
6
|
+
classes:,
|
7
|
+
html_attributes:,
|
8
8
|
&block
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(rows: nil, first_cell_is_header: false, classes: [], html_attributes: {})
|
13
|
-
super(classes
|
13
|
+
super(classes:, html_attributes:)
|
14
14
|
|
15
15
|
build_rows_from_row_data(rows, first_cell_is_header)
|
16
16
|
end
|
@@ -24,7 +24,7 @@ private
|
|
24
24
|
def build_rows_from_row_data(data, first_cell_is_header)
|
25
25
|
return if data.blank?
|
26
26
|
|
27
|
-
data.each { |d| with_row(cell_data: d, first_cell_is_header:
|
27
|
+
data.each { |d| with_row(cell_data: d, first_cell_is_header:) }
|
28
28
|
end
|
29
29
|
|
30
30
|
def default_attributes
|
@@ -25,7 +25,7 @@ class GovukComponent::TableComponent::CellComponent < GovukComponent::Base
|
|
25
25
|
@rowspan = rowspan
|
26
26
|
@header = (header.nil?) ? in_thead? : header
|
27
27
|
|
28
|
-
super(classes
|
28
|
+
super(classes:, html_attributes:)
|
29
29
|
end
|
30
30
|
|
31
31
|
def call
|
@@ -51,11 +51,11 @@ private
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def default_attributes
|
54
|
-
{ class: default_classes, scope: determine_scope, colspan
|
54
|
+
{ class: default_classes, scope: determine_scope, colspan:, rowspan: }.compact
|
55
55
|
end
|
56
56
|
|
57
57
|
def determine_scope
|
58
|
-
conditions = { scope
|
58
|
+
conditions = { scope:, parent:, header:, auto_table_scopes: config.enable_auto_table_scopes }
|
59
59
|
|
60
60
|
case conditions
|
61
61
|
in { scope: String }
|