ccs-frontend_helpers 2.1.0 → 2.2.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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -4
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +10 -1
  5. data/Gemfile +5 -5
  6. data/Gemfile.lock +35 -29
  7. data/README.md +1 -0
  8. data/ccs-frontend_helpers.gemspec +1 -1
  9. data/lib/ccs/components/ccs/contact_us.rb +2 -2
  10. data/lib/ccs/components/ccs/dashboard_section/panel.rb +2 -2
  11. data/lib/ccs/components/ccs/dashboard_section.rb +2 -2
  12. data/lib/ccs/components/ccs/footer/link.rb +2 -2
  13. data/lib/ccs/components/ccs/footer.rb +2 -2
  14. data/lib/ccs/components/ccs/header/link.rb +2 -2
  15. data/lib/ccs/components/ccs/header.rb +2 -2
  16. data/lib/ccs/components/ccs/password_strength.rb +2 -2
  17. data/lib/ccs/components/govuk/back_link.rb +2 -2
  18. data/lib/ccs/components/govuk/breadcrumbs/link.rb +2 -2
  19. data/lib/ccs/components/govuk/breadcrumbs.rb +2 -2
  20. data/lib/ccs/components/govuk/button.rb +2 -2
  21. data/lib/ccs/components/govuk/cookie_banner/action.rb +2 -2
  22. data/lib/ccs/components/govuk/cookie_banner/message.rb +2 -2
  23. data/lib/ccs/components/govuk/cookie_banner.rb +2 -2
  24. data/lib/ccs/components/govuk/details.rb +2 -2
  25. data/lib/ccs/components/govuk/error_message.rb +2 -2
  26. data/lib/ccs/components/govuk/error_summary/item.rb +2 -2
  27. data/lib/ccs/components/govuk/error_summary.rb +2 -2
  28. data/lib/ccs/components/govuk/field/input/character_count.rb +2 -0
  29. data/lib/ccs/components/govuk/field/input/file_upload.rb +60 -4
  30. data/lib/ccs/components/govuk/field/input/select.rb +2 -2
  31. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +2 -2
  32. data/lib/ccs/components/govuk/field/input/text_input.rb +2 -2
  33. data/lib/ccs/components/govuk/field/input/textarea.rb +2 -2
  34. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +2 -2
  35. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +2 -2
  36. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +2 -2
  37. data/lib/ccs/components/govuk/field/inputs/item.rb +2 -2
  38. data/lib/ccs/components/govuk/field/inputs/radios.rb +2 -2
  39. data/lib/ccs/components/govuk/field/inputs.rb +1 -1
  40. data/lib/ccs/components/govuk/field.rb +2 -2
  41. data/lib/ccs/components/govuk/fieldset/legend.rb +2 -2
  42. data/lib/ccs/components/govuk/fieldset.rb +2 -2
  43. data/lib/ccs/components/govuk/footer/link.rb +2 -2
  44. data/lib/ccs/components/govuk/footer.rb +2 -2
  45. data/lib/ccs/components/govuk/form_group.rb +2 -2
  46. data/lib/ccs/components/govuk/header/link.rb +2 -2
  47. data/lib/ccs/components/govuk/header.rb +2 -2
  48. data/lib/ccs/components/govuk/hint.rb +2 -2
  49. data/lib/ccs/components/govuk/inset_text.rb +2 -2
  50. data/lib/ccs/components/govuk/label.rb +2 -2
  51. data/lib/ccs/components/govuk/notification_banner.rb +2 -2
  52. data/lib/ccs/components/govuk/pagination/increment/next.rb +2 -2
  53. data/lib/ccs/components/govuk/pagination/increment/previous.rb +2 -2
  54. data/lib/ccs/components/govuk/pagination/increment.rb +2 -2
  55. data/lib/ccs/components/govuk/pagination/item/form.rb +2 -2
  56. data/lib/ccs/components/govuk/pagination/item/tag.rb +2 -2
  57. data/lib/ccs/components/govuk/pagination/item.rb +2 -2
  58. data/lib/ccs/components/govuk/pagination.rb +2 -2
  59. data/lib/ccs/components/govuk/panel.rb +2 -2
  60. data/lib/ccs/components/govuk/phase_banner.rb +2 -2
  61. data/lib/ccs/components/govuk/service_navigation.rb +2 -2
  62. data/lib/ccs/components/govuk/skip_link.rb +2 -2
  63. data/lib/ccs/components/govuk/step_by_step_navigation.rb +2 -2
  64. data/lib/ccs/components/govuk/summary_list/action/link.rb +2 -2
  65. data/lib/ccs/components/govuk/summary_list/card/actions.rb +2 -2
  66. data/lib/ccs/components/govuk/summary_list/card/title.rb +2 -2
  67. data/lib/ccs/components/govuk/summary_list/card.rb +2 -2
  68. data/lib/ccs/components/govuk/summary_list/row/actions.rb +2 -2
  69. data/lib/ccs/components/govuk/summary_list/row/key.rb +2 -2
  70. data/lib/ccs/components/govuk/summary_list/row/value.rb +2 -2
  71. data/lib/ccs/components/govuk/summary_list/row.rb +2 -2
  72. data/lib/ccs/components/govuk/summary_list.rb +2 -2
  73. data/lib/ccs/components/govuk/table/body/data_cell.rb +2 -2
  74. data/lib/ccs/components/govuk/table/body/head_cell.rb +2 -2
  75. data/lib/ccs/components/govuk/table/header/head_cell.rb +2 -2
  76. data/lib/ccs/components/govuk/table.rb +2 -2
  77. data/lib/ccs/components/govuk/tabs/panel.rb +2 -2
  78. data/lib/ccs/components/govuk/tabs/tab.rb +2 -2
  79. data/lib/ccs/components/govuk/tabs.rb +2 -2
  80. data/lib/ccs/components/govuk/tag.rb +2 -2
  81. data/lib/ccs/components/govuk/task_list/item/status.rb +2 -2
  82. data/lib/ccs/components/govuk/task_list/item/title.rb +2 -2
  83. data/lib/ccs/components/govuk/task_list/item.rb +2 -2
  84. data/lib/ccs/components/govuk/task_list.rb +2 -2
  85. data/lib/ccs/components/govuk/warning_text.rb +2 -2
  86. data/lib/ccs/frontend_helpers/ccs_frontend/contact_us.rb +2 -2
  87. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +2 -2
  88. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +2 -2
  89. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +2 -2
  90. data/lib/ccs/frontend_helpers/ccs_frontend/password_strength.rb +2 -2
  91. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +2 -2
  92. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +2 -2
  93. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +2 -2
  94. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +2 -2
  95. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +2 -2
  96. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +2 -2
  97. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +2 -2
  98. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +2 -2
  99. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +2 -2
  100. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +4 -4
  101. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +4 -4
  102. data/lib/ccs/frontend_helpers/govuk_frontend/exit_this_page.rb +2 -2
  103. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +2 -2
  104. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +2 -2
  105. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +2 -2
  106. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +2 -2
  107. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +2 -2
  108. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +2 -2
  109. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +2 -2
  110. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +2 -2
  111. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +2 -2
  112. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +2 -2
  113. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +2 -2
  114. data/lib/ccs/frontend_helpers/govuk_frontend/password_input.rb +2 -2
  115. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +2 -2
  116. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +2 -2
  117. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +2 -2
  118. data/lib/ccs/frontend_helpers/govuk_frontend/service_navigation.rb +2 -2
  119. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +2 -2
  120. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +2 -2
  121. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +2 -2
  122. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +2 -2
  123. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +2 -2
  124. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +2 -2
  125. data/lib/ccs/frontend_helpers/govuk_frontend/task_list.rb +2 -2
  126. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +2 -2
  127. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +2 -2
  128. data/lib/ccs/frontend_helpers/version.rb +1 -1
  129. data/package.json +2 -2
  130. data/yarn.lock +8 -8
  131. metadata +4 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cbcc655e7c1a8e5759aada0f102ac220b25d0aeb4de214ba358c19b0381711c
4
- data.tar.gz: 5b8b3f2a9f4fabae12fda9bb9a0d044b3cb8d57048b3b8915ddc74ed880c2df4
3
+ metadata.gz: 5da91f1cead5cea0d782242299e6290cc1c93a9513deba6b3866f696bd5a067c
4
+ data.tar.gz: 1e923993ff4a79465bf172007bfacca7d37a13d7122eb47d0fe6643d3f865080
5
5
  SHA512:
6
- metadata.gz: 01ffc6a45996735edcd941d24d46ce7ed6d872044eaa61812585a833587ff52f9fe3f0e598c13cc19ba149921ec2f06b54abf9013ef2d97509b9a679763b79c0
7
- data.tar.gz: 6cd6600c9c4573fc5d3def30e38eb4aa50058aa1bdd187721d457ccbee2b89e6163fd65f77255b3047cb091bb5cd6a132e12c6e73bdc6fbdf6c3f995dcc9622e
6
+ metadata.gz: b4d556815d54978dd0c5a5d835dd41a6cfb5ec59330fdc1efe19cc62dadb2b151c4f12798c15941c400e9299a1fd789ed493d2b74bd3a4e8575ae5b729f1ab78
7
+ data.tar.gz: c763041c52a41d534e3d286e8e84e866a8b6121455a901f9916961efc17da22008bf951b26e9523574a2d780d5f55b408c2aa9736704935f6d9c0758e4230b89
data/.rubocop.yml CHANGED
@@ -1,13 +1,15 @@
1
1
  ---
2
- require:
3
- - rubocop-capybara
4
- - rubocop-rspec
2
+ plugins:
5
3
  - rubocop-rails
6
4
  - rubocop-rake
5
+ - rubocop-rspec
6
+
7
+ require:
8
+ - rubocop-capybara
7
9
 
8
10
  AllCops:
9
11
  NewCops: enable
10
- TargetRubyVersion: 3.1
12
+ TargetRubyVersion: 3.2
11
13
  Exclude:
12
14
  - "bin/**/*"
13
15
  - "tmp/**/*"
@@ -119,6 +121,9 @@ Layout/LineLength:
119
121
  - "context .* do$"
120
122
  - "scenario .* do$"
121
123
 
124
+ Lint/UselessConstantScoping:
125
+ Enabled: false
126
+
122
127
  Metrics/ClassLength:
123
128
  Enabled: false
124
129
 
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.6
1
+ 3.4.1
data/CHANGELOG.md CHANGED
@@ -7,18 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.2.0] - 2025-03-21
11
+
12
+ ### Added
13
+
14
+ - Add support for to ruby v3.4
15
+ - Updated GOV.UK Frontend to v5.9.0
16
+ - Updated CCS Frontend to v1.3.3
17
+
10
18
  ## [2.1.0] - 2025-01-08
11
19
 
12
20
  ### Changed
13
21
 
14
22
  - Updated CCS Frontend to v1.3.2 (update to the CCS logo)
23
+ - Updated minimum Ruby version to v3.2
15
24
 
16
25
  ## [2.0.0] - 2024-11-05
17
26
 
18
27
  ### Changed
19
28
 
20
29
  - Update minimum required Rails version to v7.0
21
- - Updated minimum Ruby version to 3.1
30
+ - Updated minimum Ruby version to v3.1
22
31
 
23
32
  ### Added
24
33
 
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.69'
20
- gem 'rubocop-capybara', '~> 2.20'
21
- gem 'rubocop-rails', '~> 2.28'
22
- gem 'rubocop-rake', '~> 0.6'
23
- gem 'rubocop-rspec', '~> 3.3'
19
+ gem 'rubocop', '~> 1.74'
20
+ gem 'rubocop-capybara', '~> 2.22'
21
+ gem 'rubocop-rails', '~> 2.30'
22
+ gem 'rubocop-rake', '~> 0.7'
23
+ gem 'rubocop-rspec', '~> 3.5'
24
24
 
25
25
  # Gems for documenting the package
26
26
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (2.1.0)
4
+ ccs-frontend_helpers (2.2.0)
5
5
  rails (>= 7.0)
6
6
 
7
7
  GEM
@@ -96,8 +96,8 @@ GEM
96
96
  rack-test (>= 0.6.3)
97
97
  regexp_parser (>= 1.5, < 3.0)
98
98
  xpath (~> 3.2)
99
- concurrent-ruby (1.3.4)
100
- connection_pool (2.4.1)
99
+ concurrent-ruby (1.3.5)
100
+ connection_pool (2.5.0)
101
101
  crass (1.0.6)
102
102
  date (3.3.4)
103
103
  diff-lcs (1.5.1)
@@ -106,14 +106,15 @@ GEM
106
106
  erubi (1.13.0)
107
107
  globalid (1.2.1)
108
108
  activesupport (>= 6.1)
109
- i18n (1.14.6)
109
+ i18n (1.14.7)
110
110
  concurrent-ruby (~> 1.0)
111
111
  io-console (0.7.2)
112
112
  irb (1.14.0)
113
113
  rdoc (>= 4.0.0)
114
114
  reline (>= 0.4.2)
115
- json (2.9.1)
116
- language_server-protocol (3.17.0.3)
115
+ json (2.10.2)
116
+ language_server-protocol (3.17.0.4)
117
+ lint_roller (1.1.0)
117
118
  loofah (2.22.0)
118
119
  crass (~> 1.0.2)
119
120
  nokogiri (>= 1.12.0)
@@ -137,22 +138,22 @@ GEM
137
138
  net-smtp (0.5.0)
138
139
  net-protocol
139
140
  nio4r (2.7.3)
140
- nokogiri (1.16.7-x86_64-darwin)
141
+ nokogiri (1.18.1-x86_64-darwin)
141
142
  racc (~> 1.4)
142
- nokogiri (1.16.7-x86_64-linux)
143
+ nokogiri (1.18.1-x86_64-linux-gnu)
143
144
  racc (~> 1.4)
144
145
  nokogiri-diff (0.3.0)
145
146
  nokogiri (~> 1.5)
146
147
  tdiff (~> 0.4)
147
148
  parallel (1.26.3)
148
- parser (3.3.6.0)
149
+ parser (3.3.7.1)
149
150
  ast (~> 2.4.1)
150
151
  racc
151
152
  psych (5.1.2)
152
153
  stringio
153
154
  public_suffix (5.0.4)
154
155
  racc (1.8.1)
155
- rack (3.1.8)
156
+ rack (3.1.11)
156
157
  rack-session (2.0.0)
157
158
  rack (>= 3.0.0)
158
159
  rack-test (2.1.0)
@@ -209,29 +210,34 @@ GEM
209
210
  diff-lcs (>= 1.2.0, < 2.0)
210
211
  rspec-support (~> 3.13.0)
211
212
  rspec-support (3.13.1)
212
- rubocop (1.69.2)
213
+ rubocop (1.74.0)
213
214
  json (~> 2.3)
214
- language_server-protocol (>= 3.17.0)
215
+ language_server-protocol (~> 3.17.0.2)
216
+ lint_roller (~> 1.1.0)
215
217
  parallel (~> 1.10)
216
218
  parser (>= 3.3.0.2)
217
219
  rainbow (>= 2.2.2, < 4.0)
218
220
  regexp_parser (>= 2.9.3, < 3.0)
219
- rubocop-ast (>= 1.36.2, < 2.0)
221
+ rubocop-ast (>= 1.38.0, < 2.0)
220
222
  ruby-progressbar (~> 1.7)
221
223
  unicode-display_width (>= 2.4.0, < 4.0)
222
- rubocop-ast (1.37.0)
224
+ rubocop-ast (1.39.0)
223
225
  parser (>= 3.3.1.0)
224
- rubocop-capybara (2.21.0)
225
- rubocop (~> 1.41)
226
- rubocop-rails (2.28.0)
226
+ rubocop-capybara (2.22.1)
227
+ lint_roller (~> 1.1)
228
+ rubocop (~> 1.72, >= 1.72.1)
229
+ rubocop-rails (2.30.3)
227
230
  activesupport (>= 4.2.0)
231
+ lint_roller (~> 1.1)
228
232
  rack (>= 1.1)
229
- rubocop (>= 1.52.0, < 2.0)
230
- rubocop-ast (>= 1.31.1, < 2.0)
231
- rubocop-rake (0.6.0)
232
- rubocop (~> 1.0)
233
- rubocop-rspec (3.3.0)
234
- rubocop (~> 1.61)
233
+ rubocop (>= 1.72.1, < 2.0)
234
+ rubocop-ast (>= 1.38.0, < 2.0)
235
+ rubocop-rake (0.7.1)
236
+ lint_roller (~> 1.1)
237
+ rubocop (>= 1.72.1)
238
+ rubocop-rspec (3.5.0)
239
+ lint_roller (~> 1.1)
240
+ rubocop (~> 1.72, >= 1.72.1)
235
241
  ruby-progressbar (1.13.0)
236
242
  simplecov (0.22.0)
237
243
  docile (~> 1.1)
@@ -245,7 +251,7 @@ GEM
245
251
  timeout (0.4.1)
246
252
  tzinfo (2.0.6)
247
253
  concurrent-ruby (~> 1.0)
248
- unicode-display_width (3.1.3)
254
+ unicode-display_width (3.1.4)
249
255
  unicode-emoji (~> 4.0, >= 4.0.4)
250
256
  unicode-emoji (4.0.4)
251
257
  webrick (1.8.1)
@@ -271,11 +277,11 @@ DEPENDENCIES
271
277
  nokogiri-diff (~> 0.3.0)
272
278
  rake (~> 13.2)
273
279
  rspec (~> 3.13)
274
- rubocop (~> 1.69)
275
- rubocop-capybara (~> 2.20)
276
- rubocop-rails (~> 2.28)
277
- rubocop-rake (~> 0.6)
278
- rubocop-rspec (~> 3.3)
280
+ rubocop (~> 1.74)
281
+ rubocop-capybara (~> 2.22)
282
+ rubocop-rails (~> 2.30)
283
+ rubocop-rake (~> 0.7)
284
+ rubocop-rspec (~> 3.5)
279
285
  simplecov (~> 0.21)
280
286
  yard (~> 0.9)
281
287
 
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.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) |
17
18
  | [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) |
18
19
  | [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) |
19
20
  | [1.2.0](https://github.com/Crown-Commercial-Service/ccs-frontend_helpers/releases/tag/v1.2.0) | [5.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.6.0) | [1.1.3](https://github.com/Crown-Commercial-Service/ccs-frontend-project/releases/tag/v1.1.3) |
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.description = 'Gem containing view helpers for CCS Ruby on Rails projects'
12
12
  spec.homepage = 'https://github.com/Crown-Commercial-Service/ccs-frontend_helpers'
13
13
  spec.license = 'MIT'
14
- spec.required_ruby_version = '>= 3.1.0'
14
+ spec.required_ruby_version = '>= 3.2.0'
15
15
 
16
16
  # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
17
17
 
@@ -32,8 +32,8 @@ module CCS
32
32
  # @option options [String] :classes additional CSS classes for the contact us HTML
33
33
  # @option options [Hash] :attributes additional attributes that will added as part of the contact us HTML
34
34
 
35
- def initialize(contact_us_link_href:, having_problems_text: nil, contact_us_link_text: nil, contact_us_text: nil, **options)
36
- super(**options)
35
+ def initialize(contact_us_link_href:, having_problems_text: nil, contact_us_link_text: nil, contact_us_text: nil, **)
36
+ super(**)
37
37
 
38
38
  @contact_us_link_href = contact_us_link_href
39
39
  @contact_us_link_text = contact_us_link_text || 'Contact us (opens in a new tab)'
@@ -30,8 +30,8 @@ module CCS
30
30
  # @option options [String] :width (default: 'one-third') the width of the panel
31
31
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
32
32
 
33
- def initialize(title:, href:, description:, **options)
34
- super(**options)
33
+ def initialize(title:, href:, description:, **)
34
+ super(**)
35
35
 
36
36
  @options[:attributes][:class] << " govuk-grid-column-#{@options[:width] || 'one-third'}"
37
37
 
@@ -29,8 +29,8 @@ module CCS
29
29
  # @option options [String] :width (default: 'full') the width of the dashboard section
30
30
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
31
 
32
- def initialize(dashboard_section_panels:, title_text: nil, **options)
33
- super(**options)
32
+ def initialize(dashboard_section_panels:, title_text: nil, **)
33
+ super(**)
34
34
 
35
35
  @options[:width] ||= 'full'
36
36
 
@@ -29,8 +29,8 @@ module CCS
29
29
  #
30
30
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
31
 
32
- def initialize(text:, href:, li_class:, **options)
33
- super(**options)
32
+ def initialize(text:, href:, li_class:, **)
33
+ super(**)
34
34
 
35
35
  @text = text
36
36
  @href = href
@@ -36,8 +36,8 @@ module CCS
36
36
  # @option options [ActiveSupport::SafeBuffer,String] :copyright The copyright information, (default: '© Crown copyright')
37
37
  # @option options [Hash] :attributes additional attributes that will added as part of the HTML
38
38
 
39
- def initialize(navigation: nil, meta: nil, **options)
40
- super(**options)
39
+ def initialize(navigation: nil, meta: nil, **)
40
+ super(**)
41
41
 
42
42
  @options[:copyright] ||= '© Crown copyright'
43
43
 
@@ -30,8 +30,8 @@ module CCS
30
30
  # @option options [Boolean] :active flag to mark the navigation item as active or not
31
31
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
32
32
 
33
- def initialize(text:, li_class:, href: nil, **options)
34
- super(**options)
33
+ def initialize(text:, li_class:, href: nil, **)
34
+ super(**)
35
35
 
36
36
  @text = text
37
37
  @href = href
@@ -44,8 +44,8 @@ module CCS
44
44
  # @option options [String] :homepage_url URL of the homepage. Defaults to +/https://www.crowncommercial.gov.uk+
45
45
  # @option options [Hash] :attributes additional attributes that will added as part of the header HTML
46
46
 
47
- def initialize(service_authentication_items: nil, navigation: nil, menu_button: nil, service: nil, **options)
48
- super(**options)
47
+ def initialize(service_authentication_items: nil, navigation: nil, menu_button: nil, service: nil, **)
48
+ super(**)
49
49
 
50
50
  @options[:container_classes] ||= 'govuk-width-container'
51
51
  @options[:homepage_url] ||= 'https://www.crowncommercial.gov.uk'
@@ -26,8 +26,8 @@ module CCS
26
26
  # @option options [String] :classes additional CSS classes for the password strength HTML
27
27
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
28
28
 
29
- def initialize(password_id:, password_strength_tests:, **options)
30
- super(**options)
29
+ def initialize(password_id:, password_strength_tests:, **)
30
+ super(**)
31
31
 
32
32
  @options[:attributes][:data][:target] = password_id
33
33
 
@@ -27,8 +27,8 @@ module CCS
27
27
  # @option options [String] :classes additional CSS classes for the back link HTML
28
28
  # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
29
29
 
30
- def initialize(text:, href:, **options)
31
- super(**options)
30
+ def initialize(text:, href:, **)
31
+ super(**)
32
32
 
33
33
  @text = text
34
34
  @href = href
@@ -28,8 +28,8 @@ module CCS
28
28
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
29
29
  # If the link is blank then it defaults to +{ aria: { current: 'page' } }+
30
30
 
31
- def initialize(text:, href: nil, **options)
32
- super(**options)
31
+ def initialize(text:, href: nil, **)
32
+ super(**)
33
33
 
34
34
  @text = text
35
35
  @href = href
@@ -27,8 +27,8 @@ module CCS
27
27
  # @option options [Boolean] :collapse_on_mobile indicates if it is to colapse breadcrumbs on mobile
28
28
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
29
29
 
30
- def initialize(breadcrumb_links:, **options)
31
- super(**options)
30
+ def initialize(breadcrumb_links:, **)
31
+ super(**)
32
32
  @options[:attributes][:class] << ' govuk-breadcrumbs--collapse-on-mobile' if @options[:collapse_on_mobile]
33
33
  (@options[:attributes][:aria] ||= {})[:label] ||= 'Breadcrumb'
34
34
 
@@ -29,8 +29,8 @@ module CCS
29
29
  # @option options [ActionView::Helpers::FormBuilder] :form the form builder used to create the submit button
30
30
  # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
31
31
 
32
- def initialize(text:, **options)
33
- super(**options)
32
+ def initialize(text:, **)
33
+ super(**)
34
34
 
35
35
  if @options[:attributes][:disabled]
36
36
  @options[:attributes][:aria] ||= {}
@@ -31,8 +31,8 @@ module CCS
31
31
  # If the +:type+ key is present with a value of +:button+,
32
32
  # the action will be rendered as a button
33
33
 
34
- def initialize(text:, href: nil, **options)
35
- super(**options)
34
+ def initialize(text:, href: nil, **)
35
+ super(**)
36
36
 
37
37
  @text = text
38
38
  @href = href
@@ -35,8 +35,8 @@ module CCS
35
35
  # @option options [String] :classes additional CSS classes for the cookie message HTML
36
36
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
37
37
 
38
- def initialize(heading_text: nil, content: nil, text: nil, actions: nil, **options)
39
- super(**options)
38
+ def initialize(heading_text: nil, content: nil, text: nil, actions: nil, **)
39
+ super(**)
40
40
 
41
41
  @heading_text = heading_text
42
42
  @content = content
@@ -26,8 +26,8 @@ module CCS
26
26
  # @option options [String] :classes additional CSS classes for the cookie banner HTML
27
27
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
28
28
 
29
- def initialize(messages:, **options)
30
- super(**options)
29
+ def initialize(messages:, **)
30
+ super(**)
31
31
 
32
32
  (@options[:attributes][:data] ||= {})[:nosnippet] = 'true'
33
33
  @options[:attributes][:role] = 'region'
@@ -24,8 +24,8 @@ module CCS
24
24
  # @option options [String] :classes additional CSS classes for the details HTML
25
25
  # @option options [Hash] :attributes ({ data: { module: 'govuk-details' } }) any additional attributes that will added as part of the HTML
26
26
 
27
- def initialize(summary_text:, **options)
28
- super(**options)
27
+ def initialize(summary_text:, **)
28
+ super(**)
29
29
 
30
30
  @summary_text = summary_text
31
31
  end
@@ -30,8 +30,8 @@ module CCS
30
30
  # @option options [String] :visually_hidden_text ('Error') visualy hidden text before the error message
31
31
  # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the HTML
32
32
 
33
- def initialize(message:, attribute:, **options)
34
- super(**options)
33
+ def initialize(message:, attribute:, **)
34
+ super(**)
35
35
 
36
36
  @options[:attributes][:id] ||= "#{attribute}-error" if attribute
37
37
 
@@ -27,8 +27,8 @@ module CCS
27
27
  #
28
28
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
29
29
 
30
- def initialize(text:, href: nil, **options)
31
- super(**options)
30
+ def initialize(text:, href: nil, **)
31
+ super(**)
32
32
 
33
33
  @text = text
34
34
  @href = href
@@ -31,8 +31,8 @@ module CCS
31
31
  # @option options [String] :classes additional CSS classes for the error summary HTML
32
32
  # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the HTML
33
33
 
34
- def initialize(title:, error_summary_items: [], description: nil, **options)
35
- super(**options)
34
+ def initialize(title:, error_summary_items: [], description: nil, **)
35
+ super(**)
36
36
 
37
37
  @title = title
38
38
  @error_summary_items = error_summary_items.map { |error_summary_item| Item.new(context: @context, **error_summary_item) }
@@ -58,6 +58,8 @@ module CCS
58
58
  def initialise_textarea(attribute, character_count_attribute, character_count_options, context, options)
59
59
  set_character_count_from_group_options(character_count_options, options)
60
60
 
61
+ character_count_attribute = options.dig(:attributes, :id) if options.dig(:attributes, :id)
62
+
61
63
  ((options[:attributes] ||= {})[:aria] ||= {})[:describedby] = [options.dig(:attributes, :aria, :describedby), "#{character_count_attribute}-info"].compact.join(' ')
62
64
  options[:classes] = "govuk-js-character-count #{options[:classes]}".rstrip
63
65
 
@@ -9,8 +9,52 @@ module CCS
9
9
  #
10
10
  # This is used for generating the file upload component from the
11
11
  # {https://design-system.service.gov.uk/components/file-upload GDS - Components - File Upload}
12
+ #
13
+ # @!attribute [r] javascript
14
+ # @return [Boolean] Used to enable JavaScript enhancements for the component
15
+ # @!attribute [r] file_upload_javascript_options
16
+ # @return [Hash] HTML options for the JavaScript part of file upload
12
17
 
13
18
  class FileUpload < Input
19
+ private
20
+
21
+ attr_reader :javascript, :file_upload_javascript_options
22
+
23
+ public
24
+
25
+ # @param (see CCS::Components::GovUK::Field::Upload#initialize)
26
+ # @param javascript [Boolean] used to enable JavaScript enhancements for the component
27
+ #
28
+ # @option (see CCS::Components::GovUK::Field::Upload#initialize)
29
+
30
+ def initialize(attribute:, javascript: false, **)
31
+ super(attribute: attribute, **)
32
+
33
+ @javascript = javascript
34
+
35
+ return unless javascript
36
+
37
+ @file_upload_javascript_options = {
38
+ class: 'govuk-drop-zone',
39
+ data: {
40
+ module: 'govuk-file-upload'
41
+ }
42
+ }
43
+
44
+ %i[choose_files_button no_file_chosen multiple_files_chosen drop_instruction entered_drop_zone left_drop_zone].each do |data_attribute|
45
+ data_attribute_name = :"#{data_attribute}_text"
46
+ if options[data_attribute_name]
47
+ if options[data_attribute_name].is_a? Hash
48
+ options[data_attribute_name].each do |key, value|
49
+ @file_upload_javascript_options[:data][:"i18n.#{data_attribute.to_s.gsub('_', '-')}.#{key}"] = value
50
+ end
51
+ else
52
+ @file_upload_javascript_options[:data][:"i18n.#{data_attribute.to_s.gsub('_', '-')}"] = options[data_attribute_name]
53
+ end
54
+ end
55
+ end
56
+ end
57
+
14
58
  # @param (see CCS::Components::GovUK::Field::Input#initialize)
15
59
  #
16
60
  # @option (see CCS::Components::GovUK::Field::Input#initialize)
@@ -21,10 +65,12 @@ module CCS
21
65
 
22
66
  def render
23
67
  super do
24
- if options[:form]
25
- options[:form].file_field(attribute, **options[:attributes])
26
- else
27
- context.file_field_tag(attribute, **options[:attributes])
68
+ javascript_wrapper do
69
+ if options[:form]
70
+ options[:form].file_field(attribute, **options[:attributes])
71
+ else
72
+ context.file_field_tag(attribute, **options[:attributes])
73
+ end
28
74
  end
29
75
  end
30
76
  end
@@ -32,6 +78,16 @@ module CCS
32
78
  # The default attributes for the file upload
33
79
 
34
80
  DEFAULT_ATTRIBUTES = { class: 'govuk-file-upload' }.freeze
81
+
82
+ private
83
+
84
+ def javascript_wrapper(&)
85
+ if javascript
86
+ tag.div(**file_upload_javascript_options, &)
87
+ else
88
+ yield
89
+ end
90
+ end
35
91
  end
36
92
  end
37
93
  end
@@ -32,8 +32,8 @@ module CCS
32
32
  #
33
33
  # @option (see CCS::Components::GovUK::Field::Input#initialize)
34
34
 
35
- def initialize(attribute:, items:, selected: nil, **options)
36
- super(attribute: attribute, **options)
35
+ def initialize(attribute:, items:, selected: nil, **)
36
+ super(attribute: attribute, **)
37
37
 
38
38
  @items = items.map do |item|
39
39
  [
@@ -28,8 +28,8 @@ module CCS
28
28
  # @option options [String] :classes additional CSS classes for the prefix/suffix HTML
29
29
  # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
30
30
 
31
- def initialize(text:, fix:, **options)
32
- super(**options)
31
+ def initialize(text:, fix:, **)
32
+ super(**)
33
33
 
34
34
  @options[:attributes][:class] = "govuk-input__#{fix}fix #{@options[:attributes][:class]}".rstrip
35
35
  (@options[:attributes][:aria] ||= {})[:hidden] = true
@@ -42,8 +42,8 @@ module CCS
42
42
  #
43
43
  # @option (see CCS::Components::GovUK::Field::Input#initialize)
44
44
 
45
- def initialize(attribute:, field_type: :text, value: nil, prefix: nil, suffix: nil, input_wrapper: {}, **options)
46
- super(attribute: attribute, **options)
45
+ def initialize(attribute:, field_type: :text, value: nil, prefix: nil, suffix: nil, input_wrapper: {}, **)
46
+ super(attribute: attribute, **)
47
47
 
48
48
  @field_type = :"#{field_type}_field"
49
49
  @value = @options[:model] ? @options[:model].send(attribute) : value
@@ -26,8 +26,8 @@ module CCS
26
26
  #
27
27
  # @option (see CCS::Components::GovUK::Field::Input#initialize)
28
28
 
29
- def initialize(attribute:, content: nil, rows: 5, **options)
30
- super(attribute: attribute, **options)
29
+ def initialize(attribute:, content: nil, rows: 5, **)
30
+ super(attribute: attribute, **)
31
31
 
32
32
  @options[:attributes][:rows] ||= rows
33
33
 
@@ -22,8 +22,8 @@ module CCS
22
22
  #
23
23
  # @option (see CCS::Components::GovUK::Field::Inputs#initialize)
24
24
 
25
- def initialize(attribute:, checkbox_items:, **options)
26
- super(attribute: attribute, **options)
25
+ def initialize(attribute:, checkbox_items:, **)
26
+ super(attribute: attribute, **)
27
27
 
28
28
  @options[:values] ||= []
29
29
  @options[:values] = (@options[:model] || @options[:form].object).send(attribute) || [] if @options[:model] || @options[:form]