ccs-frontend_helpers 2.4.0 → 2.5.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: eb6707b6a138b2b393abd881035498389d19edb8ee6ee2b8575aedd7ce06ece2
4
- data.tar.gz: 4efdde23a7e0183371a1894b5e60c835e3f30699b9d86f8023ee287d005879bc
3
+ metadata.gz: 593b6d07f7d3f0c574d1bd1724339aa500d209a56638ded2d920e310ba63ebab
4
+ data.tar.gz: 4081270db4b8813e7bae32732c119416eb1bd005ad3236c2dcb7fed1930fbd64
5
5
  SHA512:
6
- metadata.gz: 7e93fec1d87edc93a450432e199367532ab4f493f6db3b8f13946c8f9674c8ce99e7609bb6d0c9c9960020dbf3306323a8d3edccb41a53c962b519f31e4742f7
7
- data.tar.gz: e78a6020d4f3526d84691d374076e4413b6500c26fdb8cd934d7b5220232b7cfe230b112ef4949ab8a3aadffef6b9efc9dd8d4db361afe4d6bc0be88706cccba
6
+ metadata.gz: 5c182ff9293312d0daf639452012b70e33019164716980787510269bce4ec600ff84d81777995d33ec3f50217f4fe92e527cdb81cb917a71f002f7d1083f7de4
7
+ data.tar.gz: 8a0cae10f0ec8faad8773e91449c53dae0e91612aaac226ee2e70a8c556a4e63bb457becfcf14586781b082fb0a1a823bc69c9fc989db03fe1b5b203443708e3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.1
1
+ 3.4.3
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.5.0] - 2025-06-30
11
+
12
+ ### Added
13
+
14
+ - Updated GOV.UK Frontend to v5.11.0
15
+
10
16
  ## [2.4.0] - 2025-05-13
11
17
 
12
18
  ### Added
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  # Gems for building the package
9
9
  gem 'bundler', '~> 2.3'
10
- gem 'rake', '~> 13.2'
10
+ gem 'rake', '~> 13.3'
11
11
 
12
12
  # Gems for testing the package
13
13
  gem 'capybara', '~> 3.40.0'
@@ -16,9 +16,9 @@ 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.75'
19
+ gem 'rubocop', '~> 1.77'
20
20
  gem 'rubocop-capybara', '~> 2.22'
21
- gem 'rubocop-rails', '~> 2.31'
21
+ gem 'rubocop-rails', '~> 2.32'
22
22
  gem 'rubocop-rake', '~> 0.7'
23
23
  gem 'rubocop-rspec', '~> 3.6'
24
24
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (2.4.0)
4
+ ccs-frontend_helpers (2.5.0)
5
5
  rails (>= 7.2)
6
6
 
7
7
  GEM
@@ -95,10 +95,10 @@ GEM
95
95
  regexp_parser (>= 1.5, < 3.0)
96
96
  xpath (~> 3.2)
97
97
  concurrent-ruby (1.3.5)
98
- connection_pool (2.5.0)
98
+ connection_pool (2.5.3)
99
99
  crass (1.0.6)
100
- date (3.3.4)
101
- diff-lcs (1.5.1)
100
+ date (3.4.1)
101
+ diff-lcs (1.6.2)
102
102
  docile (1.4.0)
103
103
  drb (2.2.1)
104
104
  erubi (1.13.0)
@@ -110,11 +110,11 @@ GEM
110
110
  irb (1.14.0)
111
111
  rdoc (>= 4.0.0)
112
112
  reline (>= 0.4.2)
113
- json (2.11.3)
114
- language_server-protocol (3.17.0.4)
113
+ json (2.12.2)
114
+ language_server-protocol (3.17.0.5)
115
115
  lint_roller (1.1.0)
116
116
  logger (1.7.0)
117
- loofah (2.22.0)
117
+ loofah (2.24.1)
118
118
  crass (~> 1.0.2)
119
119
  nokogiri (>= 1.12.0)
120
120
  mail (2.8.1)
@@ -126,7 +126,7 @@ GEM
126
126
  matrix (0.4.2)
127
127
  mini_mime (1.1.5)
128
128
  minitest (5.25.5)
129
- net-imap (0.4.15)
129
+ net-imap (0.4.20)
130
130
  date
131
131
  net-protocol
132
132
  net-pop (0.1.2)
@@ -136,9 +136,9 @@ GEM
136
136
  net-smtp (0.5.0)
137
137
  net-protocol
138
138
  nio4r (2.7.3)
139
- nokogiri (1.18.1-x86_64-darwin)
139
+ nokogiri (1.18.8-x86_64-darwin)
140
140
  racc (~> 1.4)
141
- nokogiri (1.18.1-x86_64-linux-gnu)
141
+ nokogiri (1.18.8-x86_64-linux-gnu)
142
142
  racc (~> 1.4)
143
143
  nokogiri-diff (0.3.0)
144
144
  nokogiri (~> 1.5)
@@ -152,8 +152,9 @@ GEM
152
152
  stringio
153
153
  public_suffix (5.0.4)
154
154
  racc (1.8.1)
155
- rack (3.1.12)
156
- rack-session (2.0.0)
155
+ rack (3.1.16)
156
+ rack-session (2.1.1)
157
+ base64 (>= 0.1.0)
157
158
  rack (>= 3.0.0)
158
159
  rack-test (2.1.0)
159
160
  rack (>= 1.3)
@@ -178,9 +179,9 @@ GEM
178
179
  activesupport (>= 5.0.0)
179
180
  minitest
180
181
  nokogiri (>= 1.6)
181
- rails-html-sanitizer (1.6.0)
182
+ rails-html-sanitizer (1.6.1)
182
183
  loofah (~> 2.21)
183
- nokogiri (~> 1.14)
184
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
184
185
  railties (8.0.2)
185
186
  actionpack (= 8.0.2)
186
187
  activesupport (= 8.0.2)
@@ -190,26 +191,26 @@ GEM
190
191
  thor (~> 1.0, >= 1.2.2)
191
192
  zeitwerk (~> 2.6)
192
193
  rainbow (3.1.1)
193
- rake (13.2.1)
194
+ rake (13.3.0)
194
195
  rdoc (6.7.0)
195
196
  psych (>= 4.0.0)
196
197
  regexp_parser (2.10.0)
197
198
  reline (0.5.9)
198
199
  io-console (~> 0.5)
199
- rspec (3.13.0)
200
+ rspec (3.13.1)
200
201
  rspec-core (~> 3.13.0)
201
202
  rspec-expectations (~> 3.13.0)
202
203
  rspec-mocks (~> 3.13.0)
203
- rspec-core (3.13.0)
204
+ rspec-core (3.13.4)
204
205
  rspec-support (~> 3.13.0)
205
- rspec-expectations (3.13.0)
206
+ rspec-expectations (3.13.5)
206
207
  diff-lcs (>= 1.2.0, < 2.0)
207
208
  rspec-support (~> 3.13.0)
208
- rspec-mocks (3.13.0)
209
+ rspec-mocks (3.13.5)
209
210
  diff-lcs (>= 1.2.0, < 2.0)
210
211
  rspec-support (~> 3.13.0)
211
- rspec-support (3.13.1)
212
- rubocop (1.75.5)
212
+ rspec-support (3.13.4)
213
+ rubocop (1.77.0)
213
214
  json (~> 2.3)
214
215
  language_server-protocol (~> 3.17.0.2)
215
216
  lint_roller (~> 1.1.0)
@@ -217,21 +218,21 @@ GEM
217
218
  parser (>= 3.3.0.2)
218
219
  rainbow (>= 2.2.2, < 4.0)
219
220
  regexp_parser (>= 2.9.3, < 3.0)
220
- rubocop-ast (>= 1.44.0, < 2.0)
221
+ rubocop-ast (>= 1.45.1, < 2.0)
221
222
  ruby-progressbar (~> 1.7)
222
223
  unicode-display_width (>= 2.4.0, < 4.0)
223
- rubocop-ast (1.44.1)
224
+ rubocop-ast (1.45.1)
224
225
  parser (>= 3.3.7.2)
225
226
  prism (~> 1.4)
226
227
  rubocop-capybara (2.22.1)
227
228
  lint_roller (~> 1.1)
228
229
  rubocop (~> 1.72, >= 1.72.1)
229
- rubocop-rails (2.31.0)
230
+ rubocop-rails (2.32.0)
230
231
  activesupport (>= 4.2.0)
231
232
  lint_roller (~> 1.1)
232
233
  rack (>= 1.1)
233
234
  rubocop (>= 1.75.0, < 2.0)
234
- rubocop-ast (>= 1.38.0, < 2.0)
235
+ rubocop-ast (>= 1.44.0, < 2.0)
235
236
  rubocop-rake (0.7.1)
236
237
  lint_roller (~> 1.1)
237
238
  rubocop (>= 1.72.1)
@@ -249,7 +250,7 @@ GEM
249
250
  stringio (3.1.1)
250
251
  tdiff (0.4.0)
251
252
  thor (1.3.2)
252
- timeout (0.4.1)
253
+ timeout (0.4.3)
253
254
  tzinfo (2.0.6)
254
255
  concurrent-ruby (~> 1.0)
255
256
  unicode-display_width (3.1.4)
@@ -257,7 +258,7 @@ GEM
257
258
  unicode-emoji (4.0.4)
258
259
  uri (1.0.3)
259
260
  useragent (0.16.11)
260
- webrick (1.8.1)
261
+ webrick (1.8.2)
261
262
  websocket-driver (0.7.6)
262
263
  websocket-extensions (>= 0.1.0)
263
264
  websocket-extensions (0.1.5)
@@ -271,6 +272,7 @@ PLATFORMS
271
272
  x86_64-darwin-20
272
273
  x86_64-darwin-22
273
274
  x86_64-darwin-23
275
+ x86_64-darwin-24
274
276
  x86_64-linux
275
277
 
276
278
  DEPENDENCIES
@@ -278,11 +280,11 @@ DEPENDENCIES
278
280
  capybara (~> 3.40.0)
279
281
  ccs-frontend_helpers!
280
282
  nokogiri-diff (~> 0.3.0)
281
- rake (~> 13.2)
283
+ rake (~> 13.3)
282
284
  rspec (~> 3.13)
283
- rubocop (~> 1.75)
285
+ rubocop (~> 1.77)
284
286
  rubocop-capybara (~> 2.22)
285
- rubocop-rails (~> 2.31)
287
+ rubocop-rails (~> 2.32)
286
288
  rubocop-rake (~> 0.7)
287
289
  rubocop-rspec (~> 3.6)
288
290
  simplecov (~> 0.21)
data/README.md CHANGED
@@ -14,6 +14,7 @@ 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.5.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v2.5.0) | [5.11.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.11.0) | [1.4.1](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.4.1) |
17
18
  | [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
19
  | [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) |
19
20
  | [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) |
data/bun.lock CHANGED
@@ -3,15 +3,15 @@
3
3
  "workspaces": {
4
4
  "": {
5
5
  "devDependencies": {
6
- "ccs-frontend": "^1.4.0",
7
- "govuk-frontend": "^5.10.0",
6
+ "ccs-frontend": "^1.4.1",
7
+ "govuk-frontend": "^5.11.0",
8
8
  },
9
9
  },
10
10
  },
11
11
  "packages": {
12
- "ccs-frontend": ["ccs-frontend@1.4.0", "", { "peerDependencies": { "govuk-frontend": "^5.9.0", "jquery": "^3.x" } }, "sha512-GX0wln6Tojcl7ZeLMPuq0uDh3jST2cV95HKLoOOYMsk783aCJXCaD9NANPHJClKGViuovw0piTIhPuM89nozBw=="],
12
+ "ccs-frontend": ["ccs-frontend@1.4.1", "", { "peerDependencies": { "govuk-frontend": "^5.10.0", "jquery": "^3.x" } }, "sha512-dLg0GgJicg+OsGzCofjckYhht8zhD+A/qS6hkJgGg5amIQ2m4WDU+sB4p7CkOX/mooqil8MDdIdcRwtXoydzRw=="],
13
13
 
14
- "govuk-frontend": ["govuk-frontend@5.10.0", "", {}, "sha512-9tjpB8PDwsDqutkQPJXfDalLvNOeKxzFhV7me21s/oyn7HcTg/ei/GC3Y4JvNsXauzjOkxv4eeCHntKeySkdMg=="],
14
+ "govuk-frontend": ["govuk-frontend@5.11.0", "", {}, "sha512-RYZDEF1J6nVw5XauQGH+91qplExgHUXfXII7dtIme6I4u3eSvU59yZ0/EFKEwRgTslSqlhJODOnAi5rnQFU5Gw=="],
15
15
 
16
16
  "jquery": ["jquery@3.7.1", "", {}, "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="],
17
17
  }
@@ -119,8 +119,8 @@ module CCS
119
119
 
120
120
  def dot_logotype
121
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.1c1.8-2,4-3.6,6.5-4.7s5.4-1.7,8.6-1.7,4,.2,5.9.7c1.8.5,3.5,1.1,5.1,2,1.5.9,2.9,1.9,4,3.2,1.2,1.2,2.1,2.6,2.8,4.1l-7.7,4.3c-.5-.9-1-1.8-1.6-2.6-.6-.8-1.3-1.5-2.2-2.1-.8-.6-1.7-1-2.8-1.4-1-.3-2.2-.5-3.5-.5-2,0-3.8.4-5.3,1.2s-2.7,1.9-3.6,3.2c-.9,1.3-1.7,2.8-2.1,4.6s-.7,3.5-.7,5.3v.3h0ZM152.9,13.7c3.2,0,6.1.6,8.7,1.7,2.6,1.2,4.7,2.7,6.5,4.7,1.8,2,3.1,4.4,4.1,7.1s1.4,5.6,1.4,8.7-.5,6-1.4,8.7c-.9,2.7-2.3,5.1-4.1,7.1s-4,3.6-6.5,4.7c-2.6,1.1-5.5,1.7-8.7,1.7s-6.1-.6-8.7-1.7c-2.6-1.1-4.7-2.7-6.5-4.7-1.8-2-3.1-4.4-4.1-7.1-.9-2.7-1.4-5.6-1.4-8.7s.5-6,1.4-8.7,2.3-5.1,4.1-7.1c1.8-2,4-3.6,6.5-4.7s5.4-1.7,8.7-1.7h0ZM152.9,50.4c1.9,0,3.6-.4,5-1.1,1.4-.7,2.7-1.7,3.6-3,1-1.3,1.7-2.8,2.2-4.5.5-1.7.8-3.6.8-5.7v-.2c0-2-.3-3.9-.8-5.7-.5-1.7-1.3-3.3-2.2-4.5-1-1.3-2.2-2.3-3.6-3-1.4-.7-3.1-1.1-5-1.1s-3.6.4-5,1.1c-1.5.7-2.7,1.7-3.6,3s-1.7,2.8-2.2,4.5c-.5,1.7-.8,3.6-.8,5.7v.2c0,2.1.3,4,.8,5.7.5,1.7,1.2,3.2,2.2,4.5,1,1.3,2.2,2.3,3.6,3,1.5.7,3.1,1.1,5,1.1ZM189.1,58l-12.3-44h9.8l8.4,32.9h.3l8.2-32.9h9.7l-12.3,44M262.9,50.4c1.3,0,2.5-.2,3.6-.6,1.1-.4,2-.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'))
122
+ concat(tag.circle(class: 'govuk-logo-dot', cx: '226', cy: '36', r: '7.3'))
123
+ concat(tag.path(d: 'M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9'))
124
124
  end
125
125
  end
126
126
  end
@@ -18,6 +18,8 @@ module CCS
18
18
  # @return [String] The id for the navigation
19
19
  # @!attribute [r] menu_button
20
20
  # @return [Hash] The options for the menu button
21
+ # @!attribute [r] collapse_navigation_on_mobile
22
+ # @return [Boolean] Flag to collapse navigation on mobile
21
23
 
22
24
  class Navigation
23
25
  include ActionView::Context
@@ -25,15 +27,16 @@ module CCS
25
27
 
26
28
  private
27
29
 
28
- attr_reader :navigation, :menu_button
30
+ attr_reader :navigation, :menu_button, :collapse_navigation_on_mobile
29
31
 
30
32
  public
31
33
 
32
- # rubocop:disable Metrics/CyclomaticComplexity
34
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
33
35
 
34
36
  # @param navigation [Hash] options for the navigation
35
37
  # @param context [ActionView::Base] the view context
36
38
  # @param menu_button [Hash] options for the menu button
39
+ # @param collapse_navigation_on_mobile [Boolean] flag to collapse navigation on mobile
37
40
  #
38
41
  # @option navigation [Array] :items an array of links for the navigation section.
39
42
  # See {Components::GovUK::ServiceNavigation::Link#initialize Link#initialize} for details of the items in the array.
@@ -45,7 +48,7 @@ module CCS
45
48
  # @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
46
49
  # Defaults to +Show or hide menu+.
47
50
 
48
- def initialize(navigation:, context:, menu_button: nil)
51
+ def initialize(navigation:, context:, menu_button: nil, collapse_navigation_on_mobile: nil)
49
52
  menu_button ||= {}
50
53
  menu_button[:text] ||= 'Menu'
51
54
 
@@ -58,9 +61,11 @@ module CCS
58
61
  @navigation[:links] = navigation[:items].map { |navigation_link| Link.new(context: context, **navigation_link) }
59
62
  @navigation[:label] = navigation[:label] || menu_button[:text]
60
63
  @navigation[:class] = "govuk-service-navigation__wrapper #{navigation[:classes]}".rstrip
64
+
65
+ @collapse_navigation_on_mobile = collapse_navigation_on_mobile.nil? ? @navigation[:links].length > 1 : collapse_navigation_on_mobile
61
66
  end
62
67
 
63
- # rubocop:enable Metrics/CyclomaticComplexity
68
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
64
69
 
65
70
  # Generates the HTML for the GOV.UK Service Navigation navigation
66
71
  #
@@ -68,7 +73,7 @@ module CCS
68
73
 
69
74
  def render
70
75
  tag.nav(aria: { label: navigation[:label] }, class: navigation[:class]) do
71
- concat(button_tag(menu_button[:text], type: :button, class: 'govuk-service-navigation__toggle govuk-js-service-navigation-toggle', aria: menu_button[:aria], hidden: true))
76
+ concat(button_tag(menu_button[:text], type: :button, class: 'govuk-service-navigation__toggle govuk-js-service-navigation-toggle', aria: menu_button[:aria], hidden: true)) if collapse_navigation_on_mobile
72
77
  concat(tag.ul(id: navigation[:id], class: 'govuk-service-navigation__list') do
73
78
  navigation[:links].each { |navigation_link| concat(navigation_link.render) }
74
79
  end)
@@ -33,13 +33,14 @@ module CCS
33
33
  #
34
34
  # @option options [String] :classes additional CSS classes for the service navigation HTML
35
35
  # @option options [Hash] :attributes additional attributes that will added as part of the service navigation HTML
36
+ # @option options [Boolean] :collapse_navigation_on_mobile flag to collapse navigation on mobile
36
37
 
37
38
  def initialize(navigation: nil, menu_button: nil, service: nil, **)
38
39
  super(**)
39
40
 
40
41
  (@options[:attributes][:aria] ||= {})[:label] ||= 'Service information' if service
41
42
 
42
- @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation && navigation[:items]&.compact_blank!.present?
43
+ @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, collapse_navigation_on_mobile: options[:collapse_navigation_on_mobile], context: @context) if navigation && navigation[:items]&.compact_blank!.present?
43
44
  @service = service
44
45
  end
45
46
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CCS
4
4
  module FrontendHelpers
5
- VERSION = '2.4.0'
5
+ VERSION = '2.5.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.10.0",
9
- "ccs-frontend": "^1.4.0"
8
+ "govuk-frontend": "^5.11.0",
9
+ "ccs-frontend": "^1.4.1"
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.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crown Commercial Service
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-05-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  requirements: []
227
- rubygems_version: 3.6.2
227
+ rubygems_version: 3.6.7
228
228
  specification_version: 4
229
229
  summary: Gem containing view helpers for CCS Ruby on Rails projects
230
230
  test_files: []