govuk-components 5.3.1 → 5.4.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: bfb9138d8ba86a92cb9809920d7f33b7caa759733fd269c0289be8afab08d41a
4
- data.tar.gz: 93bbe281a1a5ed4d4d0d7b8e052599ec4a222534f1cd2286caca59c6cea4728d
3
+ metadata.gz: 256f2b26630618b529e87a94d317023040735cd2c8e54ea2a08d8eed10fa4a08
4
+ data.tar.gz: 3b30ab70d1558f640e57ba716a58688e919c10c1a4d7c875014f87512fbd04a0
5
5
  SHA512:
6
- metadata.gz: e0d5ee5981ae15bf402b81297b63a9a70caf177f427fc5e0206245d7d6d08e39daa83d4f7dbbd2fe3f6543fcb096578c997165aaeb54143c318b120d6e2311cc
7
- data.tar.gz: ea18f289337c0b3aa68af67184cb6250296ba016a3972a097f11456c90014b634a544268e5c5ecc147d1cbbc08c8203924f630805cf43fdd92cde04a814f9d1e
6
+ metadata.gz: 191506c0a3a60eeed0d7709f11b6cb0841835c3b682243cff33682a9413f6549008c00ac2c1ff4dde11c9f1ab74aa5afea546846cee3087997079e658166f18c
7
+ data.tar.gz: 3dc93e688f1d2182d359330ca45b15832dcfde674f56e415f9394f05c88977a7dc4b23b1e866afeb7a652ed14e0a4f3185e6e9fd048c98577c2b1f9b919856be
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.4.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
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.4.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: 5.3.1
4
+ version: 5.4.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: 2024-04-08 00:00:00.000000000 Z
11
+ date: 2024-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '6'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '8'
42
+ version: '9'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '6'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '8'
52
+ version: '9'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: view_component
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '3.9'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '3.12'
62
+ version: '3.13'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '3.9'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '3.12'
72
+ version: '3.13'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: deep_merge
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -132,14 +132,14 @@ dependencies:
132
132
  requirements:
133
133
  - - '='
134
134
  - !ruby/object:Gem::Version
135
- version: 4.16.0
135
+ version: 4.16.1
136
136
  type: :development
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
140
  - - '='
141
141
  - !ruby/object:Gem::Version
142
- version: 4.16.0
142
+ version: 4.16.1
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: sassc-rails
145
145
  requirement: !ruby/object:Gem::Requirement