govuk-components 5.3.1 → 5.3.2

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: bfb9138d8ba86a92cb9809920d7f33b7caa759733fd269c0289be8afab08d41a
4
- data.tar.gz: 93bbe281a1a5ed4d4d0d7b8e052599ec4a222534f1cd2286caca59c6cea4728d
3
+ metadata.gz: f64e55690e290bb705fcfd5f927e4670c8d7f63f17641f803acab988efefe07f
4
+ data.tar.gz: 13d64dfd86879daaa9beaf3210e3218bd8da08d317cd475a4b1e1e36ad62b234
5
5
  SHA512:
6
- metadata.gz: e0d5ee5981ae15bf402b81297b63a9a70caf177f427fc5e0206245d7d6d08e39daa83d4f7dbbd2fe3f6543fcb096578c997165aaeb54143c318b120d6e2311cc
7
- data.tar.gz: ea18f289337c0b3aa68af67184cb6250296ba016a3972a097f11456c90014b634a544268e5c5ecc147d1cbbc08c8203924f630805cf43fdd92cde04a814f9d1e
6
+ metadata.gz: 25f87296ee36dda9f7281656e66e42ae5423340857818b553d47711d0d51b854662eb426c648d14837fe9dfb49d9608ffd29fa9c2acc3894370ed89db59c4eba
7
+ data.tar.gz: f7f84c9d029d091c05eee6ebda1c365b7f44c6f834c2a44b5478d3c381beff1cc6e984b70360e3041c87ff992b0fb87848a9963ffcd245912497944092b891f4
data/README.md CHANGED
@@ -6,7 +6,7 @@
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.1.0-brightgreen)](https://design-system.service.gov.uk)
9
+ [![GOV.UK Design System version](https://img.shields.io/badge/GOV.UK%20Design%20System-5.3.1-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
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/)
@@ -31,18 +31,19 @@ class GovukComponent::NotificationBannerComponent < GovukComponent::Base
31
31
  end
32
32
 
33
33
  class Heading < GovukComponent::Base
34
- attr_reader :text, :link_href, :link_text
34
+ attr_reader :text, :link_href, :link_text, :tag
35
35
 
36
- def initialize(text: nil, link_text: nil, link_href: nil, classes: [], html_attributes: {})
36
+ def initialize(text: nil, link_text: nil, link_href: nil, tag: 'p', classes: [], html_attributes: {})
37
37
  @text = text
38
38
  @link_text = link_text
39
39
  @link_href = link_href
40
+ @tag = tag
40
41
 
41
42
  super(classes:, html_attributes:)
42
43
  end
43
44
 
44
45
  def call
45
- tag.div(**html_attributes) do
46
+ content_tag(tag, **html_attributes) do
46
47
  if text.present?
47
48
  safe_join([text, link].compact, " ")
48
49
  else
@@ -19,19 +19,16 @@ private
19
19
  end
20
20
 
21
21
  class Tab < GovukComponent::Base
22
- attr_reader :label, :text
22
+ attr_reader :label, :text, :id
23
23
 
24
- def initialize(label:, text: nil, classes: [], html_attributes: {})
24
+ def initialize(label:, text: nil, id: nil, classes: [], html_attributes: {})
25
25
  @label = label
26
26
  @text = h(text)
27
+ @id = id || label.parameterize
27
28
 
28
29
  super(classes:, html_attributes:)
29
30
  end
30
31
 
31
- def id(prefix: nil)
32
- [prefix, label.parameterize].join
33
- end
34
-
35
32
  def hidden_class(i = nil)
36
33
  return [] if i&.zero?
37
34
 
@@ -43,7 +40,7 @@ private
43
40
  end
44
41
 
45
42
  def li_link
46
- link_to(label, id(prefix: '#'), class: "#{brand}-tabs__tab")
43
+ link_to(label, "#" + id, class: "#{brand}-tabs__tab")
47
44
  end
48
45
 
49
46
  def default_attributes
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '5.3.1'.freeze
3
+ VERSION = '5.3.2'.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.3.1
4
+ version: 5.3.2
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-04-08 00:00:00.000000000 Z
11
+ date: 2024-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils