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.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/components/govuk_component/accordion_component/section_component.html.erb +1 -1
  4. data/app/components/govuk_component/accordion_component/section_component.rb +1 -1
  5. data/app/components/govuk_component/accordion_component.rb +12 -8
  6. data/app/components/govuk_component/back_link_component.rb +1 -1
  7. data/app/components/govuk_component/breadcrumbs_component.rb +1 -1
  8. data/app/components/govuk_component/cookie_banner_component/message_component.rb +2 -2
  9. data/app/components/govuk_component/cookie_banner_component.rb +2 -2
  10. data/app/components/govuk_component/details_component.rb +2 -2
  11. data/app/components/govuk_component/exit_this_page_component.rb +1 -1
  12. data/app/components/govuk_component/footer_component.rb +1 -1
  13. data/app/components/govuk_component/header_component.html.erb +4 -4
  14. data/app/components/govuk_component/header_component.rb +3 -3
  15. data/app/components/govuk_component/inset_text_component.rb +2 -2
  16. data/app/components/govuk_component/notification_banner_component.rb +3 -3
  17. data/app/components/govuk_component/pagination_component/adjacent_page.rb +2 -2
  18. data/app/components/govuk_component/pagination_component/item.rb +2 -2
  19. data/app/components/govuk_component/pagination_component/next_page.rb +6 -6
  20. data/app/components/govuk_component/pagination_component/previous_page.rb +6 -6
  21. data/app/components/govuk_component/pagination_component.rb +11 -11
  22. data/app/components/govuk_component/panel_component.rb +2 -2
  23. data/app/components/govuk_component/phase_banner_component.rb +1 -1
  24. data/app/components/govuk_component/section_break_component.rb +1 -1
  25. data/app/components/govuk_component/start_button_component.rb +1 -1
  26. data/app/components/govuk_component/summary_list_component/action_component.rb +1 -1
  27. data/app/components/govuk_component/summary_list_component/card_component.rb +1 -1
  28. data/app/components/govuk_component/summary_list_component/key_component.rb +1 -1
  29. data/app/components/govuk_component/summary_list_component/row_component.rb +7 -7
  30. data/app/components/govuk_component/summary_list_component/value_component.rb +1 -1
  31. data/app/components/govuk_component/summary_list_component.rb +3 -3
  32. data/app/components/govuk_component/tab_component.rb +4 -4
  33. data/app/components/govuk_component/table_component/body_component.rb +6 -6
  34. data/app/components/govuk_component/table_component/caption_component.rb +1 -1
  35. data/app/components/govuk_component/table_component/cell_component.rb +3 -3
  36. data/app/components/govuk_component/table_component/col_group_component.rb +3 -3
  37. data/app/components/govuk_component/table_component/foot_component.rb +6 -6
  38. data/app/components/govuk_component/table_component/head_component.rb +4 -4
  39. data/app/components/govuk_component/table_component/row_component.rb +11 -11
  40. data/app/components/govuk_component/table_component.rb +4 -4
  41. data/app/components/govuk_component/tag_component.rb +1 -1
  42. data/app/components/govuk_component/task_list_component/item_component.rb +13 -13
  43. data/app/components/govuk_component/task_list_component/status_component.rb +3 -3
  44. data/app/components/govuk_component/task_list_component/title_component.rb +4 -4
  45. data/app/components/govuk_component/task_list_component.rb +8 -8
  46. data/app/components/govuk_component/warning_text_component.rb +1 -1
  47. data/app/helpers/govuk_link_helper.rb +53 -29
  48. data/app/helpers/govuk_visually_hidden_helper.rb +7 -1
  49. data/lib/govuk/components/version.rb +1 -1
  50. metadata +11 -12
  51. data/app/components/govuk_component/accordion_component.html.erb +0 -5
@@ -2,7 +2,7 @@ class GovukComponent::TableComponent::ColGroupComponent < GovukComponent::Base
2
2
  renders_many :cols, "ColComponent"
3
3
 
4
4
  def initialize(classes: [], cols: [], html_attributes: {})
5
- super(classes: classes, html_attributes: html_attributes)
5
+ super(classes:, html_attributes:)
6
6
 
7
7
  return if cols.blank?
8
8
 
@@ -29,11 +29,11 @@ private
29
29
  def initialize(span: 1, classes: [], html_attributes: {})
30
30
  @span = span.to_s
31
31
 
32
- super(classes: classes, html_attributes: html_attributes)
32
+ super(classes:, html_attributes:)
33
33
  end
34
34
 
35
35
  def call
36
- tag.col(span: span, **html_attributes)
36
+ tag.col(span:, **html_attributes)
37
37
  end
38
38
 
39
39
  private
@@ -1,10 +1,10 @@
1
1
  class GovukComponent::TableComponent::FootComponent < 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_foot(
4
- cell_data: cell_data,
5
- first_cell_is_header: first_cell_is_header,
6
- classes: classes,
7
- html_attributes: html_attributes,
4
+ cell_data:,
5
+ first_cell_is_header:,
6
+ classes:,
7
+ html_attributes:,
8
8
  &block
9
9
  )
10
10
  end
@@ -15,7 +15,7 @@ class GovukComponent::TableComponent::FootComponent < GovukComponent::Base
15
15
  @rows = rows
16
16
  @first_cell_is_header = first_cell_is_header
17
17
 
18
- super(classes: classes, html_attributes: html_attributes)
18
+ super(classes:, html_attributes:)
19
19
 
20
20
  return unless rows.presence
21
21
 
@@ -35,7 +35,7 @@ private
35
35
  def build_rows_from_row_data(data)
36
36
  return if data.blank?
37
37
 
38
- with_row(cell_data: data, first_cell_is_header: first_cell_is_header)
38
+ with_row(cell_data: data, first_cell_is_header:)
39
39
  end
40
40
 
41
41
  def default_attributes
@@ -1,9 +1,9 @@
1
1
  class GovukComponent::TableComponent::HeadComponent < GovukComponent::Base
2
2
  renders_many :rows, ->(cell_data: nil, classes: [], html_attributes: {}, &block) do
3
3
  GovukComponent::TableComponent::RowComponent.from_head(
4
- cell_data: cell_data,
5
- classes: classes,
6
- html_attributes: html_attributes,
4
+ cell_data:,
5
+ classes:,
6
+ html_attributes:,
7
7
  &block
8
8
  )
9
9
  end
@@ -11,7 +11,7 @@ class GovukComponent::TableComponent::HeadComponent < GovukComponent::Base
11
11
  attr_reader :row_data
12
12
 
13
13
  def initialize(rows: nil, classes: [], html_attributes: {})
14
- super(classes: classes, html_attributes: html_attributes)
14
+ super(classes:, html_attributes:)
15
15
 
16
16
  build_rows_from_row_data(rows)
17
17
  end
@@ -1,16 +1,16 @@
1
1
  class GovukComponent::TableComponent::RowComponent < GovukComponent::Base
2
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
- scope: scope,
5
- header: header,
6
- text: text,
7
- numeric: numeric,
8
- width: width,
9
- parent: parent,
10
- rowspan: rowspan,
11
- colspan: colspan,
12
- classes: classes,
13
- html_attributes: html_attributes,
4
+ scope:,
5
+ header:,
6
+ text:,
7
+ numeric:,
8
+ width:,
9
+ parent:,
10
+ rowspan:,
11
+ colspan:,
12
+ classes:,
13
+ html_attributes:,
14
14
  &block
15
15
  )
16
16
  end
@@ -21,7 +21,7 @@ class GovukComponent::TableComponent::RowComponent < GovukComponent::Base
21
21
  @first_cell_is_header = first_cell_is_header
22
22
  @parent = parent
23
23
 
24
- super(classes: classes, html_attributes: html_attributes)
24
+ super(classes:, html_attributes:)
25
25
 
26
26
  build_cells_from_cell_data(cell_data)
27
27
  end
@@ -14,7 +14,7 @@ module GovukComponent
14
14
  @first_cell_is_header = first_cell_is_header
15
15
  @caption_text = caption
16
16
 
17
- super(classes: classes, html_attributes: html_attributes)
17
+ super(classes:, html_attributes:)
18
18
 
19
19
  # when no rows are passed in it's likely we're taking the slot approach
20
20
  return unless rows.presence
@@ -32,12 +32,12 @@ module GovukComponent
32
32
  def build(head_data, body_data, foot_data, caption_text)
33
33
  with_caption(text: caption_text)
34
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)
35
+ with_body(rows: body_data, first_cell_is_header:)
36
+ with_foot(rows: foot_data, first_cell_is_header:)
37
37
  end
38
38
 
39
39
  def default_attributes
40
- { id: id, class: "#{brand}-table" }
40
+ { id:, class: "#{brand}-table" }
41
41
  end
42
42
  end
43
43
  end
@@ -7,7 +7,7 @@ class GovukComponent::TagComponent < GovukComponent::Base
7
7
  @text = text
8
8
  @colour = colour
9
9
 
10
- super(classes: classes, html_attributes: html_attributes)
10
+ super(classes:, html_attributes:)
11
11
  end
12
12
 
13
13
  def call
@@ -4,10 +4,10 @@ module GovukComponent
4
4
  GovukComponent::TaskListComponent::StatusComponent.new(
5
5
  id_prefix: @id_prefix,
6
6
  count: @count,
7
- text: text,
8
- cannot_start_yet: cannot_start_yet,
9
- classes: classes,
10
- html_attributes: html_attributes,
7
+ text:,
8
+ cannot_start_yet:,
9
+ classes:,
10
+ html_attributes:,
11
11
  &block
12
12
  )
13
13
  end
@@ -16,11 +16,11 @@ module GovukComponent
16
16
  GovukComponent::TaskListComponent::TitleComponent.new(
17
17
  id_prefix: @id_prefix,
18
18
  count: @count,
19
- text: text,
20
- href: href,
21
- hint: hint,
22
- classes: classes,
23
- html_attributes: html_attributes,
19
+ text:,
20
+ href:,
21
+ hint:,
22
+ classes:,
23
+ html_attributes:,
24
24
  &block
25
25
  )
26
26
  end
@@ -36,7 +36,7 @@ module GovukComponent
36
36
  @id_prefix = id_prefix
37
37
  @count = count
38
38
 
39
- super(classes: classes, html_attributes: html_attributes)
39
+ super(classes:, html_attributes:)
40
40
  end
41
41
 
42
42
  def call
@@ -64,15 +64,15 @@ module GovukComponent
64
64
  end
65
65
 
66
66
  def default_attributes
67
- { class: 'govuk-task-list__item' }
67
+ { class: "#{brand}-task-list__item" }
68
68
  end
69
69
 
70
70
  def title_attributes
71
- { text: raw_title, href: href, hint: hint }
71
+ { text: raw_title, href:, hint: }
72
72
  end
73
73
 
74
74
  def html_attributes_with_link_class
75
- html_attributes.tap { |h| h[:class].append("govuk-task-list__item--with-link") }
75
+ html_attributes.tap { |h| h[:class].append("#{brand}-task-list__item--with-link") }
76
76
  end
77
77
 
78
78
  def status_attributes
@@ -8,7 +8,7 @@ module GovukComponent
8
8
  @id_prefix = id_prefix
9
9
  @cannot_start_yet = cannot_start_yet
10
10
 
11
- super(classes: classes, html_attributes: html_attributes)
11
+ super(classes:, html_attributes:)
12
12
  end
13
13
 
14
14
  def call
@@ -24,8 +24,8 @@ module GovukComponent
24
24
  def default_attributes
25
25
  {
26
26
  class: class_names(
27
- "govuk-task-list__status",
28
- "govuk-task-list__status--cannot-start-yet" => cannot_start_yet,
27
+ "#{brand}-task-list__status",
28
+ "#{brand}-task-list__status--cannot-start-yet" => cannot_start_yet,
29
29
  ),
30
30
  id: [id_prefix, count, "status"].compact.join("-"),
31
31
  }
@@ -11,7 +11,7 @@ module GovukComponent
11
11
  @id_prefix = id_prefix
12
12
  @count = count
13
13
 
14
- super(classes: classes, html_attributes: html_attributes)
14
+ super(classes:, html_attributes:)
15
15
  end
16
16
 
17
17
  def call
@@ -27,15 +27,15 @@ module GovukComponent
27
27
  def hint_content
28
28
  return if hint.blank?
29
29
 
30
- tag.div(hint, class: "govuk-task-list__hint", id: hint_id)
30
+ tag.div(hint, class: "#{brand}-task-list__hint", id: hint_id)
31
31
  end
32
32
 
33
33
  def default_attributes
34
- { class: "govuk-task-list__name-and-hint" }
34
+ { class: "#{brand}-task-list__name-and-hint" }
35
35
  end
36
36
 
37
37
  def link_attributes
38
- { class: "govuk-task-list__link", **aria_described_by_attributes }
38
+ { class: "#{brand}-task-list__link", **aria_described_by_attributes }
39
39
  end
40
40
 
41
41
  def aria_described_by_attributes
@@ -2,14 +2,14 @@ module GovukComponent
2
2
  class TaskListComponent < GovukComponent::Base
3
3
  renders_many :items, ->(title: nil, href: nil, hint: nil, status: {}, classes: [], html_attributes: {}) do
4
4
  GovukComponent::TaskListComponent::ItemComponent.new(
5
- title: title,
6
- href: href,
7
- hint: hint,
5
+ title:,
6
+ href:,
7
+ hint:,
8
8
  id_prefix: @id_prefix,
9
9
  count: @count,
10
- status: status,
11
- classes: classes,
12
- html_attributes: html_attributes
10
+ status:,
11
+ classes:,
12
+ html_attributes:
13
13
  )
14
14
  end
15
15
 
@@ -17,7 +17,7 @@ module GovukComponent
17
17
  @id_prefix = id_prefix
18
18
  @count = 0
19
19
 
20
- super(classes: classes, html_attributes: html_attributes)
20
+ super(classes:, html_attributes:)
21
21
  end
22
22
 
23
23
  def call
@@ -31,7 +31,7 @@ module GovukComponent
31
31
  private
32
32
 
33
33
  def default_attributes
34
- { class: 'govuk-task-list' }
34
+ { class: "#{brand}-task-list" }
35
35
  end
36
36
  end
37
37
  end
@@ -6,7 +6,7 @@ class GovukComponent::WarningTextComponent < GovukComponent::Base
6
6
  @icon = icon
7
7
  @icon_fallback_text = icon_fallback_text
8
8
 
9
- super(classes: classes, html_attributes: html_attributes)
9
+ super(classes:, html_attributes:)
10
10
  end
11
11
 
12
12
  def call
@@ -3,41 +3,49 @@ require "html_attributes_utils"
3
3
  module GovukLinkHelper
4
4
  using HTMLAttributesUtils
5
5
 
6
- def govuk_link_to(name, href = nil, new_tab: false, inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
7
- link_args = extract_link_args(new_tab: new_tab, inverse: inverse, muted: muted, no_underline: no_underline, no_visited_state: no_visited_state, text_colour: text_colour, **kwargs)
8
- link_text = build_text(name, visually_hidden_prefix: visually_hidden_prefix, visually_hidden_suffix: visually_hidden_suffix)
6
+ def govuk_link_to(a, b = nil, new_tab: false, inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
7
+ (block_given?) ? (name, href = nil, a) : (name, href = a, b)
8
+
9
+ link_args = extract_link_args(new_tab:, inverse:, muted:, no_underline:, no_visited_state:, text_colour:, **kwargs)
10
+ link_text = build_text(name, new_tab:, visually_hidden_prefix:, visually_hidden_suffix:)
9
11
 
10
12
  if block_given?
11
- link_to(link_text, **link_args, &block)
13
+ link_to(href, **link_args, &block)
12
14
  else
13
15
  link_to(link_text, href, **link_args)
14
16
  end
15
17
  end
16
18
 
17
- def govuk_mail_to(email_address, name = nil, new_tab: false, inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
18
- link_args = extract_link_args(new_tab: new_tab, inverse: inverse, muted: muted, no_underline: no_underline, no_visited_state: no_visited_state, text_colour: text_colour, **kwargs)
19
- link_text = build_text(name, visually_hidden_prefix: visually_hidden_prefix, visually_hidden_suffix: visually_hidden_suffix)
19
+ def govuk_mail_to(a, b = nil, inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
20
+ (block_given?) ? (email_address, name = a, nil) : (email_address, name = a, b)
21
+
22
+ link_args = extract_link_args(inverse:, muted:, no_underline:, no_visited_state:, text_colour:, **kwargs)
23
+ link_text = build_text(name, visually_hidden_prefix:, visually_hidden_suffix:)
20
24
 
21
25
  mail_to(email_address, link_text, **link_args, &block)
22
26
  end
23
27
 
24
- def govuk_button_to(name, href = nil, disabled: false, inverse: false, secondary: false, warning: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
25
- button_args = extract_button_args(new_tab: false, disabled: disabled, inverse: inverse, secondary: secondary, warning: warning, **kwargs)
26
- button_text = build_text(name, visually_hidden_prefix: visually_hidden_prefix, visually_hidden_suffix: visually_hidden_suffix)
28
+ def govuk_button_to(a, b = nil, disabled: false, inverse: false, secondary: false, warning: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
29
+ (block_given?) ? (name, href = nil, a) : (name, href = a, b)
30
+
31
+ button_args = extract_button_args(new_tab: false, disabled:, inverse:, secondary:, warning:, **kwargs)
32
+ button_text = build_text(name, visually_hidden_prefix:, visually_hidden_suffix:)
27
33
 
28
34
  if block_given?
29
- button_to(name, **button_args, &block)
35
+ button_to(href, **button_args, &block)
30
36
  else
31
37
  button_to(button_text, href, **button_args)
32
38
  end
33
39
  end
34
40
 
35
- def govuk_button_link_to(name, href = nil, new_tab: false, disabled: false, inverse: false, secondary: false, warning: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
36
- button_args = extract_button_link_args(new_tab: new_tab, disabled: disabled, inverse: inverse, secondary: secondary, warning: warning, **kwargs)
37
- button_text = build_text(name, visually_hidden_prefix: visually_hidden_prefix, visually_hidden_suffix: visually_hidden_suffix)
41
+ def govuk_button_link_to(a, b = nil, new_tab: false, disabled: false, inverse: false, secondary: false, warning: false, visually_hidden_prefix: nil, visually_hidden_suffix: nil, **kwargs, &block)
42
+ (block_given?) ? (name, href = nil, a) : (name, href = a, b)
43
+
44
+ button_args = extract_button_link_args(new_tab:, disabled:, inverse:, secondary:, warning:, **kwargs)
45
+ button_text = build_text(name, new_tab:, visually_hidden_prefix:, visually_hidden_suffix:)
38
46
 
39
47
  if block_given?
40
- link_to(name, **button_args, &block)
48
+ link_to(href, **button_args, &block)
41
49
  else
42
50
  link_to(button_text, href, **button_args)
43
51
  end
@@ -80,7 +88,7 @@ module GovukLinkHelper
80
88
  private
81
89
 
82
90
  def new_tab_args(new_tab)
83
- new_tab ? { target: "_blank", rel: "noreferrer noopener" } : {}
91
+ new_tab != false ? { target: "_blank", rel: "noreferrer noopener" } : {}
84
92
  end
85
93
 
86
94
  def button_attributes(disabled)
@@ -91,7 +99,7 @@ private
91
99
  Rails.logger.warn(actions_warning_message(kwargs.fetch(:action))) if kwargs.key?(:action)
92
100
  Rails.logger.warn(controller_warning_message(kwargs.fetch(:controller))) if kwargs.key?(:controller)
93
101
 
94
- link_classes = extract_link_classes(inverse: inverse, muted: muted, no_underline: no_underline, no_visited_state: no_visited_state, text_colour: text_colour)
102
+ link_classes = extract_link_classes(inverse:, muted:, no_underline:, no_visited_state:, text_colour:)
95
103
 
96
104
  { **link_classes, **new_tab_args(new_tab) }.deep_merge_html_attributes(kwargs)
97
105
  end
@@ -100,13 +108,13 @@ private
100
108
  Rails.logger.warn(actions_warning_message(kwargs.fetch(:action))) if kwargs.key?(:action)
101
109
  Rails.logger.warn(controller_warning_message(kwargs.fetch(:controller))) if kwargs.key?(:controller)
102
110
 
103
- button_classes = extract_button_classes(inverse: inverse, secondary: secondary, warning: warning)
111
+ button_classes = extract_button_classes(inverse:, secondary:, warning:)
104
112
 
105
113
  { **button_classes, **button_attributes(disabled), **new_tab_args(new_tab) }.deep_merge_html_attributes(kwargs)
106
114
  end
107
115
 
108
116
  def extract_button_args(disabled: false, inverse: false, secondary: false, warning: false, **kwargs)
109
- button_classes = extract_button_classes(inverse: inverse, secondary: secondary, warning: warning)
117
+ button_classes = extract_button_classes(inverse:, secondary:, warning:)
110
118
 
111
119
  { **button_classes, **button_attributes(disabled) }.deep_merge_html_attributes(kwargs)
112
120
  end
@@ -114,11 +122,11 @@ private
114
122
  def extract_link_classes(inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false)
115
123
  {
116
124
  class: govuk_link_classes(
117
- inverse: inverse,
118
- muted: muted,
119
- no_underline: no_underline,
120
- no_visited_state: no_visited_state,
121
- text_colour: text_colour,
125
+ inverse:,
126
+ muted:,
127
+ no_underline:,
128
+ no_visited_state:,
129
+ text_colour:,
122
130
  )
123
131
  }
124
132
  end
@@ -126,9 +134,9 @@ private
126
134
  def extract_button_classes(inverse: false, secondary: false, warning: false)
127
135
  {
128
136
  class: govuk_button_classes(
129
- inverse: inverse,
130
- secondary: secondary,
131
- warning: warning
137
+ inverse:,
138
+ secondary:,
139
+ warning:
132
140
  )
133
141
  }
134
142
  end
@@ -137,13 +145,29 @@ private
137
145
  Govuk::Components.brand
138
146
  end
139
147
 
140
- def build_text(text, visually_hidden_prefix:, visually_hidden_suffix:)
148
+ def build_text(text, visually_hidden_prefix:, visually_hidden_suffix:, new_tab: false)
141
149
  return nil if text.nil?
142
150
 
143
151
  prefix = (visually_hidden_prefix.present?) ? visually_hidden_prefix + " " : nil
144
152
  suffix = (visually_hidden_suffix.present?) ? " " + visually_hidden_suffix : nil
145
153
 
146
- safe_join([govuk_visually_hidden(prefix), text, govuk_visually_hidden(suffix)].compact)
154
+ parts = [govuk_visually_hidden(prefix), text, govuk_visually_hidden(suffix), new_tab_text(new_tab)]
155
+
156
+ safe_join(parts.compact)
157
+ end
158
+
159
+ def new_tab_text(new_tab)
160
+ return if new_tab.blank?
161
+
162
+ text = if new_tab == true
163
+ Govuk::Components.config.default_link_new_tab_text
164
+ else
165
+ new_tab
166
+ end
167
+
168
+ return if text.blank?
169
+
170
+ text.starts_with?(" ") ? text : " " + text
147
171
  end
148
172
 
149
173
  def actions_warning_message(value)
@@ -2,7 +2,13 @@ module GovukVisuallyHiddenHelper
2
2
  def govuk_visually_hidden(text = nil, &block)
3
3
  return if text.blank? && block.nil?
4
4
 
5
- tag.span(text, class: "govuk-visually-hidden", &block)
5
+ tag.span(text, class: "#{brand}-visually-hidden", &block)
6
+ end
7
+
8
+ private
9
+
10
+ def brand
11
+ Govuk::Components.brand
6
12
  end
7
13
  end
8
14
 
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '5.0.2'.freeze
3
+ VERSION = '5.1.0b1'.freeze
4
4
  end
5
5
  end
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: 5.0.2
4
+ version: 5.1.0b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-05 00:00:00.000000000 Z
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: '3.9'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '3.10'
56
+ version: '3.11'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: '3.9'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '3.10'
66
+ version: '3.11'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: deep_merge
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -126,14 +126,14 @@ dependencies:
126
126
  requirements:
127
127
  - - '='
128
128
  - !ruby/object:Gem::Version
129
- version: 4.13.0
129
+ version: 4.14.0
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - '='
135
135
  - !ruby/object:Gem::Version
136
- version: 4.13.0
136
+ version: 4.14.0
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: sassc-rails
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -294,14 +294,14 @@ dependencies:
294
294
  requirements:
295
295
  - - "~>"
296
296
  - !ruby/object:Gem::Version
297
- version: 0.24.0
297
+ version: 0.26.0
298
298
  type: :development
299
299
  prerelease: false
300
300
  version_requirements: !ruby/object:Gem::Requirement
301
301
  requirements:
302
302
  - - "~>"
303
303
  - !ruby/object:Gem::Version
304
- version: 0.24.0
304
+ version: 0.26.0
305
305
  - !ruby/object:Gem::Dependency
306
306
  name: webrick
307
307
  requirement: !ruby/object:Gem::Requirement
@@ -327,7 +327,6 @@ files:
327
327
  - README.md
328
328
  - Rakefile
329
329
  - app/components/govuk_component.rb
330
- - app/components/govuk_component/accordion_component.html.erb
331
330
  - app/components/govuk_component/accordion_component.rb
332
331
  - app/components/govuk_component/accordion_component/section_component.html.erb
333
332
  - app/components/govuk_component/accordion_component/section_component.rb
@@ -410,11 +409,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
410
409
  version: '0'
411
410
  required_rubygems_version: !ruby/object:Gem::Requirement
412
411
  requirements:
413
- - - ">="
412
+ - - ">"
414
413
  - !ruby/object:Gem::Version
415
- version: '0'
414
+ version: 1.3.1
416
415
  requirements: []
417
- rubygems_version: 3.2.33
416
+ rubygems_version: 3.3.26
418
417
  signing_key:
419
418
  specification_version: 4
420
419
  summary: GOV.UK Components for Ruby on Rails
@@ -1,5 +0,0 @@
1
- <%= tag.div(**html_attributes) do %>
2
- <% sections.each do |section| %>
3
- <%= section %>
4
- <% end %>
5
- <% end %>