ccs-frontend_helpers 2.2.0 → 2.4.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: 5da91f1cead5cea0d782242299e6290cc1c93a9513deba6b3866f696bd5a067c
4
- data.tar.gz: 1e923993ff4a79465bf172007bfacca7d37a13d7122eb47d0fe6643d3f865080
3
+ metadata.gz: eb6707b6a138b2b393abd881035498389d19edb8ee6ee2b8575aedd7ce06ece2
4
+ data.tar.gz: 4efdde23a7e0183371a1894b5e60c835e3f30699b9d86f8023ee287d005879bc
5
5
  SHA512:
6
- metadata.gz: b4d556815d54978dd0c5a5d835dd41a6cfb5ec59330fdc1efe19cc62dadb2b151c4f12798c15941c400e9299a1fd789ed493d2b74bd3a4e8575ae5b729f1ab78
7
- data.tar.gz: c763041c52a41d534e3d286e8e84e866a8b6121455a901f9916961efc17da22008bf951b26e9523574a2d780d5f55b408c2aa9736704935f6d9c0758e4230b89
6
+ metadata.gz: 7e93fec1d87edc93a450432e199367532ab4f493f6db3b8f13946c8f9674c8ce99e7609bb6d0c9c9960020dbf3306323a8d3edccb41a53c962b519f31e4742f7
7
+ data.tar.gz: e78a6020d4f3526d84691d374076e4413b6500c26fdb8cd934d7b5220232b7cfe230b112ef4949ab8a3aadffef6b9efc9dd8d4db361afe4d6bc0be88706cccba
data/.rubocop.yml CHANGED
@@ -3,8 +3,6 @@ plugins:
3
3
  - rubocop-rails
4
4
  - rubocop-rake
5
5
  - rubocop-rspec
6
-
7
- require:
8
6
  - rubocop-capybara
9
7
 
10
8
  AllCops:
data/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.4.0] - 2025-05-13
11
+
12
+ ### Added
13
+
14
+ - Updated GOV.UK Frontend to v5.10.0
15
+ - Updated CCS Frontend to v1.4.1
16
+
17
+ ## [2.3.0] - 2025-04-17
18
+
19
+ ### Added
20
+
21
+ - Added the ability have muttons instead of links for the header links.
22
+ This is because we need to send a delete request when signing out and this was previously done by Rails UJS which was removed in Rails 7.2
23
+ - Updated CCS Frontend to v1.4.0
24
+
25
+ ### Changed
26
+
27
+ - Change from using Yarn to using Bun to manage the NodeJS packages (Internal only)
28
+ - Make Rails 7.2 the minimum required version for this Gem
29
+
10
30
  ## [2.2.0] - 2025-03-21
11
31
 
12
32
  ### Added
data/Gemfile CHANGED
@@ -16,11 +16,11 @@ gem 'simplecov', '~> 0.21'
16
16
  gem 'nokogiri-diff', '~> 0.3.0'
17
17
 
18
18
  # Gems for linting/formatting the package
19
- gem 'rubocop', '~> 1.74'
19
+ gem 'rubocop', '~> 1.75'
20
20
  gem 'rubocop-capybara', '~> 2.22'
21
- gem 'rubocop-rails', '~> 2.30'
21
+ gem 'rubocop-rails', '~> 2.31'
22
22
  gem 'rubocop-rake', '~> 0.7'
23
- gem 'rubocop-rspec', '~> 3.5'
23
+ gem 'rubocop-rspec', '~> 3.6'
24
24
 
25
25
  # Gems for documenting the package
26
26
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,90 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (2.2.0)
5
- rails (>= 7.0)
4
+ ccs-frontend_helpers (2.4.0)
5
+ rails (>= 7.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.4.2)
11
- actionpack (= 7.1.4.2)
12
- activesupport (= 7.1.4.2)
10
+ actioncable (8.0.2)
11
+ actionpack (= 8.0.2)
12
+ activesupport (= 8.0.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.4.2)
17
- actionpack (= 7.1.4.2)
18
- activejob (= 7.1.4.2)
19
- activerecord (= 7.1.4.2)
20
- activestorage (= 7.1.4.2)
21
- activesupport (= 7.1.4.2)
22
- mail (>= 2.7.1)
23
- net-imap
24
- net-pop
25
- net-smtp
26
- actionmailer (7.1.4.2)
27
- actionpack (= 7.1.4.2)
28
- actionview (= 7.1.4.2)
29
- activejob (= 7.1.4.2)
30
- activesupport (= 7.1.4.2)
31
- mail (~> 2.5, >= 2.5.4)
32
- net-imap
33
- net-pop
34
- net-smtp
16
+ actionmailbox (8.0.2)
17
+ actionpack (= 8.0.2)
18
+ activejob (= 8.0.2)
19
+ activerecord (= 8.0.2)
20
+ activestorage (= 8.0.2)
21
+ activesupport (= 8.0.2)
22
+ mail (>= 2.8.0)
23
+ actionmailer (8.0.2)
24
+ actionpack (= 8.0.2)
25
+ actionview (= 8.0.2)
26
+ activejob (= 8.0.2)
27
+ activesupport (= 8.0.2)
28
+ mail (>= 2.8.0)
35
29
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.4.2)
37
- actionview (= 7.1.4.2)
38
- activesupport (= 7.1.4.2)
30
+ actionpack (8.0.2)
31
+ actionview (= 8.0.2)
32
+ activesupport (= 8.0.2)
39
33
  nokogiri (>= 1.8.5)
40
- racc
41
34
  rack (>= 2.2.4)
42
35
  rack-session (>= 1.0.1)
43
36
  rack-test (>= 0.6.3)
44
37
  rails-dom-testing (~> 2.2)
45
38
  rails-html-sanitizer (~> 1.6)
46
- actiontext (7.1.4.2)
47
- actionpack (= 7.1.4.2)
48
- activerecord (= 7.1.4.2)
49
- activestorage (= 7.1.4.2)
50
- activesupport (= 7.1.4.2)
39
+ useragent (~> 0.16)
40
+ actiontext (8.0.2)
41
+ actionpack (= 8.0.2)
42
+ activerecord (= 8.0.2)
43
+ activestorage (= 8.0.2)
44
+ activesupport (= 8.0.2)
51
45
  globalid (>= 0.6.0)
52
46
  nokogiri (>= 1.8.5)
53
- actionview (7.1.4.2)
54
- activesupport (= 7.1.4.2)
47
+ actionview (8.0.2)
48
+ activesupport (= 8.0.2)
55
49
  builder (~> 3.1)
56
50
  erubi (~> 1.11)
57
51
  rails-dom-testing (~> 2.2)
58
52
  rails-html-sanitizer (~> 1.6)
59
- activejob (7.1.4.2)
60
- activesupport (= 7.1.4.2)
53
+ activejob (8.0.2)
54
+ activesupport (= 8.0.2)
61
55
  globalid (>= 0.3.6)
62
- activemodel (7.1.4.2)
63
- activesupport (= 7.1.4.2)
64
- activerecord (7.1.4.2)
65
- activemodel (= 7.1.4.2)
66
- activesupport (= 7.1.4.2)
56
+ activemodel (8.0.2)
57
+ activesupport (= 8.0.2)
58
+ activerecord (8.0.2)
59
+ activemodel (= 8.0.2)
60
+ activesupport (= 8.0.2)
67
61
  timeout (>= 0.4.0)
68
- activestorage (7.1.4.2)
69
- actionpack (= 7.1.4.2)
70
- activejob (= 7.1.4.2)
71
- activerecord (= 7.1.4.2)
72
- activesupport (= 7.1.4.2)
62
+ activestorage (8.0.2)
63
+ actionpack (= 8.0.2)
64
+ activejob (= 8.0.2)
65
+ activerecord (= 8.0.2)
66
+ activesupport (= 8.0.2)
73
67
  marcel (~> 1.0)
74
- activesupport (7.1.4.2)
68
+ activesupport (8.0.2)
75
69
  base64
70
+ benchmark (>= 0.3)
76
71
  bigdecimal
77
- concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ concurrent-ruby (~> 1.0, >= 1.3.1)
78
73
  connection_pool (>= 2.2.5)
79
74
  drb
80
75
  i18n (>= 1.6, < 2)
76
+ logger (>= 1.4.2)
81
77
  minitest (>= 5.1)
82
- mutex_m
83
- tzinfo (~> 2.0)
78
+ securerandom (>= 0.3)
79
+ tzinfo (~> 2.0, >= 2.0.5)
80
+ uri (>= 0.13.1)
84
81
  addressable (2.8.6)
85
82
  public_suffix (>= 2.0.2, < 6.0)
86
- ast (2.4.2)
83
+ ast (2.4.3)
87
84
  base64 (0.2.0)
85
+ benchmark (0.4.0)
88
86
  bigdecimal (3.1.9)
89
87
  builder (3.3.0)
90
88
  capybara (3.40.0)
@@ -112,9 +110,10 @@ GEM
112
110
  irb (1.14.0)
113
111
  rdoc (>= 4.0.0)
114
112
  reline (>= 0.4.2)
115
- json (2.10.2)
113
+ json (2.11.3)
116
114
  language_server-protocol (3.17.0.4)
117
115
  lint_roller (1.1.0)
116
+ logger (1.7.0)
118
117
  loofah (2.22.0)
119
118
  crass (~> 1.0.2)
120
119
  nokogiri (>= 1.12.0)
@@ -126,8 +125,7 @@ GEM
126
125
  marcel (1.0.4)
127
126
  matrix (0.4.2)
128
127
  mini_mime (1.1.5)
129
- minitest (5.25.4)
130
- mutex_m (0.3.0)
128
+ minitest (5.25.5)
131
129
  net-imap (0.4.15)
132
130
  date
133
131
  net-protocol
@@ -145,15 +143,16 @@ GEM
145
143
  nokogiri-diff (0.3.0)
146
144
  nokogiri (~> 1.5)
147
145
  tdiff (~> 0.4)
148
- parallel (1.26.3)
149
- parser (3.3.7.1)
146
+ parallel (1.27.0)
147
+ parser (3.3.8.0)
150
148
  ast (~> 2.4.1)
151
149
  racc
150
+ prism (1.4.0)
152
151
  psych (5.1.2)
153
152
  stringio
154
153
  public_suffix (5.0.4)
155
154
  racc (1.8.1)
156
- rack (3.1.11)
155
+ rack (3.1.12)
157
156
  rack-session (2.0.0)
158
157
  rack (>= 3.0.0)
159
158
  rack-test (2.1.0)
@@ -161,20 +160,20 @@ GEM
161
160
  rackup (2.1.0)
162
161
  rack (>= 3)
163
162
  webrick (~> 1.8)
164
- rails (7.1.4.2)
165
- actioncable (= 7.1.4.2)
166
- actionmailbox (= 7.1.4.2)
167
- actionmailer (= 7.1.4.2)
168
- actionpack (= 7.1.4.2)
169
- actiontext (= 7.1.4.2)
170
- actionview (= 7.1.4.2)
171
- activejob (= 7.1.4.2)
172
- activemodel (= 7.1.4.2)
173
- activerecord (= 7.1.4.2)
174
- activestorage (= 7.1.4.2)
175
- activesupport (= 7.1.4.2)
163
+ rails (8.0.2)
164
+ actioncable (= 8.0.2)
165
+ actionmailbox (= 8.0.2)
166
+ actionmailer (= 8.0.2)
167
+ actionpack (= 8.0.2)
168
+ actiontext (= 8.0.2)
169
+ actionview (= 8.0.2)
170
+ activejob (= 8.0.2)
171
+ activemodel (= 8.0.2)
172
+ activerecord (= 8.0.2)
173
+ activestorage (= 8.0.2)
174
+ activesupport (= 8.0.2)
176
175
  bundler (>= 1.15.0)
177
- railties (= 7.1.4.2)
176
+ railties (= 8.0.2)
178
177
  rails-dom-testing (2.2.0)
179
178
  activesupport (>= 5.0.0)
180
179
  minitest
@@ -182,10 +181,10 @@ GEM
182
181
  rails-html-sanitizer (1.6.0)
183
182
  loofah (~> 2.21)
184
183
  nokogiri (~> 1.14)
185
- railties (7.1.4.2)
186
- actionpack (= 7.1.4.2)
187
- activesupport (= 7.1.4.2)
188
- irb
184
+ railties (8.0.2)
185
+ actionpack (= 8.0.2)
186
+ activesupport (= 8.0.2)
187
+ irb (~> 1.13)
189
188
  rackup (>= 1.0.0)
190
189
  rake (>= 12.2)
191
190
  thor (~> 1.0, >= 1.2.2)
@@ -210,7 +209,7 @@ GEM
210
209
  diff-lcs (>= 1.2.0, < 2.0)
211
210
  rspec-support (~> 3.13.0)
212
211
  rspec-support (3.13.1)
213
- rubocop (1.74.0)
212
+ rubocop (1.75.5)
214
213
  json (~> 2.3)
215
214
  language_server-protocol (~> 3.17.0.2)
216
215
  lint_roller (~> 1.1.0)
@@ -218,27 +217,29 @@ GEM
218
217
  parser (>= 3.3.0.2)
219
218
  rainbow (>= 2.2.2, < 4.0)
220
219
  regexp_parser (>= 2.9.3, < 3.0)
221
- rubocop-ast (>= 1.38.0, < 2.0)
220
+ rubocop-ast (>= 1.44.0, < 2.0)
222
221
  ruby-progressbar (~> 1.7)
223
222
  unicode-display_width (>= 2.4.0, < 4.0)
224
- rubocop-ast (1.39.0)
225
- parser (>= 3.3.1.0)
223
+ rubocop-ast (1.44.1)
224
+ parser (>= 3.3.7.2)
225
+ prism (~> 1.4)
226
226
  rubocop-capybara (2.22.1)
227
227
  lint_roller (~> 1.1)
228
228
  rubocop (~> 1.72, >= 1.72.1)
229
- rubocop-rails (2.30.3)
229
+ rubocop-rails (2.31.0)
230
230
  activesupport (>= 4.2.0)
231
231
  lint_roller (~> 1.1)
232
232
  rack (>= 1.1)
233
- rubocop (>= 1.72.1, < 2.0)
233
+ rubocop (>= 1.75.0, < 2.0)
234
234
  rubocop-ast (>= 1.38.0, < 2.0)
235
235
  rubocop-rake (0.7.1)
236
236
  lint_roller (~> 1.1)
237
237
  rubocop (>= 1.72.1)
238
- rubocop-rspec (3.5.0)
238
+ rubocop-rspec (3.6.0)
239
239
  lint_roller (~> 1.1)
240
240
  rubocop (~> 1.72, >= 1.72.1)
241
241
  ruby-progressbar (1.13.0)
242
+ securerandom (0.4.1)
242
243
  simplecov (0.22.0)
243
244
  docile (~> 1.1)
244
245
  simplecov-html (~> 0.11)
@@ -254,6 +255,8 @@ GEM
254
255
  unicode-display_width (3.1.4)
255
256
  unicode-emoji (~> 4.0, >= 4.0.4)
256
257
  unicode-emoji (4.0.4)
258
+ uri (1.0.3)
259
+ useragent (0.16.11)
257
260
  webrick (1.8.1)
258
261
  websocket-driver (0.7.6)
259
262
  websocket-extensions (>= 0.1.0)
@@ -277,11 +280,11 @@ DEPENDENCIES
277
280
  nokogiri-diff (~> 0.3.0)
278
281
  rake (~> 13.2)
279
282
  rspec (~> 3.13)
280
- rubocop (~> 1.74)
283
+ rubocop (~> 1.75)
281
284
  rubocop-capybara (~> 2.22)
282
- rubocop-rails (~> 2.30)
285
+ rubocop-rails (~> 2.31)
283
286
  rubocop-rake (~> 0.7)
284
- rubocop-rspec (~> 3.5)
287
+ rubocop-rspec (~> 3.6)
285
288
  simplecov (~> 0.21)
286
289
  yard (~> 0.9)
287
290
 
data/README.md CHANGED
@@ -14,6 +14,8 @@ The following table shows the version of CCS Frontend Helpers that you should us
14
14
 
15
15
  | CCS Frontend Helpers Version | Target GOV.UK Frontend Version | Target CCS Frontend Version |
16
16
  | ----------------------------- | ------------------------------ | --------------------------- |
17
+ | [2.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.4.0) | [5.10.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.10.0) | [1.4.1](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.4.1) |
18
+ | [2.3.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.3.0) | [5.9.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.9.0) | [1.4.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.4.0) |
17
19
  | [2.2.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.2.0) | [5.9.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.9.0) | [1.3.3](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.3.3) |
18
20
  | [2.1.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.1.0) | [5.7.1](https://github.com/alphagov/govuk-frontend/releases/tag/v5.7.1) | [1.3.2](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.3.2) |
19
21
  | [2.0.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.0.0) | [5.7.1](https://github.com/alphagov/govuk-frontend/releases/tag/v5.7.1) | [1.2.0](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.2.0) |
data/bun.lock ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "workspaces": {
4
+ "": {
5
+ "devDependencies": {
6
+ "ccs-frontend": "^1.4.0",
7
+ "govuk-frontend": "^5.10.0",
8
+ },
9
+ },
10
+ },
11
+ "packages": {
12
+ "ccs-frontend": ["ccs-frontend@1.4.0", "", { "peerDependencies": { "govuk-frontend": "^5.9.0", "jquery": "^3.x" } }, "sha512-GX0wln6Tojcl7ZeLMPuq0uDh3jST2cV95HKLoOOYMsk783aCJXCaD9NANPHJClKGViuovw0piTIhPuM89nozBw=="],
13
+
14
+ "govuk-frontend": ["govuk-frontend@5.10.0", "", {}, "sha512-9tjpB8PDwsDqutkQPJXfDalLvNOeKxzFhV7me21s/oyn7HcTg/ei/GC3Y4JvNsXauzjOkxv4eeCHntKeySkdMg=="],
15
+
16
+ "jquery": ["jquery@3.7.1", "", {}, "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="],
17
+ }
18
+ }
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ['lib']
32
32
 
33
- spec.add_dependency 'rails', '>= 7.0'
33
+ spec.add_dependency 'rails', '>= 7.2'
34
34
 
35
35
  spec.metadata['rubygems_mfa_required'] = 'true'
36
36
  end
@@ -14,30 +14,38 @@ module CCS
14
14
  # @return [String] The class for the li elements
15
15
  # @!attribute [r] href
16
16
  # @return [String] The href for the header link
17
+ # @!attribute [r] method
18
+ # @return [String] The method for the header request which will make it a button
17
19
 
18
20
  class Link < Base
21
+ include ActionView::Helpers::UrlHelper
22
+
19
23
  private
20
24
 
21
- attr_reader :text, :li_class, :href
25
+ attr_reader :text, :li_class, :href, :method
22
26
 
23
27
  public
24
28
 
25
29
  # @param text [String] the text for the header link
26
30
  # @param li_class [String] class for the li elements
27
31
  # @param href [String] the href for the header link
32
+ # @param method [String] the method for the header request which will make it a button
28
33
  # @param options [Hash] options that will be used in customising the HTML
29
34
  #
30
35
  # @option options [Boolean] :active flag to mark the navigation item as active or not
31
36
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
32
37
 
33
- def initialize(text:, li_class:, href: nil, **)
38
+ def initialize(text:, li_class:, href: nil, method: nil, **)
34
39
  super(**)
35
40
 
36
41
  @text = text
37
42
  @href = href
38
43
  @li_class = li_class
44
+ @method = method
39
45
  end
40
46
 
47
+ # rubocop:disable Metrics/AbcSize
48
+
41
49
  # Generates the HTML for the CCS Header link
42
50
  #
43
51
  # @return [ActiveSupport::SafeBuffer]
@@ -45,14 +53,24 @@ module CCS
45
53
  def render
46
54
  tag.li(class: "#{li_class} #{'ccs-header__navigation-item--active' if options[:active]}".rstrip) do
47
55
  if href
48
- options[:attributes][:class] = 'ccs-header__link'
56
+ if method
57
+ options[:attributes][:class] = 'ccs-header__button_as_link'
49
58
 
50
- link_to(text, href, **options[:attributes])
59
+ button_to(href, method: method, **options[:attributes]) do
60
+ text
61
+ end
62
+ else
63
+ options[:attributes][:class] = 'ccs-header__link'
64
+
65
+ link_to(text, href, **options[:attributes])
66
+ end
51
67
  else
52
68
  text
53
69
  end
54
70
  end
55
71
  end
72
+
73
+ # rubocop:enable Metrics/AbcSize
56
74
  end
57
75
  end
58
76
  end
@@ -1,6 +1,7 @@
1
1
  require_relative '../base'
2
2
  require_relative 'footer/navigation'
3
3
  require_relative 'footer/meta'
4
+ require_relative 'logo'
4
5
 
5
6
  module CCS
6
7
  module Components
@@ -14,11 +15,13 @@ module CCS
14
15
  # @return [Array<Navigation>] An array of the initialised navigation sections
15
16
  # @!attribute [r] meta
16
17
  # @return [Meta] The initialised meta section
18
+ # @!attribute [r] logo
19
+ # @return [Logo] The initialised logo component
17
20
 
18
21
  class Footer < Base
19
22
  private
20
23
 
21
- attr_reader :navigation, :meta
24
+ attr_reader :navigation, :meta, :logo
22
25
 
23
26
  public
24
27
 
@@ -32,6 +35,7 @@ module CCS
32
35
  # @option options [String] :container_class classes that can be added to the inner container
33
36
  # @option options [ActiveSupport::SafeBuffer,String] :content_licence The content licence information, see {CCS::Components::GovUK::Footer#footer_content_licence footer_content_licence} for default
34
37
  # @option options [ActiveSupport::SafeBuffer,String] :copyright The copyright information, (default: '© Crown copyright')
38
+ # @option options [Boolean] :rebrand flag to use the rebrand footer which includes the logo
35
39
  # @option options [Hash] :attributes additional attributes that will added as part of the HTML
36
40
 
37
41
  def initialize(navigation: nil, meta: nil, **)
@@ -39,6 +43,7 @@ module CCS
39
43
 
40
44
  @options[:copyright] ||= '© Crown copyright'
41
45
 
46
+ @logo = Logo.new(rebrand: true, use_logotype: false, classes: 'govuk-footer__crown', context: @context) if @options[:rebrand]
42
47
  @navigation = navigation&.map { |navigation_item| Navigation.new(context: @context, **navigation_item) }
43
48
  @meta = Meta.new(context: @context, **meta) if meta
44
49
  end
@@ -52,6 +57,7 @@ module CCS
52
57
  def render
53
58
  tag.footer(**options[:attributes]) do
54
59
  tag.div(class: "govuk-width-container #{options[:container_classes]}".rstrip) do
60
+ concat(logo.render) if logo
55
61
  if navigation.present?
56
62
  concat(tag.div(class: 'govuk-footer__navigation') do
57
63
  navigation.each { |navigation_item| concat(navigation_item.render) }
@@ -1,5 +1,6 @@
1
1
  require_relative '../base'
2
2
  require_relative 'header/navigation'
3
+ require_relative 'logo'
3
4
 
4
5
  module CCS
5
6
  module Components
@@ -13,11 +14,13 @@ module CCS
13
14
  # @return [Navigation] The initialised navigation section
14
15
  # @!attribute [r] service
15
16
  # @return [Hash] The options for the service section
17
+ # @!attribute [r] logo
18
+ # @return [Logo] The initialised logo component
16
19
 
17
20
  class Header < Base
18
21
  private
19
22
 
20
- attr_reader :navigation, :service
23
+ attr_reader :navigation, :service, :logo
21
24
 
22
25
  public
23
26
 
@@ -36,6 +39,7 @@ module CCS
36
39
  # @option options [String] :homepage_url URL of the homepage. Defaults to +/+
37
40
  # @option options [String] :product_name product name, used when the product name follows on directly from ‘GOV.UK
38
41
  # @option options [Boolean] :use_tudor_crown flag to use the new tudor crown for the GOV.UK Logo
42
+ # @option options [Boolean] :rebrand flag to use the rebrand logo
39
43
  # @option options [Hash] :attributes additional attributes that will added as part of the header HTML
40
44
 
41
45
  def initialize(navigation: nil, menu_button: nil, service: nil, **)
@@ -45,6 +49,7 @@ module CCS
45
49
  @options[:homepage_url] ||= '/'
46
50
  @options[:use_tudor_crown] = true if @options[:use_tudor_crown].nil?
47
51
 
52
+ @logo = Logo.new(rebrand: @options[:rebrand], use_tudor_crown: @options[:use_tudor_crown], classes: 'govuk-header__logotype', attributes: { aria: { label: 'GOV.UK' } }, context: @context)
48
53
  @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items].present?
49
54
  @service = service
50
55
  end
@@ -80,7 +85,7 @@ module CCS
80
85
  def header_logo
81
86
  tag.div(class: 'govuk-header__logo') do
82
87
  link_to(options[:homepage_url], class: 'govuk-header__link govuk-header__link--homepage') do
83
- concat(options[:use_tudor_crown] ? tudor_crown : st_edwards_crown)
88
+ concat(logo.render)
84
89
  concat(tag.span(options[:product_name], class: 'govuk-header__product-name')) if options[:product_name]
85
90
  end
86
91
  end
@@ -97,28 +102,6 @@ module CCS
97
102
  tag.span(service[:name], class: 'govuk-header__service-name')
98
103
  end
99
104
  end
100
-
101
- # Generates the GOV.UK log with St. Edwards Crown
102
- #
103
- # @return [ActiveSupport::SafeBuffer]
104
-
105
- def st_edwards_crown
106
- tag.svg(class: 'govuk-header__logotype', xmlns: 'http://www.w3.org/2000/svg', height: '30', width: '152', aria: { label: 'GOV.UK' }, focusable: 'false', viewBox: '0 0 152 30', role: 'img') do
107
- concat(tag.title('GOV.UK'))
108
- concat(tag.path(d: 'M6.7 12.2c1 .4 2.1-.1 2.5-1s-.1-2.1-1-2.5c-1-.4-2.1.1-2.5 1-.4 1 0 2.1 1 2.5m-4.3 2.5c1 .4 2.1-.1 2.5-1s-.1-2.1-1-2.5c-1-.4-2.1.1-2.5 1-.5 1 0 2.1 1 2.5m-1.3 4.8c1 .4 2.1-.1 2.5-1 .4-1-.1-2.1-1-2.5-1-.4-2.1.1-2.5 1-.4 1 0 2.1 1 2.5m10.4-5.8c1 .4 2.1-.1 2.5-1s-.1-2.1-1-2.5c-1-.4-2.1.1-2.5 1s0 2.1 1 2.5m17.4-1.5c-1 .4-2.1-.1-2.5-1s.1-2.1 1-2.5c1-.4 2.1.1 2.5 1 .5 1 0 2.1-1 2.5m4.3 2.5c-1 .4-2.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 1.5 0 2.9-.3 4.2-.8 1.2-.6 2.3-1.3 3.1-2.3.9-1 1.5-2.1 2-3.4.4-1.3.7-2.7.7-4.2-.1-1.5-.3-2.9-.8-4.2zM81 17.6c0 1-.1 1.9-.4 2.7-.2.8-.6 1.6-1.1 2.2-.5.6-1.1 1.1-1.7 1.4-.7.3-1.5.5-2.4.5-.9 0-1.7-.2-2.4-.5s-1.3-.8-1.7-1.4c-.5-.6-.8-1.3-1.1-2.2-.2-.8-.4-1.7-.4-2.7v-.1c0-1 .1-1.9.4-2.7.2-.8.6-1.6 1.1-2.2.5-.6 1.1-1.1 1.7-1.4.7-.3 1.5-.5 2.4-.5.9 0 1.7.2 2.4.5s1.3.8 1.7 1.4c.5.6.8 1.3 1.1 2.2.2.8.4 1.7.4 2.7v.1zM92.9 28 87 7h4.7l4 15.7h.1l4-15.7h4.7l-5.9 21h-5.7zm28.8-3.6c.6 0 1.2-.1 1.7-.3.5-.2 1-.4 1.4-.8.4-.4.7-.8.9-1.4.2-.6.3-1.2.3-2v-13h4.1v13.6c0 1.2-.2 2.2-.6 3.1s-1 1.7-1.8 2.4c-.7.7-1.6 1.2-2.7 1.5-1 .4-2.2.5-3.4.5-1.2 0-2.4-.2-3.4-.5-1-.4-1.9-.9-2.7-1.5-.8-.7-1.3-1.5-1.8-2.4-.4-.9-.6-2-.6-3.1V6.9h4.2v13c0 .8.1 1.4.3 2 .2.6.5 1 .9 1.4.4.4.8.6 1.4.8.6.2 1.1.3 1.8.3zm13-17.4h4.2v9.1l7.4-9.1h5.2l-7.2 8.4L152 28h-4.9l-5.5-9.4-2.7 3V28h-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z'))
109
- end
110
- end
111
-
112
- # Generates the GOV.UK logo with a Tudor Crown
113
- #
114
- # @return [ActiveSupport::SafeBuffer]
115
-
116
- def tudor_crown
117
- tag.svg(class: 'govuk-header__logotype', xmlns: 'http://www.w3.org/2000/svg', height: '30', width: '148', aria: { label: 'GOV.UK' }, focusable: 'false', viewBox: '0 0 148 30', role: 'img') do
118
- concat(tag.title('GOV.UK'))
119
- concat(tag.path(d: 'M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5 3-1.1-.2-1.7-1.2-1.5-2.1.3-1.2 1.5-1.5 2.1-.1 1.1-2.3-.8-3-2-2.3 1.9-1.9 2.1-3.5.6-5.6-2.1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-.9-.6-2-.6-3.1V6.9h4.2v13c0 .8.1 1.4.3 2 .2.6.5 1 .9 1.4.4.4.8.6 1.4.8.6.2 1.1.3 1.8.3zm13-17.4h4.2v9.1l7.4-9.1h5.2l-7.2 8.4L148 28h-4.9l-5.5-9.4-2.7 3V28h-4.2V7zm-27.6 16.1c-1.5 0-2.7 1.2-2.7 2.7s1.2 2.7 2.7 2.7 2.7-1.2 2.7-2.7-1.2-2.7-2.7-2.7z'))
120
- end
121
- end
122
105
  end
123
106
  end
124
107
  end
@@ -0,0 +1,129 @@
1
+ require_relative '../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ # = GOV.UK Logo
7
+ #
8
+ # This is used to generate the logo component from the
9
+ # {https://github.com/alphagov/govuk-frontend/blob/main/packages/govuk-frontend/src/govuk/macros/logo.njk GDS - Macros - Logo}
10
+ #
11
+ # @!attribute [r] rebrand
12
+ # @return [Boolean] flag for rebrand
13
+ # @!attribute [r] use_logotype
14
+ # @return [Boolean] flag for logotype
15
+ # @!attribute [r] use_tudor_crown
16
+ # @return [Boolean] flag for tudor crown
17
+
18
+ class Logo < Base
19
+ include ActionView::Context
20
+ include ActionView::Helpers
21
+
22
+ private
23
+
24
+ attr_reader :rebrand, :use_logotype, :use_tudor_crown
25
+
26
+ public
27
+
28
+ # @param rebrand [Boolean] Flag for rebrand
29
+ # @param use_logotype [Boolean] Flag for logotyp
30
+ # @param use_tudor_crown [Boolean] Flag for tudor crown
31
+ # @param options [Hash] options that will be used in customising the HTML
32
+ #
33
+ # @option options [String] :classes additional CSS classes for the logo HTML
34
+ # @option options [Hash] :attributes additional attributes that will added as part of the logo HTML
35
+
36
+ def initialize(rebrand: false, use_logotype: true, use_tudor_crown: true, **)
37
+ super(**)
38
+
39
+ @rebrand = rebrand
40
+ @use_logotype = use_logotype
41
+ @use_tudor_crown = rebrand ? true : use_tudor_crown
42
+
43
+ svg_width = @use_tudor_crown ? 32 : 36
44
+ svg_width = rebrand ? svg_width + 130 : svg_width + 116 if @use_logotype
45
+
46
+ @options[:attributes][:focusable] = 'false'
47
+ @options[:attributes][:role] = @options[:attributes].dig(:aria, :label) ? 'img' : 'presentation'
48
+ @options[:attributes][:xmlns] = 'http://www.w3.org/2000/svg'
49
+ @options[:attributes][:viewBox] = "0 0 #{svg_width * 2} 60"
50
+ @options[:attributes][:height] = '30'
51
+ @options[:attributes][:width] = svg_width.to_s
52
+ @options[:attributes][:fill] = 'currentcolor'
53
+ end
54
+
55
+ # Generates the HTML for the GOV.UK Logo component
56
+ #
57
+ # @return [ActiveSupport::SafeBuffer]
58
+
59
+ def render
60
+ tag.svg(**options[:attributes]) do
61
+ concat(tag.title(@options[:attributes].dig(:aria, :label))) if @options[:attributes].dig(:aria, :label)
62
+ concat(use_tudor_crown ? tudor_crown : st_edwards_crown)
63
+ concat(rebrand ? dot_logotype : logotype) if use_logotype
64
+ end
65
+ end
66
+
67
+ # The default attributes for the logo
68
+
69
+ DEFAULT_ATTRIBUTES = {}.freeze
70
+
71
+ private
72
+
73
+ # Generates the St Edwards Crown HTML
74
+ #
75
+ # @return [ActiveSupport::SafeBuffer]
76
+
77
+ def st_edwards_crown
78
+ tag.path(d: 'M13.4,22.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M4.8,27.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2-1,2,0,4.2,2,5M2.2,36.9c2,.8,4.2-.2,5-2,.8-2-.2-4.2-2-5-2-.8-4.2.2-5,2-.8,2,0,4.2,2,5M23,25.3c2,.8,4.2-.2,5-2s-.2-4.2-2-5c-2-.8-4.2.2-5,2s0,4.2,2,5M57.8,22.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M66.4,27.3c-2,.8-4.2-.2-5-2s.2-4.2,2-5c2-.8,4.2.2,5,2,1,2,0,4.2-2,5M69,36.9c-2,.8-4.2-.2-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-1-7.4-6,1.4,0,2.6.8,4,1.8l-3-8.4c-.6,2.4-1.4,3.8-2.4,4.8-.6-1.6-.4-3,0-5.6l-5.2,1.8c3,3.8,5.6,9,7.8,18.2,7.6-1,16.4-1.8,25.4-1.8')
79
+ end
80
+
81
+ # rubocop:disable Metrics/AbcSize
82
+
83
+ # Generates the Tudor Crown HTML
84
+ #
85
+ # @return [ActiveSupport::SafeBuffer]
86
+
87
+ def tudor_crown
88
+ tag.g do
89
+ concat(tag.circle(cx: '20', cy: '17.6', r: '3.7'))
90
+ concat(tag.circle(cx: '10.2', cy: '23.5', r: '3.7'))
91
+ concat(tag.circle(cx: '3.7', cy: '33.2', r: '3.7'))
92
+ concat(tag.circle(cx: '31.7', cy: '30.6', r: '3.7'))
93
+ concat(tag.circle(cx: '43.3', cy: '17.6', r: '3.7'))
94
+ concat(tag.circle(cx: '53.2', cy: '23.5', r: '3.7'))
95
+ concat(tag.circle(cx: '59.7', cy: '33.2', r: '3.7'))
96
+ concat(tag.circle(cx: '31.7', cy: '30.6', r: '3.7'))
97
+ concat(tag.path(d: 'M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z'))
98
+ end
99
+ end
100
+
101
+ # rubocop:enable Metrics/AbcSize
102
+
103
+ # Generates the HTML for logotype with standard dot
104
+ #
105
+ # @return [ActiveSupport::SafeBuffer]
106
+
107
+ def logotype
108
+ path_kwargs = {
109
+ d: 'M88.6,33.2c0,1.8.2,3.4.6,5s1.2,3,2,4.4c1,1.2,2,2.2,3.4,3s3,1.2,5,1.2,3.4-.2,4.6-.8,2.2-1.4,3-2.2,1.2-1.8,1.6-3c.2-1,.4-2,.4-3v-.4h-10.6v-6.4h18.8v23h-7.4v-5c-.6.8-1.2,1.6-2,2.2-.8.6-1.6,1.2-2.6,1.8-1,.4-2,.8-3.2,1.2s-2.4.4-3.6.4c-3,0-5.8-.6-8-1.6-2.4-1.2-4.4-2.6-6-4.6s-2.8-4.2-3.6-6.8c-.6-2.8-1-5.6-1-8.6s.4-5.8,1.4-8.4,2.2-4.8,4-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1.2.6-2.4.6-4V11.8h8.2v27.2c0,2.4-.4,4.4-1.2,6.2s-2,3.4-3.6,4.8c-1.4,1.4-3.2,2.4-5.4,3-2,.8-4.4,1-6.8,1s-4.8-.4-6.8-1c-2-.8-3.8-1.8-5.4-3-1.6-1.4-2.6-3-3.6-4.8-.8-1.8-1.2-4-1.2-6.2V11.7h8.4v26c0,1.6.2,2.8.6,4,.4,1.2,1,2,1.8,2.8s1.6,1.2,2.8,1.6c1.2.4,2.2.6,3.6.6h0ZM261.4,11.9h8.4v18.2l14.8-18.2h10.4l-14.4,16.8,15.4,25.2h-9.8l-11-18.8-5.4,6v12.8h-8.4V11.9h0ZM206.2,44.2c-3,0-5.4,2.4-5.4,5.4s2.4,5.4,5.4,5.4,5.4-2.4,5.4-5.4-2.4-5.4-5.4-5.4Z'
110
+ }
111
+ path_kwargs[:transform] = 'translate(8 0)' unless use_tudor_crown
112
+
113
+ tag.path(**path_kwargs)
114
+ end
115
+
116
+ # Generates the HTML for logotype with raised and coloured dot
117
+ #
118
+ # @return [ActiveSupport::SafeBuffer]
119
+
120
+ def dot_logotype
121
+ capture do
122
+ concat(tag.circle(class: 'govuk-logo-dot', cx: '227', cy: '36', r: '7.3'))
123
+ concat(tag.path(d: 'M94.7,36.1c0,1.9.2,3.6.7,5.4.5,1.7,1.2,3.2,2.1,4.5.9,1.3,2.2,2.4,3.6,3.2,1.5.8,3.2,1.2,5.3,1.2s3.6-.3,4.9-.9c1.3-.6,2.3-1.4,3.1-2.3.8-.9,1.3-2,1.6-3,.3-1.1.5-2.1.5-3v-.4h-11v-6.6h19.5v24h-7.7v-5.4c-.5.8-1.2,1.6-2,2.3-.8.7-1.7,1.3-2.7,1.8-1,.5-2.1.9-3.3,1.2-1.2.3-2.5.4-3.8.4-3.2,0-6-.6-8.4-1.7-2.5-1.1-4.5-2.7-6.2-4.7-1.7-2-3-4.4-3.8-7.1-.9-2.7-1.3-5.6-1.3-8.7s.5-6,1.5-8.7,2.4-5.1,4.2-7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9,2.8-1.7.8-.8,1.4-1.7,1.9-2.9.5-1.2.7-2.5.7-4.1V14h8.6v28.5c0,2.4-.4,4.6-1.3,6.6-.9,2-2.1,3.6-3.7,5-1.6,1.4-3.4,2.4-5.6,3.2-2.2.7-4.5,1.1-7.1,1.1s-4.9-.4-7.1-1.1c-2.2-.7-4-1.8-5.6-3.2s-2.8-3-3.7-5c-.9-2-1.3-4.1-1.3-6.6V14h8.7v27.2c0,1.6.2,2.9.7,4.1.5,1.2,1.1,2.1,1.9,2.9.8.8,1.7,1.3,2.8,1.7s2.3.6,3.6.6h0ZM288.5,14h8.7v19.1l15.5-19.1h10.8l-15.1,17.6,16.1,26.4h-10.2l-11.5-19.7-5.6,6.3v13.5h-8.7'))
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -39,7 +39,7 @@ module CCS
39
39
 
40
40
  (@options[:attributes][:aria] ||= {})[:label] ||= 'Service information' if service
41
41
 
42
- @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items].present?
42
+ @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items]&.compact_blank!.present?
43
43
  @service = service
44
44
  end
45
45
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CCS
4
4
  module FrontendHelpers
5
- VERSION = '2.2.0'
5
+ VERSION = '2.4.0'
6
6
  end
7
7
  end
data/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "CCS",
6
6
  "license": "MIT",
7
7
  "devDependencies": {
8
- "govuk-frontend": "^5.9.0",
9
- "ccs-frontend": "^1.3.3"
8
+ "govuk-frontend": "^5.10.0",
9
+ "ccs-frontend": "^1.4.0"
10
10
  }
11
11
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ccs-frontend_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crown Commercial Service
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-21 00:00:00.000000000 Z
10
+ date: 2025-05-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.0'
18
+ version: '7.2'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '7.0'
25
+ version: '7.2'
26
26
  description: Gem containing view helpers for CCS Ruby on Rails projects
27
27
  executables: []
28
28
  extensions: []
@@ -37,6 +37,7 @@ files:
37
37
  - LICENSE.txt
38
38
  - README.md
39
39
  - Rakefile
40
+ - bun.lock
40
41
  - ccs-frontend_helpers.gemspec
41
42
  - lib/ccs/components/base.rb
42
43
  - lib/ccs/components/ccs/contact_us.rb
@@ -106,6 +107,7 @@ files:
106
107
  - lib/ccs/components/govuk/hint.rb
107
108
  - lib/ccs/components/govuk/inset_text.rb
108
109
  - lib/ccs/components/govuk/label.rb
110
+ - lib/ccs/components/govuk/logo.rb
109
111
  - lib/ccs/components/govuk/notification_banner.rb
110
112
  - lib/ccs/components/govuk/pagination.rb
111
113
  - lib/ccs/components/govuk/pagination/increment.rb
@@ -200,7 +202,6 @@ files:
200
202
  - lib/ccs/frontend_helpers/version.rb
201
203
  - package.json
202
204
  - sig/ccs/frontend_helpers.rbs
203
- - yarn.lock
204
205
  homepage: https://github.com/Crown-Commercial-Service/ccs-frontend_helpers
205
206
  licenses:
206
207
  - MIT
data/yarn.lock DELETED
@@ -1,13 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-
5
- ccs-frontend@^1.3.3:
6
- version "1.3.3"
7
- resolved "https://registry.yarnpkg.com/ccs-frontend/-/ccs-frontend-1.3.3.tgz#1f4e61ef03329bd184df878d72892b0130acb70a"
8
- integrity sha512-bOdlXVtxkFMawR32eaVZh37XeFXn0RdBCpxtr6+YkmDq0aDhK+DDmEbhyk8vZ/i+b5hku9jLP45HdUuRItp1CQ==
9
-
10
- govuk-frontend@^5.9.0:
11
- version "5.9.0"
12
- resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-5.9.0.tgz#4064ac692019e60f030d6311c49330a6454a5689"
13
- integrity sha512-8NzmyoDtRFYyHs413DfNPR8Zo6qw6Q02Mruxml/Yfy+EueaOI/JZ4gVM8d0pqzJmTiMcJuHhvxqYEgBRmqeoyA==