govuk-components 3.2.0b1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: baf575169df70b76806ee48f46c1043b2923df01f0f03c60fe80b6a2ed7b2e47
4
- data.tar.gz: 9cfdb4dc1d0fbd2e1bed77df6efc633f2f1a33ee068664e1562e523e4088f761
3
+ metadata.gz: 82c6c791cb04272f6d9c26584648e77df868106c405b03e8ab45de1d887e982c
4
+ data.tar.gz: 97a343854b2584929d0bbe0e184773463cfc208c6d100d6719650fe117839607
5
5
  SHA512:
6
- metadata.gz: e27fccc13b9c2d7d590f75f0617037ad9be59598d38a7422d7b93e61ec5c1ca021b31f8bf4ad075ebe9e3869038cff7696e19c119398c7aa58890a585e1e976c
7
- data.tar.gz: 55d4ac92ddab808a1c33d360172f318bf56eb801c0b44532920c1b91f57efe7d625cf0ab31828443c96e1568d59eb8909f44cc290093f823a3e6c4b6be69d7bd
6
+ metadata.gz: fab4a1347e860c70cfa70314c634c550e776fce5a3b661877c0daaba84fa1da8678c56a58dbae572299ac6ddf279ee8277ae29509edc46933bb47c4dc94e7173
7
+ data.tar.gz: 678e902ca916bc9ad00944d555e8678b3897071f2b1f50e3eeb99585f5f412e3d91d22a7909c882b336ec98be4beadfd2ed488485fd472996c8b5552901782ab
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  [![GitHub license](https://img.shields.io/github/license/DFE-Digital/govuk-components)](https://github.com/DFE-Digital/govuk-components/blob/main/LICENSE)
9
9
  [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-4.3.0-brightgreen)](https://design-system.service.gov.uk)
10
10
  [![Rails](https://img.shields.io/badge/Rails-6.1.5%20%E2%95%B1%207.0.3-E16D6D)](https://weblog.rubyonrails.org/releases/)
11
- [![Ruby](https://img.shields.io/badge/Ruby-2.7.5%20%20%E2%95%B1%203.0.3%20%20%E2%95%B1%203.1.2-E16D6D)](https://www.ruby-lang.org/en/downloads/)
11
+ [![Ruby](https://img.shields.io/badge/Ruby-2.7.6%20%20%E2%95%B1%203.0.3%20%20%E2%95%B1%203.1.2-E16D6D)](https://www.ruby-lang.org/en/downloads/)
12
12
 
13
13
  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.
14
14
 
@@ -1,7 +1,7 @@
1
1
  class GovukComponent::BackLinkComponent < GovukComponent::Base
2
2
  attr_reader :text, :href
3
3
 
4
- def initialize(href:, text: 'Back', classes: [], html_attributes: {})
4
+ def initialize(href:, text: config.default_back_link_text, classes: [], html_attributes: {})
5
5
  @text = text
6
6
  @href = href
7
7
 
@@ -3,6 +3,8 @@ class GovukComponent::Base < ViewComponent::Base
3
3
 
4
4
  attr_reader :html_attributes
5
5
 
6
+ delegate :config, to: Govuk::Components
7
+
6
8
  def initialize(classes:, html_attributes:)
7
9
  if classes.nil?
8
10
  Rails.logger.warn("classes is nil, if no custom classes are needed omit the param")
@@ -1,7 +1,12 @@
1
1
  class GovukComponent::BreadcrumbsComponent < GovukComponent::Base
2
2
  attr_reader :breadcrumbs, :hide_in_print, :collapse_on_mobile
3
3
 
4
- def initialize(breadcrumbs:, hide_in_print: false, collapse_on_mobile: false, classes: [], html_attributes: {})
4
+ def initialize(breadcrumbs:,
5
+ hide_in_print: config.default_breadcrumbs_hide_in_print,
6
+ collapse_on_mobile: config.default_breadcrumbs_collapse_on_mobile,
7
+ classes: [],
8
+ html_attributes: {})
9
+
5
10
  @breadcrumbs = build_list(breadcrumbs)
6
11
  @hide_in_print = hide_in_print
7
12
  @collapse_on_mobile = collapse_on_mobile
@@ -4,7 +4,13 @@ module GovukComponent
4
4
 
5
5
  attr_accessor :aria_label, :hidden, :hide_in_print
6
6
 
7
- def initialize(aria_label: "Cookie banner", hidden: false, hide_in_print: true, classes: [], html_attributes: {})
7
+ def initialize(
8
+ aria_label: config.default_cookie_banner_aria_label,
9
+ hidden: false,
10
+ hide_in_print: config.default_cookie_banner_hide_in_print,
11
+ classes: [],
12
+ html_attributes: {}
13
+ )
8
14
  @aria_label = aria_label
9
15
  @hidden = hidden
10
16
  @hide_in_print = hide_in_print
@@ -11,13 +11,13 @@ class GovukComponent::FooterComponent < GovukComponent::Base
11
11
  classes: [],
12
12
  container_classes: [],
13
13
  container_html_attributes: {},
14
- copyright_text: default_copright_text,
15
- copyright_url: default_copyright_url,
14
+ copyright_text: config.default_footer_copyright_text,
15
+ copyright_url: config.default_footer_copyright_url,
16
16
  html_attributes: {},
17
17
  meta_items: {},
18
18
  meta_items_title: "Support links",
19
19
  meta_licence: nil,
20
- meta_text: nil,
20
+ meta_text: config.default_footer_component_meta_text,
21
21
  meta_classes: [],
22
22
  meta_html_attributes: {}
23
23
  )
@@ -84,12 +84,4 @@ private
84
84
  def build_copyright(text, url)
85
85
  link_to(text, url, class: %w(govuk-footer__link govuk-footer__copyright-logo))
86
86
  end
87
-
88
- def default_copright_text
89
- raw(%(© Crown copyright))
90
- end
91
-
92
- def default_copyright_url
93
- "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
94
- end
95
87
  end
@@ -16,15 +16,15 @@ class GovukComponent::HeaderComponent < GovukComponent::Base
16
16
 
17
17
  def initialize(classes: [],
18
18
  html_attributes: {},
19
- logotype: 'GOV.UK',
19
+ logotype: config.default_header_logotype,
20
20
  crown: true,
21
21
  crown_fallback_image_path: nil,
22
- homepage_url: '/',
23
- menu_button_label: 'Show or hide navigation menu',
22
+ homepage_url: config.default_header_homepage_url,
23
+ menu_button_label: config.default_header_menu_button_label,
24
24
  navigation_classes: [],
25
- navigation_label: 'Navigation menu',
26
- service_name: nil,
27
- service_url: '/',
25
+ navigation_label: config.default_header_navigation_label,
26
+ service_name: config.default_header_service_name,
27
+ service_url: config.default_header_service_url,
28
28
  container_classes: nil)
29
29
 
30
30
  @logotype = logotype
@@ -4,7 +4,17 @@ class GovukComponent::NotificationBannerComponent < GovukComponent::Base
4
4
  renders_one :title_html
5
5
  renders_many :headings, "Heading"
6
6
 
7
- def initialize(title_text: nil, text: nil, role: nil, success: false, title_heading_level: 2, title_id: "govuk-notification-banner-title", disable_auto_focus: nil, classes: [], html_attributes: {})
7
+ def initialize(
8
+ title_text: nil,
9
+ text: nil,
10
+ role: nil,
11
+ success: config.default_notification_title_success,
12
+ title_heading_level: config.default_notification_title_heading_level,
13
+ title_id: config.default_notification_banner_title_id,
14
+ disable_auto_focus: config.default_notification_disable_auto_focus,
15
+ classes: [],
16
+ html_attributes: {}
17
+ )
8
18
  @title_text = title_text
9
19
  @title_id = title_id
10
20
  @text = text
@@ -2,20 +2,19 @@ class GovukComponent::PaginationComponent::AdjacentPage < GovukComponent::Base
2
2
  attr_reader :href, :label_text, :text, :suffix, :block_mode, :visually_hidden_text
3
3
  alias_method :block_mode?, :block_mode
4
4
 
5
- def initialize(href:, suffix:, visually_hidden_text:, text:, block_mode: true, label_text: nil, classes: [], html_attributes: {})
5
+ def initialize(href:, suffix:, text:, block_mode: true, label_text: nil, classes: [], html_attributes: {})
6
6
  @href = href
7
7
  @label_text = label_text
8
8
  @text = text
9
9
  @block_mode = block_mode
10
10
  @suffix = suffix
11
- @visually_hidden_text = visually_hidden_text
12
11
 
13
12
  super(html_attributes: html_attributes, classes: classes)
14
13
  end
15
14
 
16
15
  def call
17
16
  tag.div(**html_attributes) do
18
- tag.a(href: href, class: %w(govuk-link govuk-pagination__link), rel: suffix, aria: { label: aria_label }) do
17
+ tag.a(href: href, class: %w(govuk-link govuk-pagination__link), rel: suffix) do
19
18
  safe_join([body, divider, label_content])
20
19
  end
21
20
  end
@@ -1,12 +1,11 @@
1
1
  class GovukComponent::PaginationComponent::NextPage < GovukComponent::PaginationComponent::AdjacentPage
2
- def initialize(href:, text:, label_text: nil, visually_hidden_text: nil, block_mode: true, classes: [], html_attributes: {})
2
+ def initialize(href:, text:, label_text: nil, block_mode: true, classes: [], html_attributes: {})
3
3
  super(
4
4
  suffix: "next",
5
5
  text: text,
6
6
  href: href,
7
7
  label_text: label_text,
8
8
  block_mode: block_mode,
9
- visually_hidden_text: visually_hidden_text,
10
9
  classes: classes,
11
10
  html_attributes: html_attributes
12
11
  )
@@ -20,10 +19,6 @@ class GovukComponent::PaginationComponent::NextPage < GovukComponent::Pagination
20
19
 
21
20
  private
22
21
 
23
- def aria_label
24
- @visually_hidden_text || "Next page"
25
- end
26
-
27
22
  def arrow
28
23
  tag.svg(class: "govuk-pagination__icon govuk-pagination__icon--next", xmlns: "http://www.w3.org/2000/svg", height: "13", width: "15", focusable: "false", viewBox: "0 0 15 13", aria: { hidden: "true" }) do
29
24
  tag.path(d: "m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z")
@@ -1,12 +1,11 @@
1
1
  class GovukComponent::PaginationComponent::PreviousPage < GovukComponent::PaginationComponent::AdjacentPage
2
- def initialize(href:, text:, label_text: nil, visually_hidden_text: nil, block_mode: true, classes: [], html_attributes: {})
2
+ def initialize(href:, text:, label_text: nil, block_mode: true, classes: [], html_attributes: {})
3
3
  super(
4
4
  suffix: "prev",
5
5
  text: text,
6
6
  href: href,
7
7
  label_text: label_text,
8
8
  block_mode: block_mode,
9
- visually_hidden_text: visually_hidden_text,
10
9
  classes: classes,
11
10
  html_attributes: html_attributes
12
11
  )
@@ -14,10 +13,6 @@ class GovukComponent::PaginationComponent::PreviousPage < GovukComponent::Pagina
14
13
 
15
14
  private
16
15
 
17
- def aria_label
18
- @visually_hidden_text || "Previous page"
19
- end
20
-
21
16
  def arrow
22
17
  tag.svg(class: "govuk-pagination__icon govuk-pagination__icon--prev", xmlns: "http://www.w3.org/2000/svg", height: "13", width: "15", focusable: "false", viewBox: "0 0 15 13", aria: { hidden: "true" }) do
23
18
  tag.path(d: "m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z")
@@ -4,8 +4,6 @@ class GovukComponent::PaginationComponent < GovukComponent::Base
4
4
  attr_reader :pagy,
5
5
  :next_text,
6
6
  :previous_text,
7
- :visually_hidden_next_text,
8
- :visually_hidden_previous_text,
9
7
  :page_items,
10
8
  :previous_content,
11
9
  :next_content,
@@ -16,36 +14,38 @@ class GovukComponent::PaginationComponent < GovukComponent::Base
16
14
 
17
15
  renders_many :items, "GovukComponent::PaginationComponent::Item"
18
16
 
19
- renders_one :next_page, ->(href:, text: default_next_text, label_text: nil, visually_hidden_text: nil, classes: [], html_attributes: {}) do
17
+ renders_one :next_page, ->(href:, text: default_adjacent_text(:next), label_text: nil, classes: [], html_attributes: {}) do
20
18
  GovukComponent::PaginationComponent::NextPage.new(
21
19
  text: text,
22
20
  href: href,
23
21
  label_text: label_text,
24
22
  block_mode: block_mode?,
25
- visually_hidden_text: visually_hidden_text,
26
23
  classes: classes,
27
24
  html_attributes: html_attributes
28
25
  )
29
26
  end
30
27
 
31
- renders_one :previous_page, ->(href:, text: default_previous_text, label_text: nil, visually_hidden_text: nil, classes: [], html_attributes: {}) do
28
+ renders_one :previous_page, ->(href:, text: default_adjacent_text(:prev), label_text: nil, classes: [], html_attributes: {}) do
32
29
  GovukComponent::PaginationComponent::PreviousPage.new(
33
30
  text: text,
34
31
  href: href,
35
32
  label_text: label_text,
36
33
  block_mode: block_mode?,
37
- visually_hidden_text: visually_hidden_text,
38
34
  classes: classes,
39
35
  html_attributes: html_attributes
40
36
  )
41
37
  end
42
38
 
43
- def initialize(pagy: nil, next_text: nil, previous_text: nil, visually_hidden_next_text: nil, visually_hidden_previous_text: nil, block_mode: false, landmark_label: "results", classes: [], html_attributes: {})
39
+ def initialize(pagy: nil,
40
+ next_text: nil,
41
+ previous_text: nil,
42
+ block_mode: false,
43
+ landmark_label: config.default_pagination_landmark_label,
44
+ classes: [],
45
+ html_attributes: {})
44
46
  @pagy = pagy
45
47
  @next_text = next_text
46
48
  @previous_text = previous_text
47
- @visually_hidden_next_text = visually_hidden_next_text
48
- @visually_hidden_previous_text = visually_hidden_previous_text
49
49
  @block_mode = block_mode
50
50
  @landmark_label = landmark_label
51
51
 
@@ -94,7 +94,6 @@ private
94
94
  kwargs = {
95
95
  href: pagy_url_for(pagy, pagy.prev),
96
96
  text: @previous_text,
97
- visually_hidden_text: visually_hidden_previous_text,
98
97
  }
99
98
 
100
99
  previous_page(**kwargs.compact)
@@ -106,7 +105,6 @@ private
106
105
  kwargs = {
107
106
  href: pagy_url_for(pagy, pagy.next),
108
107
  text: @next_text,
109
- visually_hidden_text: visually_hidden_next_text,
110
108
  }
111
109
 
112
110
  next_page(**kwargs.compact)
@@ -116,11 +114,16 @@ private
116
114
  pagy.series.map { |i| item(number: i, href: pagy_url_for(pagy, i), from_pagy: true) }
117
115
  end
118
116
 
119
- def default_next_text
120
- safe_join(["Next", tag.span(class: "govuk-visually-hidden") { " page" }])
121
- end
117
+ def default_adjacent_text(side)
118
+ visible, hidden = *case side
119
+ when :next
120
+ config.default_pagination_next_text
121
+ when :prev
122
+ config.default_pagination_previous_text
123
+ end
124
+
125
+ return visible if hidden.blank?
122
126
 
123
- def default_previous_text
124
- safe_join(["Previous", tag.span(class: "govuk-visually-hidden") { " page" }])
127
+ (visible + tag.span(" #{hidden}", class: "govuk-visually-hidden")).html_safe
125
128
  end
126
129
  end
@@ -1,7 +1,12 @@
1
1
  class GovukComponent::PhaseBannerComponent < GovukComponent::Base
2
2
  attr_reader :text, :phase_tag
3
3
 
4
- def initialize(tag: nil, text: nil, classes: [], html_attributes: {})
4
+ def initialize(
5
+ tag: { text: config.default_phase_banner_tag },
6
+ text: config.default_phase_banner_text,
7
+ classes: [],
8
+ html_attributes: {}
9
+ )
5
10
  @phase_tag = tag
6
11
  @text = text
7
12
 
@@ -1,7 +1,12 @@
1
1
  class GovukComponent::SectionBreakComponent < GovukComponent::Base
2
2
  SIZES = %w(m l xl).freeze
3
3
 
4
- def initialize(visible: false, size: nil, classes: [], html_attributes: {})
4
+ def initialize(
5
+ visible: config.default_section_break_visible,
6
+ size: config.default_section_break_size,
7
+ classes: [],
8
+ html_attributes: {}
9
+ )
5
10
  @visible = visible
6
11
  @size = size
7
12
 
@@ -8,7 +8,7 @@ class GovukComponent::StartButtonComponent < GovukComponent::Base
8
8
 
9
9
  attr_reader :text, :href, :as_button
10
10
 
11
- def initialize(text:, href:, as_button: false, classes: [], html_attributes: {})
11
+ def initialize(text:, href:, as_button: config.default_start_button_as_button, classes: [], html_attributes: {})
12
12
  @text = text
13
13
  @href = href
14
14
  @as_button = as_button
@@ -1,7 +1,13 @@
1
1
  class GovukComponent::SummaryListComponent::ActionComponent < GovukComponent::Base
2
+ class VisuallyHiddenDefaultNilClass < NilClass; end
3
+
2
4
  attr_reader :href, :text, :visually_hidden_text, :attributes, :classes
3
5
 
4
- def initialize(href: nil, text: 'Change', visually_hidden_text: nil, classes: [], html_attributes: {})
6
+ def initialize(href: nil, text: 'Change', visually_hidden_text: VisuallyHiddenDefaultNilClass, classes: [], html_attributes: {})
7
+ if config.require_summary_list_action_visually_hidden_text && visually_hidden_text == VisuallyHiddenDefaultNilClass
8
+ fail(ArgumentError, "missing keyword: visually_hidden_text")
9
+ end
10
+
5
11
  super(classes: classes, html_attributes: html_attributes)
6
12
 
7
13
  @href = href
@@ -11,7 +11,7 @@ module GovukComponent
11
11
  )
12
12
  end
13
13
 
14
- def initialize(rows: nil, actions: true, borders: true, classes: [], html_attributes: {})
14
+ def initialize(rows: nil, actions: true, borders: config.default_summary_list_borders, classes: [], html_attributes: {})
15
15
  @borders = borders
16
16
  @show_actions_column = actions
17
17
 
@@ -3,7 +3,7 @@ class GovukComponent::TagComponent < GovukComponent::Base
3
3
 
4
4
  COLOURS = %w(grey green turquoise blue red purple pink orange yellow).freeze
5
5
 
6
- def initialize(text: nil, colour: nil, classes: [], html_attributes: {})
6
+ def initialize(text: nil, colour: config.default_tag_colour, classes: [], html_attributes: {})
7
7
  @text = text
8
8
  @colour = colour
9
9
 
@@ -1,10 +1,9 @@
1
1
  class GovukComponent::WarningTextComponent < GovukComponent::Base
2
- attr_reader :text, :icon_fallback_text
2
+ attr_reader :text, :icon, :icon_fallback_text
3
3
 
4
- ICON = '!'.freeze
5
-
6
- def initialize(text: nil, icon_fallback_text: 'Warning', classes: [], html_attributes: {})
4
+ def initialize(text: nil, icon_fallback_text: config.default_warning_text_icon_fallback_text, icon: config.default_warning_text_icon, classes: [], html_attributes: {})
7
5
  @text = text
6
+ @icon = icon
8
7
  @icon_fallback_text = icon_fallback_text
9
8
 
10
9
  super(classes: classes, html_attributes: html_attributes)
@@ -12,14 +11,14 @@ class GovukComponent::WarningTextComponent < GovukComponent::Base
12
11
 
13
12
  def call
14
13
  tag.div(**html_attributes) do
15
- safe_join([icon, warning_text])
14
+ safe_join([icon_element, warning_text])
16
15
  end
17
16
  end
18
17
 
19
18
  private
20
19
 
21
- def icon
22
- tag.span(ICON, class: 'govuk-warning-text__icon', aria: { hidden: true })
20
+ def icon_element
21
+ tag.span(icon, class: 'govuk-warning-text__icon', aria: { hidden: true })
23
22
  end
24
23
 
25
24
  def warning_text
@@ -1,7 +1,106 @@
1
1
  require "rails/engine"
2
+ require "active_support/configurable"
2
3
 
3
4
  module Govuk
4
5
  module Components
6
+ include ActiveSupport::Configurable
7
+
8
+ class << self
9
+ # Configure the form builder in the usual manner. All of the
10
+ # keys in {DEFAULTS} can be configured as per the example below
11
+ #
12
+ # @example
13
+ # Govuk::Components.configure do |conf|
14
+ # conf.do_some_things = 'yes'
15
+ # end
16
+ def configure
17
+ yield(config)
18
+ end
19
+
20
+ # Resets each of the configurable values to its default
21
+ #
22
+ # @note This method is only really intended for use to clean up
23
+ # during testing
24
+ def reset!
25
+ configure do |c|
26
+ DEFAULTS.each { |k, v| c.send("#{k}=", v) }
27
+ end
28
+ end
29
+ end
30
+
31
+ # @!group Defaults
32
+ #
33
+ # Default components configuration
34
+ #
35
+ # +:default_back_link_text+ Default text for the back link, defaults to +Back+
36
+ # +:default_breadcrumbs_collapse_on_mobile+ false
37
+ # +:default_breadcrumbs_hide_in_print+ false
38
+ # +:default_cookie_banner_aria_label+ "Cookie banner"
39
+ # +:default_cookie_banner_hide_in_print+ true
40
+ # +:default_header_navigation_label+ 'Navigation menu'
41
+ # +:default_header_menu_button_label+ 'Show or hide navigation menu'
42
+ # +:default_header_logotype+ 'GOV.UK'
43
+ # +:default_header_homepage_url+ '/'
44
+ # +:default_header_service_name+ nil
45
+ # +:default_header_service_url+ '/'
46
+ # +:default_footer_meta_text+ nil
47
+ # +:default_footer_copyright_text+ '© Crown copyright'
48
+ # +:default_footer_copyright_url+ "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/"
49
+ # +:default_pagination_landmark_label+ "results"
50
+ # +:default_pagination_next_text+ Default 'next' text for pagination. An +Array+ where the first item is visible and the second visually hidden. Defaults to ["Next", "page"]
51
+ # +:default_pagination_previous_text+ Default 'previous' text for pagination. An +Array+ where the first item is visible and the second visually hidden. Defaults to ["Previous", "page"]
52
+ # +:default_phase_banner_tag+ nil
53
+ # +:default_phase_banner_text+ nil
54
+ # +:default_section_break_visible+ false
55
+ # +:default_section_break_size+ Size of the section break, possible values: +m+, +l+ and +xl+. Defaults to nil.
56
+ # +:default_tag_colour+ the default colour for tags, possible values: +grey+, +green+, +turquoise+, +blue+, +red+, +purple+, +pink+, +orange+, +yellow+. Defaults to +nil+
57
+ # +:default_start_button_as_button+ false
58
+ # +:default_summary_list_borders+ true
59
+ # +:default_notification_banner_title_id+ "govuk-notification-banner-title"
60
+ # +:default_notification_disable_auto_focus+ nil
61
+ # +:default_notification_title_heading_level+ 2
62
+ # +:default_notification_title_success+ false
63
+ # +:default_warning_text_icon_fallback_text+ "Warning"
64
+ # +:default_warning_text_icon+ "!"
65
+ #
66
+ # +:require_summary_list_action_visually_hidden_text+ when true forces visually hidden text to be set for every action. It can still be explicitly skipped by passing in +nil+. Defaults to +false+
67
+ DEFAULTS = {
68
+ default_back_link_text: 'Back',
69
+ default_breadcrumbs_collapse_on_mobile: false,
70
+ default_breadcrumbs_hide_in_print: false,
71
+ default_cookie_banner_aria_label: "Cookie banner",
72
+ default_cookie_banner_hide_in_print: true,
73
+ default_header_navigation_label: 'Navigation menu',
74
+ default_header_menu_button_label: 'Show or hide navigation menu',
75
+ default_header_logotype: 'GOV.UK',
76
+ default_header_homepage_url: '/',
77
+ default_header_service_name: nil,
78
+ default_header_service_url: '/',
79
+ default_footer_meta_text: nil,
80
+ default_footer_copyright_text: '© Crown copyright',
81
+ default_footer_copyright_url: "https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/",
82
+ default_pagination_landmark_label: "results",
83
+ default_pagination_next_text: %w(Next page),
84
+ default_pagination_previous_text: %w(Previous page),
85
+ default_phase_banner_tag: nil,
86
+ default_phase_banner_text: nil,
87
+ default_section_break_visible: false,
88
+ default_section_break_size: nil,
89
+ default_tag_colour: nil,
90
+ default_start_button_as_button: false,
91
+ default_summary_list_borders: true,
92
+ default_notification_banner_title_id: "govuk-notification-banner-title",
93
+ default_notification_disable_auto_focus: nil,
94
+ default_notification_title_heading_level: 2,
95
+ default_notification_title_success: false,
96
+ default_warning_text_icon_fallback_text: "Warning",
97
+ default_warning_text_icon: "!",
98
+
99
+ require_summary_list_action_visually_hidden_text: false,
100
+ }.freeze
101
+
102
+ DEFAULTS.each_key { |k| config_accessor(k) { DEFAULTS[k] } }
103
+
5
104
  class Engine < ::Rails::Engine
6
105
  isolate_namespace Govuk::Components
7
106
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '3.2.0b1'.freeze
3
+ VERSION = '3.2.0'.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: 3.2.0b1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 2.56.2
95
+ version: 2.69.0
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 2.56.2
102
+ version: 2.69.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: deep_merge
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -438,9 +438,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
438
438
  version: '0'
439
439
  required_rubygems_version: !ruby/object:Gem::Requirement
440
440
  requirements:
441
- - - ">"
441
+ - - ">="
442
442
  - !ruby/object:Gem::Version
443
- version: 1.3.1
443
+ version: '0'
444
444
  requirements: []
445
445
  rubygems_version: 3.1.6
446
446
  signing_key: