govuk-components 4.0.0a1 → 4.0.0a2
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/README.md +1 -1
- data/app/components/govuk_component/pagination_component.rb +3 -3
- data/app/components/govuk_component/summary_list_component/card_component.html.erb +16 -0
- data/app/components/govuk_component/summary_list_component/card_component.rb +19 -0
- data/app/components/govuk_component/summary_list_component.rb +20 -6
- data/app/components/govuk_component/table_component/body_component.rb +1 -1
- data/app/components/govuk_component/table_component/cell_component.rb +32 -14
- data/app/components/govuk_component/table_component/col_group_component.rb +45 -0
- data/app/components/govuk_component/table_component/foot_component.rb +44 -0
- data/app/components/govuk_component/table_component/head_component.rb +1 -1
- data/app/components/govuk_component/table_component/row_component.rb +15 -2
- data/app/components/govuk_component/table_component.rb +11 -7
- data/app/helpers/govuk_components_helper.rb +1 -0
- data/app/helpers/govuk_link_helper.rb +8 -28
- data/lib/govuk/components/version.rb +1 -1
- metadata +14 -11
- data/app/components/govuk_component/summary_list_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: 4a89715e3ac54c26a25f8711ffcc1bcbae3c7cd697e6dc4993d6581c52fe4885
|
4
|
+
data.tar.gz: 8c781f15f6e02d50b5c463732770340502a7c3e300b63f633c6ca09b084effab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c89afcba1f59b8b7d02142b891904667a9b6aaeb84db7f1d4c6c373d516b7ee302aa23e6431d21e3144f1ea6bbdc7d78703bc6d3dfe88e5c00c2f987ce8368c
|
7
|
+
data.tar.gz: 1dc348dde934a1806118c18c75d20b4cee98b03ba2032a1a86a4a0519461662acab039b8a8f65fd41ef3406faf634da95e72db9a2e33456af191375f87477b19
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[](https://rubygems.org/gems/govuk-components)
|
7
7
|
[](https://codeclimate.com/github/DFE-Digital/govuk-components/test_coverage)
|
8
8
|
[](https://github.com/DFE-Digital/govuk-components/blob/main/LICENSE)
|
9
|
-
[](https://design-system.service.gov.uk)
|
10
10
|
[](https://weblog.rubyonrails.org/releases/)
|
11
11
|
[](https://www.ruby-lang.org/en/downloads/)
|
12
12
|
|
@@ -96,7 +96,7 @@ private
|
|
96
96
|
text: @previous_text,
|
97
97
|
}
|
98
98
|
|
99
|
-
|
99
|
+
with_previous_page(**kwargs.compact)
|
100
100
|
end
|
101
101
|
|
102
102
|
def build_next
|
@@ -107,11 +107,11 @@ private
|
|
107
107
|
text: @next_text,
|
108
108
|
}
|
109
109
|
|
110
|
-
|
110
|
+
with_next_page(**kwargs.compact)
|
111
111
|
end
|
112
112
|
|
113
113
|
def build_items
|
114
|
-
pagy.series.map { |i|
|
114
|
+
pagy.series.map { |i| with_item(number: i, href: pagy_url_for(pagy, i), from_pagy: true) }
|
115
115
|
end
|
116
116
|
|
117
117
|
def default_adjacent_text(side)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= tag.div(**html_attributes) do %>
|
2
|
+
<div class="govuk-summary-card__title-wrapper">
|
3
|
+
<%= tag.h2(title, class: "govuk-summary-card__title") %>
|
4
|
+
|
5
|
+
<% if actions.any? %>
|
6
|
+
<ul class="govuk-summary-card__actions">
|
7
|
+
<% actions.each do |action| %>
|
8
|
+
<%= tag.li(action, class: "govuk-summary-card__action") %>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
<div class="govuk-summary-card__content">
|
14
|
+
<%= summary_list || content %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class GovukComponent::SummaryListComponent::CardComponent < GovukComponent::Base
|
2
|
+
attr_reader :title
|
3
|
+
|
4
|
+
renders_many :actions
|
5
|
+
renders_one :summary_list, "GovukComponent::SummaryListComponent"
|
6
|
+
|
7
|
+
def initialize(title:, actions: [], classes: [], html_attributes: {})
|
8
|
+
@title = title
|
9
|
+
actions.each { |a| with_action { a } } if actions.any?
|
10
|
+
|
11
|
+
super(classes: classes, html_attributes: html_attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def default_attributes
|
17
|
+
{ class: %w(govuk-summary-card) }
|
18
|
+
end
|
19
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module GovukComponent
|
2
2
|
class SummaryListComponent < GovukComponent::Base
|
3
|
-
attr_reader :borders, :actions
|
3
|
+
attr_reader :borders, :actions, :card
|
4
4
|
|
5
5
|
renders_many :rows, ->(classes: [], html_attributes: {}, &block) do
|
6
6
|
GovukComponent::SummaryListComponent::RowComponent.new(
|
@@ -11,9 +11,10 @@ module GovukComponent
|
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(rows: nil, actions: true, borders: config.default_summary_list_borders, classes: [], html_attributes: {})
|
14
|
+
def initialize(rows: nil, actions: true, borders: config.default_summary_list_borders, card: nil, classes: [], html_attributes: {})
|
15
15
|
@borders = borders
|
16
16
|
@show_actions_column = actions
|
17
|
+
@card = card
|
17
18
|
|
18
19
|
super(classes: classes, html_attributes: html_attributes)
|
19
20
|
|
@@ -22,8 +23,21 @@ module GovukComponent
|
|
22
23
|
build(rows)
|
23
24
|
end
|
24
25
|
|
26
|
+
def call
|
27
|
+
summary_list = tag.dl(**html_attributes) { safe_join(rows) }
|
28
|
+
|
29
|
+
(card.nil?) ? summary_list : card_with(summary_list)
|
30
|
+
end
|
31
|
+
|
25
32
|
private
|
26
33
|
|
34
|
+
# we're not using `renders_one` here because we always want the card to render
|
35
|
+
# outside of the summary list. when manually building use
|
36
|
+
# govuk_summary_list_card { govuk_summary_list }
|
37
|
+
def card_with(summary_list)
|
38
|
+
render(GovukComponent::SummaryListComponent::CardComponent.new(**card)) { summary_list }
|
39
|
+
end
|
40
|
+
|
27
41
|
def borders_class
|
28
42
|
%(govuk-summary-list--no-border) unless borders
|
29
43
|
end
|
@@ -38,10 +52,10 @@ module GovukComponent
|
|
38
52
|
rows.each do |data|
|
39
53
|
k, v, a = data.values_at(:key, :value, :actions)
|
40
54
|
|
41
|
-
|
42
|
-
r.
|
43
|
-
r.
|
44
|
-
Array.wrap(a).each { |ad| r.
|
55
|
+
with_row(**data.slice(:classes, :html_attributes)) do |r|
|
56
|
+
r.with_key(**k)
|
57
|
+
r.with_value(**v)
|
58
|
+
Array.wrap(a).each { |ad| r.with_action(**ad) }
|
45
59
|
end
|
46
60
|
end
|
47
61
|
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|
|
27
|
+
data.each { |d| with_row(cell_data: d, first_cell_is_header: first_cell_is_header) }
|
28
28
|
end
|
29
29
|
|
30
30
|
def default_attributes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class GovukComponent::TableComponent::CellComponent < GovukComponent::Base
|
2
|
-
attr_reader :text, :header, :numeric, :width, :scope, :parent
|
2
|
+
attr_reader :text, :header, :numeric, :width, :scope, :parent, :colspan, :rowspan
|
3
3
|
|
4
4
|
alias_method :numeric?, :numeric
|
5
5
|
alias_method :header?, :header
|
@@ -13,12 +13,14 @@ class GovukComponent::TableComponent::CellComponent < GovukComponent::Base
|
|
13
13
|
"one-quarter" => "govuk-!-width-one-quarter",
|
14
14
|
}.freeze
|
15
15
|
|
16
|
-
def initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, classes: [], html_attributes: {})
|
16
|
+
def initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {})
|
17
17
|
@text = text
|
18
18
|
@numeric = numeric
|
19
19
|
@width = width
|
20
20
|
@scope = scope
|
21
21
|
@parent = parent
|
22
|
+
@colspan = colspan
|
23
|
+
@rowspan = rowspan
|
22
24
|
@header = (header.nil?) ? in_thead? : header
|
23
25
|
|
24
26
|
super(classes: classes, html_attributes: html_attributes)
|
@@ -39,11 +41,15 @@ private
|
|
39
41
|
end
|
40
42
|
|
41
43
|
def cell_element
|
42
|
-
|
44
|
+
if in_thead? || header?
|
45
|
+
'th'
|
46
|
+
else
|
47
|
+
'td'
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
51
|
def default_attributes
|
46
|
-
{ class: default_classes, scope: determine_scope }
|
52
|
+
{ class: default_classes, scope: determine_scope, colspan: colspan, rowspan: rowspan }.compact
|
47
53
|
end
|
48
54
|
|
49
55
|
def determine_scope
|
@@ -56,28 +62,40 @@ private
|
|
56
62
|
nil
|
57
63
|
in { auto_table_scopes: true, parent: 'thead' }
|
58
64
|
'col'
|
59
|
-
in { auto_table_scopes: true, parent: 'tbody' }
|
65
|
+
in { auto_table_scopes: true, parent: 'tbody' } | { auto_table_scopes: true, parent: 'tfoot' }
|
60
66
|
'row'
|
61
67
|
else
|
62
|
-
Rails.logger.warn("No scope pattern matched")
|
63
|
-
|
64
68
|
nil
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
72
|
def default_classes
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
class_names(
|
74
|
+
"govuk-table__#{class_suffix}",
|
75
|
+
"govuk-table__#{class_suffix}--numeric" => numeric?,
|
76
|
+
width => width?,
|
77
|
+
)
|
74
78
|
end
|
75
79
|
|
76
|
-
def
|
77
|
-
|
80
|
+
def class_suffix
|
81
|
+
if in_thead? || (in_tbody? && header?)
|
82
|
+
"header"
|
83
|
+
elsif in_tfoot?
|
84
|
+
"footer"
|
85
|
+
else
|
86
|
+
"cell"
|
87
|
+
end
|
78
88
|
end
|
79
89
|
|
80
90
|
def in_thead?
|
81
91
|
parent == "thead"
|
82
92
|
end
|
93
|
+
|
94
|
+
def in_tfoot?
|
95
|
+
parent == "tfoot"
|
96
|
+
end
|
97
|
+
|
98
|
+
def in_tbody?
|
99
|
+
parent == "tbody"
|
100
|
+
end
|
83
101
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class GovukComponent::TableComponent::ColGroupComponent < GovukComponent::Base
|
2
|
+
renders_many :cols, "ColComponent"
|
3
|
+
|
4
|
+
def initialize(classes: [], cols: [], html_attributes: {})
|
5
|
+
super(classes: classes, html_attributes: html_attributes)
|
6
|
+
|
7
|
+
return if cols.blank?
|
8
|
+
|
9
|
+
cols.each { |c| with_col(span: c) }
|
10
|
+
end
|
11
|
+
|
12
|
+
def call
|
13
|
+
tag.colgroup(**html_attributes) { safe_join(cols) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def render?
|
17
|
+
cols.any?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def default_attributes
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
|
26
|
+
class ColComponent < GovukComponent::Base
|
27
|
+
attr_reader :span
|
28
|
+
|
29
|
+
def initialize(span: 1, classes: [], html_attributes: {})
|
30
|
+
@span = span.to_s
|
31
|
+
|
32
|
+
super(classes: classes, html_attributes: html_attributes)
|
33
|
+
end
|
34
|
+
|
35
|
+
def call
|
36
|
+
tag.col(span: span, **html_attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def default_attributes
|
42
|
+
{}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class GovukComponent::TableComponent::FootComponent < GovukComponent::Base
|
2
|
+
renders_many :rows, ->(cell_data: nil, first_cell_is_header: false, classes: [], html_attributes: {}, &block) do
|
3
|
+
GovukComponent::TableComponent::RowComponent.from_foot(
|
4
|
+
cell_data: cell_data,
|
5
|
+
first_cell_is_header: first_cell_is_header,
|
6
|
+
classes: classes,
|
7
|
+
html_attributes: html_attributes,
|
8
|
+
&block
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :first_cell_is_header, :row_data
|
13
|
+
|
14
|
+
def initialize(rows: nil, first_cell_is_header: false, classes: [], html_attributes: {})
|
15
|
+
@rows = rows
|
16
|
+
@first_cell_is_header = first_cell_is_header
|
17
|
+
|
18
|
+
super(classes: classes, html_attributes: html_attributes)
|
19
|
+
|
20
|
+
return unless rows.presence
|
21
|
+
|
22
|
+
build_rows_from_row_data(rows)
|
23
|
+
end
|
24
|
+
|
25
|
+
def call
|
26
|
+
tag.tfoot(**html_attributes) { safe_join(rows) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def render?
|
30
|
+
rows.any?
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def build_rows_from_row_data(data)
|
36
|
+
return if data.blank?
|
37
|
+
|
38
|
+
with_row(cell_data: data, first_cell_is_header: first_cell_is_header)
|
39
|
+
end
|
40
|
+
|
41
|
+
def default_attributes
|
42
|
+
{ class: %w(govuk-table__foot) }
|
43
|
+
end
|
44
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class GovukComponent::TableComponent::RowComponent < GovukComponent::Base
|
2
|
-
renders_many :cells, ->(scope: nil, header: nil, text: nil, numeric: false, width: nil, classes: [], html_attributes: {}, &block) do
|
2
|
+
renders_many :cells, ->(scope: nil, header: nil, text: nil, numeric: false, width: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {}, &block) do
|
3
3
|
GovukComponent::TableComponent::CellComponent.new(
|
4
4
|
scope: scope,
|
5
5
|
header: header,
|
@@ -7,6 +7,8 @@ class GovukComponent::TableComponent::RowComponent < GovukComponent::Base
|
|
7
7
|
numeric: numeric,
|
8
8
|
width: width,
|
9
9
|
parent: parent,
|
10
|
+
rowspan: rowspan,
|
11
|
+
colspan: colspan,
|
10
12
|
classes: classes,
|
11
13
|
html_attributes: html_attributes,
|
12
14
|
&block
|
@@ -32,6 +34,10 @@ class GovukComponent::TableComponent::RowComponent < GovukComponent::Base
|
|
32
34
|
new(*args, parent: 'tbody', **kwargs, &block)
|
33
35
|
end
|
34
36
|
|
37
|
+
def self.from_foot(*args, **kwargs, &block)
|
38
|
+
new(*args, parent: 'tfoot', **kwargs, &block)
|
39
|
+
end
|
40
|
+
|
35
41
|
def call
|
36
42
|
tag.tr(**html_attributes) { safe_join(cells) }
|
37
43
|
end
|
@@ -41,7 +47,14 @@ private
|
|
41
47
|
def build_cells_from_cell_data(cell_data)
|
42
48
|
return if cell_data.blank?
|
43
49
|
|
44
|
-
cell_data.
|
50
|
+
cell_data.each_with_index do |data, i|
|
51
|
+
case data
|
52
|
+
when Hash
|
53
|
+
with_cell(**data, **cell_attributes(i))
|
54
|
+
when String
|
55
|
+
with_cell(text: data, **cell_attributes(i))
|
56
|
+
end
|
57
|
+
end
|
45
58
|
end
|
46
59
|
|
47
60
|
def cell_attributes(count)
|
@@ -1,12 +1,15 @@
|
|
1
1
|
module GovukComponent
|
2
2
|
class TableComponent < GovukComponent::Base
|
3
3
|
renders_one :caption, "GovukComponent::TableComponent::CaptionComponent"
|
4
|
+
renders_many :cols, "GovukComponent::TableComponent::ColGroupComponent::ColComponent"
|
5
|
+
renders_many :colgroups, "GovukComponent::TableComponent::ColGroupComponent"
|
4
6
|
renders_one :head, "GovukComponent::TableComponent::HeadComponent"
|
5
7
|
renders_many :bodies, "GovukComponent::TableComponent::BodyComponent"
|
8
|
+
renders_one :foot, "GovukComponent::TableComponent::FootComponent"
|
6
9
|
|
7
10
|
attr_accessor :id, :first_cell_is_header, :caption_text
|
8
11
|
|
9
|
-
def initialize(id: nil, rows: nil, head: nil, caption: nil, first_cell_is_header: false, classes: [], html_attributes: {})
|
12
|
+
def initialize(id: nil, rows: nil, head: nil, foot: nil, caption: nil, first_cell_is_header: false, classes: [], html_attributes: {})
|
10
13
|
@id = id
|
11
14
|
@first_cell_is_header = first_cell_is_header
|
12
15
|
@caption_text = caption
|
@@ -17,19 +20,20 @@ module GovukComponent
|
|
17
20
|
return unless rows.presence
|
18
21
|
|
19
22
|
# if no head is passed in,use the first row for headers
|
20
|
-
build(*(head ? [head, rows] : [rows[0], rows[1..]]), caption_text)
|
23
|
+
build(*(head ? [head, rows] : [rows[0], rows[1..]]), foot, caption_text)
|
21
24
|
end
|
22
25
|
|
23
26
|
def call
|
24
|
-
tag.table(**html_attributes) { safe_join([caption, head, bodies]) }
|
27
|
+
tag.table(**html_attributes) { safe_join([caption, colgroups, head, bodies, foot]) }
|
25
28
|
end
|
26
29
|
|
27
30
|
private
|
28
31
|
|
29
|
-
def build(head_data, body_data, caption_text)
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
def build(head_data, body_data, foot_data, caption_text)
|
33
|
+
with_caption(text: caption_text)
|
34
|
+
with_head(rows: [head_data])
|
35
|
+
with_body(rows: body_data, first_cell_is_header: first_cell_is_header)
|
36
|
+
with_foot(rows: foot_data, first_cell_is_header: first_cell_is_header)
|
33
37
|
end
|
34
38
|
|
35
39
|
def default_attributes
|
@@ -15,6 +15,7 @@ module GovukComponentsHelper
|
|
15
15
|
govuk_section_break: 'GovukComponent::SectionBreakComponent',
|
16
16
|
govuk_start_button: 'GovukComponent::StartButtonComponent',
|
17
17
|
govuk_summary_list: 'GovukComponent::SummaryListComponent',
|
18
|
+
govuk_summary_card: 'GovukComponent::SummaryListComponent::CardComponent',
|
18
19
|
govuk_table: 'GovukComponent::TableComponent',
|
19
20
|
govuk_tabs: 'GovukComponent::TabComponent',
|
20
21
|
govuk_tag: 'GovukComponent::TagComponent',
|
@@ -17,11 +17,6 @@ module GovukLinkHelper
|
|
17
17
|
warning: "govuk-button--warning",
|
18
18
|
}.freeze
|
19
19
|
|
20
|
-
NEW_TAB_ATTRIBUTES = {
|
21
|
-
target: "_blank",
|
22
|
-
rel: "noreferrer noopener"
|
23
|
-
}.freeze
|
24
|
-
|
25
20
|
def govuk_link_classes(*styles, default_class: 'govuk-link')
|
26
21
|
if (invalid_styles = (styles - LINK_STYLES.keys)) && invalid_styles.any?
|
27
22
|
fail(ArgumentError, "invalid styles #{invalid_styles.to_sentence}. Valid styles are #{LINK_STYLES.keys.to_sentence}")
|
@@ -38,14 +33,14 @@ module GovukLinkHelper
|
|
38
33
|
[default_class] + BUTTON_STYLES.values_at(*styles).compact
|
39
34
|
end
|
40
35
|
|
41
|
-
def govuk_link_to(name = nil, options = nil, extra_options = {},
|
36
|
+
def govuk_link_to(name = nil, options = nil, extra_options = {}, &block)
|
42
37
|
extra_options = options if block_given?
|
43
|
-
html_options = build_html_options(extra_options
|
38
|
+
html_options = build_html_options(extra_options)
|
44
39
|
|
45
40
|
if block_given?
|
46
41
|
link_to(name, html_options, &block)
|
47
42
|
else
|
48
|
-
link_to(
|
43
|
+
link_to(name, options, html_options)
|
49
44
|
end
|
50
45
|
end
|
51
46
|
|
@@ -71,15 +66,15 @@ module GovukLinkHelper
|
|
71
66
|
end
|
72
67
|
end
|
73
68
|
|
74
|
-
def govuk_button_link_to(name = nil, options = nil, extra_options = {},
|
69
|
+
def govuk_button_link_to(name = nil, options = nil, extra_options = {}, &block)
|
75
70
|
extra_options = options if block_given?
|
76
71
|
html_options = GovukComponent::StartButtonComponent::LINK_ATTRIBUTES
|
77
|
-
.merge build_html_options(extra_options, style: :button
|
72
|
+
.merge build_html_options(extra_options, style: :button)
|
78
73
|
|
79
74
|
if block_given?
|
80
75
|
link_to(name, html_options, &block)
|
81
76
|
else
|
82
|
-
link_to(
|
77
|
+
link_to(name, options, html_options)
|
83
78
|
end
|
84
79
|
end
|
85
80
|
|
@@ -96,24 +91,19 @@ module GovukLinkHelper
|
|
96
91
|
|
97
92
|
private
|
98
93
|
|
99
|
-
def build_html_options(provided_options, style: :link
|
94
|
+
def build_html_options(provided_options, style: :link)
|
100
95
|
element_styles = { link: LINK_STYLES, button: BUTTON_STYLES }.fetch(style, {})
|
101
96
|
|
102
97
|
# we need to take a couple of extra steps here because we don't want the style
|
103
98
|
# params (inverse, muted, etc) to end up as extra attributes on the link.
|
104
99
|
|
105
|
-
remaining_options =
|
106
|
-
.deep_merge_html_attributes(remove_styles_from_provided_options(element_styles, provided_options))
|
100
|
+
remaining_options = remove_styles_from_provided_options(element_styles, provided_options)
|
107
101
|
|
108
102
|
style_classes = build_style_classes(style, extract_styles_from_provided_options(element_styles, provided_options))
|
109
103
|
|
110
104
|
combine_attributes(remaining_options, class_name: style_classes)
|
111
105
|
end
|
112
106
|
|
113
|
-
def new_tab_options(new_tab)
|
114
|
-
new_tab ? NEW_TAB_ATTRIBUTES : {}
|
115
|
-
end
|
116
|
-
|
117
107
|
def build_style_classes(style, provided_options)
|
118
108
|
keys = *provided_options&.keys
|
119
109
|
|
@@ -143,16 +133,6 @@ private
|
|
143
133
|
|
144
134
|
provided_options&.except(*styles.keys)
|
145
135
|
end
|
146
|
-
|
147
|
-
def prepare_link_text(text, new_tab)
|
148
|
-
return text unless new_tab
|
149
|
-
|
150
|
-
new_tab_text = new_tab.is_a?(String) ? new_tab : Govuk::Components.config.default_link_new_tab_text
|
151
|
-
|
152
|
-
return text if new_tab_text.blank?
|
153
|
-
|
154
|
-
%(#{text} #{new_tab_text})
|
155
|
-
end
|
156
136
|
end
|
157
137
|
|
158
138
|
ActiveSupport.on_load(:action_view) { include GovukLinkHelper }
|
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.0.
|
4
|
+
version: 4.0.0a2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DfE developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-attributes-utils
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 3.0.0rc1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 3.0.0rc1
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: deep_merge
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,14 +204,14 @@ dependencies:
|
|
204
204
|
requirements:
|
205
205
|
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: 3.
|
207
|
+
version: 3.6.0
|
208
208
|
type: :development
|
209
209
|
prerelease: false
|
210
210
|
version_requirements: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
212
|
- - "~>"
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version: 3.
|
214
|
+
version: 3.6.0
|
215
215
|
- !ruby/object:Gem::Dependency
|
216
216
|
name: rouge
|
217
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,28 +288,28 @@ dependencies:
|
|
288
288
|
requirements:
|
289
289
|
- - "~>"
|
290
290
|
- !ruby/object:Gem::Version
|
291
|
-
version: 0.
|
291
|
+
version: 0.24.0
|
292
292
|
type: :development
|
293
293
|
prerelease: false
|
294
294
|
version_requirements: !ruby/object:Gem::Requirement
|
295
295
|
requirements:
|
296
296
|
- - "~>"
|
297
297
|
- !ruby/object:Gem::Version
|
298
|
-
version: 0.
|
298
|
+
version: 0.24.0
|
299
299
|
- !ruby/object:Gem::Dependency
|
300
300
|
name: webrick
|
301
301
|
requirement: !ruby/object:Gem::Requirement
|
302
302
|
requirements:
|
303
303
|
- - "~>"
|
304
304
|
- !ruby/object:Gem::Version
|
305
|
-
version: 1.
|
305
|
+
version: 1.8.1
|
306
306
|
type: :development
|
307
307
|
prerelease: false
|
308
308
|
version_requirements: !ruby/object:Gem::Requirement
|
309
309
|
requirements:
|
310
310
|
- - "~>"
|
311
311
|
- !ruby/object:Gem::Version
|
312
|
-
version: 1.
|
312
|
+
version: 1.8.1
|
313
313
|
description: A collection of components intended to ease the building of GOV.UK Design
|
314
314
|
System web applications
|
315
315
|
email:
|
@@ -349,9 +349,10 @@ files:
|
|
349
349
|
- app/components/govuk_component/phase_banner_component.rb
|
350
350
|
- app/components/govuk_component/section_break_component.rb
|
351
351
|
- app/components/govuk_component/start_button_component.rb
|
352
|
-
- app/components/govuk_component/summary_list_component.html.erb
|
353
352
|
- app/components/govuk_component/summary_list_component.rb
|
354
353
|
- app/components/govuk_component/summary_list_component/action_component.rb
|
354
|
+
- app/components/govuk_component/summary_list_component/card_component.html.erb
|
355
|
+
- app/components/govuk_component/summary_list_component/card_component.rb
|
355
356
|
- app/components/govuk_component/summary_list_component/key_component.rb
|
356
357
|
- app/components/govuk_component/summary_list_component/row_component.rb
|
357
358
|
- app/components/govuk_component/summary_list_component/value_component.rb
|
@@ -361,6 +362,8 @@ files:
|
|
361
362
|
- app/components/govuk_component/table_component/body_component.rb
|
362
363
|
- app/components/govuk_component/table_component/caption_component.rb
|
363
364
|
- app/components/govuk_component/table_component/cell_component.rb
|
365
|
+
- app/components/govuk_component/table_component/col_group_component.rb
|
366
|
+
- app/components/govuk_component/table_component/foot_component.rb
|
364
367
|
- app/components/govuk_component/table_component/head_component.rb
|
365
368
|
- app/components/govuk_component/table_component/row_component.rb
|
366
369
|
- app/components/govuk_component/tag_component.rb
|