govuk-components 5.7.0 → 5.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86b283115f0094a912e569312215bc4a235bc04e19d7f627664d3e3ce99d0394
4
- data.tar.gz: 0201b249f6d81553c39be2cdb6a5634898365bbed9f8fab593e816bc24d1ebf0
3
+ metadata.gz: f9f9b97bd2cefab7d3e4b90d2962b42d5990c799edec4cb2caff27d5516cc796
4
+ data.tar.gz: c27cb1a17be342e9390d6fdc6411b2845a004faf1de63758beba22053e369387
5
5
  SHA512:
6
- metadata.gz: 04fef0c27172729fadee44b72e31a619f34da79b9744d08e7fdf321bfa1bc45600641aa365d05cb3a5c7b79129e28440c8d5f7752958c6d66419f11c3c826d25
7
- data.tar.gz: 9578a53753ed0e73414696fa9d00ab0d27d5f64ae28bddc38c15aea26fadc2bb75db628068cf0127ead4dfa2b91b75a10ddb20184d742d12f1e04b8a0f7a22d0
6
+ metadata.gz: 38c6eefcede3afca135ff91c1423fcce1ad0b5507eb3929d04593c9ccfb553ce9604bf4d5c8a0bd2eed0dd0dd67dffcd5557f45fdef70b5330b3ec4b9b4c0f36
7
+ data.tar.gz: 8221659ffb458573a2720d850adad36701d75048658f0afe5e69c100946d70c1e18bc8abb32546bb0b6a578de46f66154cb16090c463d9e19464765519a1212a
data/README.md CHANGED
@@ -6,10 +6,10 @@
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.7.0-brightgreen)](https://design-system.service.gov.uk)
9
+ [![GOV.UK Design System version](https://img.shields.io/badge/GOV.UK%20Design%20System-5.8.0-brightgreen)](https://design-system.service.gov.uk)
10
10
  [![ViewComponent](https://img.shields.io/badge/ViewComponent-3.16.0-brightgreen)](https://viewcomponent.org/)
11
- [![Rails](https://img.shields.io/badge/Rails-7.0.8%20%E2%95%B1%207.1.3-E16D6D)](https://weblog.rubyonrails.org/releases/)
12
- [![Ruby](https://img.shields.io/badge/Ruby-3.1.6%20%20%E2%95%B1%203.2.4%20%20%E2%95%B1%203.3.4-E16D6D)](https://www.ruby-lang.org/en/downloads/)
11
+ [![Rails](https://img.shields.io/badge/Rails-7.1.5%20%E2%95%B1%207.2.2%20%E2%95%B1%208.0.0-E16D6D)](https://weblog.rubyonrails.org/releases/)
12
+ [![Ruby](https://img.shields.io/badge/Ruby-3.1.6%20%20%E2%95%B1%203.2.6%20%20%E2%95%B1%203.3.6-E16D6D)](https://www.ruby-lang.org/en/downloads/)
13
13
 
14
14
  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.
15
15
 
@@ -1,6 +1,6 @@
1
1
  <%= tag.div(**html_attributes) do %>
2
2
  <div class="<%= brand %>-summary-card__title-wrapper">
3
- <%= tag.h2(title, class: "#{brand}-summary-card__title") %>
3
+ <%= content_tag(heading_level, title, class: "#{brand}-summary-card__title") %>
4
4
 
5
5
  <% if actions.any? %>
6
6
  <ul class="<%= brand %>-summary-card__actions">
@@ -1,11 +1,12 @@
1
1
  class GovukComponent::SummaryListComponent::CardComponent < GovukComponent::Base
2
- attr_reader :title
2
+ attr_reader :title, :heading_level
3
3
 
4
4
  renders_many :actions
5
5
  renders_one :summary_list, "GovukComponent::SummaryListComponent"
6
6
 
7
- def initialize(title:, actions: [], classes: [], html_attributes: {})
7
+ def initialize(title:, heading_level: 2, actions: [], classes: [], html_attributes: {})
8
8
  @title = title
9
+ @heading_level = heading_tag(heading_level)
9
10
  actions.each { |a| with_action { a } } if actions.any?
10
11
 
11
12
  super(classes:, html_attributes:)
@@ -17,6 +18,12 @@ private
17
18
  { class: "#{brand}-summary-card" }
18
19
  end
19
20
 
21
+ def heading_tag(level)
22
+ fail(ArgumentError, "heading_level must be 1-6") unless level.in?(1..6)
23
+
24
+ "h#{level}"
25
+ end
26
+
20
27
  def action_text(action)
21
28
  safe_join([action, tag.span(" (" + title + ")", class: "#{brand}-visually-hidden")])
22
29
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '5.7.0'.freeze
3
+ VERSION = '5.8.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.7.0
4
+ version: 5.8.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-10-11 00:00:00.000000000 Z
11
+ date: 2025-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -56,20 +56,20 @@ dependencies:
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '3.9'
59
+ version: '3.18'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '3.17'
62
+ version: '3.22'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '3.9'
69
+ version: '3.18'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '3.17'
72
+ version: '3.22'
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: 5.0.2
135
+ version: 5.0.7
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: 5.0.2
142
+ version: 5.0.7
143
143
  - !ruby/object:Gem::Dependency
144
144
  name: sassc-rails
145
145
  requirement: !ruby/object:Gem::Requirement
@@ -230,14 +230,14 @@ dependencies:
230
230
  requirements:
231
231
  - - "~>"
232
232
  - !ruby/object:Gem::Version
233
- version: 4.4.0
233
+ version: 4.5.1
234
234
  type: :development
235
235
  prerelease: false
236
236
  version_requirements: !ruby/object:Gem::Requirement
237
237
  requirements:
238
238
  - - "~>"
239
239
  - !ruby/object:Gem::Version
240
- version: 4.4.0
240
+ version: 4.5.1
241
241
  - !ruby/object:Gem::Dependency
242
242
  name: rubypants
243
243
  requirement: !ruby/object:Gem::Requirement
@@ -314,14 +314,14 @@ dependencies:
314
314
  requirements:
315
315
  - - "~>"
316
316
  - !ruby/object:Gem::Version
317
- version: 1.8.1
317
+ version: 1.9.0
318
318
  type: :development
319
319
  prerelease: false
320
320
  version_requirements: !ruby/object:Gem::Requirement
321
321
  requirements:
322
322
  - - "~>"
323
323
  - !ruby/object:Gem::Version
324
- version: 1.8.1
324
+ version: 1.9.0
325
325
  description: This library provides view components for the GOV.UK Design System. It
326
326
  makes creating services more familiar for Ruby on Rails developers.
327
327
  email: