ccs-frontend_helpers 0.1.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -3
  3. data/CHANGELOG.md +40 -0
  4. data/Gemfile +7 -6
  5. data/Gemfile.lock +121 -114
  6. data/README.md +12 -0
  7. data/lib/ccs/components/ccs/footer.rb +0 -1
  8. data/lib/ccs/components/ccs/header.rb +0 -1
  9. data/lib/ccs/components/govuk/accordion/section/content.rb +1 -1
  10. data/lib/ccs/components/govuk/accordion.rb +11 -0
  11. data/lib/ccs/components/govuk/button.rb +4 -1
  12. data/lib/ccs/components/govuk/cookie_banner/action.rb +1 -0
  13. data/lib/ccs/components/govuk/cookie_banner/message.rb +1 -1
  14. data/lib/ccs/components/govuk/details.rb +1 -1
  15. data/lib/ccs/components/govuk/error_message.rb +5 -2
  16. data/lib/ccs/components/govuk/exit_this_page.rb +79 -0
  17. data/lib/ccs/components/govuk/field/input/character_count/count_message.rb +62 -0
  18. data/lib/ccs/components/govuk/field/input/character_count.rb +55 -42
  19. data/lib/ccs/components/govuk/field/input/password_input/show_hide_button.rb +72 -0
  20. data/lib/ccs/components/govuk/field/input/password_input.rb +101 -0
  21. data/lib/ccs/components/govuk/field/input/select.rb +2 -2
  22. data/lib/ccs/components/govuk/field/input/text_input.rb +23 -7
  23. data/lib/ccs/components/govuk/field/input.rb +4 -0
  24. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +8 -28
  25. data/lib/ccs/components/govuk/field/inputs/date_input.rb +4 -25
  26. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +1 -13
  27. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +1 -13
  28. data/lib/ccs/components/govuk/field/inputs/item.rb +24 -10
  29. data/lib/ccs/components/govuk/field/inputs/radios.rb +7 -23
  30. data/lib/ccs/components/govuk/field/inputs.rb +31 -7
  31. data/lib/ccs/components/govuk/field.rb +12 -2
  32. data/lib/ccs/components/govuk/fieldset.rb +1 -1
  33. data/lib/ccs/components/govuk/footer/meta.rb +1 -1
  34. data/lib/ccs/components/govuk/footer.rb +1 -2
  35. data/lib/ccs/components/govuk/header/navigation.rb +4 -2
  36. data/lib/ccs/components/govuk/header.rb +26 -8
  37. data/lib/ccs/components/govuk/pagination/increment/next.rb +6 -3
  38. data/lib/ccs/components/govuk/pagination/increment/previous.rb +6 -3
  39. data/lib/ccs/components/govuk/pagination/increment.rb +11 -3
  40. data/lib/ccs/components/govuk/pagination/item.rb +1 -1
  41. data/lib/ccs/components/govuk/pagination.rb +2 -3
  42. data/lib/ccs/components/govuk/summary_list/action/link.rb +18 -3
  43. data/lib/ccs/components/govuk/summary_list/card/actions.rb +3 -2
  44. data/lib/ccs/components/govuk/summary_list/card.rb +1 -1
  45. data/lib/ccs/components/govuk/summary_list/row/actions.rb +3 -2
  46. data/lib/ccs/components/govuk/summary_list/row.rb +7 -2
  47. data/lib/ccs/components/govuk/summary_list.rb +1 -1
  48. data/lib/ccs/components/govuk/tabs.rb +5 -3
  49. data/lib/ccs/components/govuk/task_list/item/status.rb +64 -0
  50. data/lib/ccs/components/govuk/task_list/item/title.rb +54 -0
  51. data/lib/ccs/components/govuk/task_list/item.rb +75 -0
  52. data/lib/ccs/components/govuk/task_list.rb +52 -0
  53. data/lib/ccs/components/govuk/warning_text.rb +1 -1
  54. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +1 -1
  55. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +1 -1
  56. data/lib/ccs/frontend_helpers/govuk_frontend/exit_this_page.rb +28 -0
  57. data/lib/ccs/frontend_helpers/govuk_frontend/password_input.rb +28 -0
  58. data/lib/ccs/frontend_helpers/govuk_frontend/task_list.rb +28 -0
  59. data/lib/ccs/frontend_helpers/govuk_frontend.rb +6 -0
  60. data/lib/ccs/frontend_helpers/version.rb +1 -1
  61. data/package.json +10 -0
  62. data/yarn.lock +8 -0
  63. metadata +15 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1786ee02c965fd81738607681aab036498751bda16a9d4fba12862d8690dce63
4
- data.tar.gz: 16db55bafa1e30038a04007529b55c11e013c606a7578a383e6cefa25be47815
3
+ metadata.gz: d935d241fb0117c445c9e5a7eaa2cee257c5f7bc1e68457baf347aabf946a664
4
+ data.tar.gz: 4a8328285e0adad683eafbf72d8385ea7b3703ae352eded484eb6595bb8ce136
5
5
  SHA512:
6
- metadata.gz: d2ec119f59395f3d2d12a09442e9aee00098aa7cc9a2cf601564002feb5752d4b7399e6c4f091404c89b3f2e93d4ac889f35fd883fdf38142ee4ef939f1565c3
7
- data.tar.gz: 225e9d0089b818103b01709d4dbd9a68185e1da445a60d936f99c30f6c5bb7ab6c22821f51c84a447ae372d50f9b11f1430a64f9054b54e31c7fd30268129e9f
6
+ metadata.gz: 3e4698ad6bcca9cfc345922d05da7580f8f21c4789ff2631d838001f0cd68090c0039467d95e2af4fee2b279822e9b522bfcc42f9ee198c89f4658e153e9e9ae
7
+ data.tar.gz: 5fb56ee826dc2350d685e6fa888e11e2644bbf199db306a9953174b386e21efd42393db88f62813268218f0a387f15e107f3f010d8d2964690063034808833f2
data/.rubocop.yml CHANGED
@@ -126,11 +126,13 @@ RSpec/MultipleExpectations:
126
126
  Max: 3
127
127
 
128
128
  RSpec/FilePath:
129
- CustomTransform:
130
- GovUKFrontend: govuk_frontend
131
- GovUK: govuk
129
+ Enabled: false
132
130
 
133
131
  RSpec/SpecFilePathFormat:
134
132
  CustomTransform:
135
133
  GovUKFrontend: govuk_frontend
136
134
  GovUK: govuk
135
+
136
+ Rails/OutputSafety:
137
+ Exclude:
138
+ - 'spec/ccs/frontend_helpers/**/*fixtures_spec.rb'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ ## [0.3.0] - 2024-04-12
2
+
3
+ Update components to be compatible with GOV.UK Frontend v5.3
4
+
5
+ ### 🆕 New features
6
+
7
+ The following GOV.UK helpers have been added:
8
+
9
+ - Password input
10
+
11
+ ## [0.2.0] - 2024-03-13
12
+
13
+ ### 💥 Breaking changes
14
+
15
+ Update components to be compatible with GOV.UK Frontend v5.2
16
+
17
+ For pagination, the option to enable ellipsis is now:
18
+ ```ruby
19
+ {
20
+ ellipsis: true
21
+ }
22
+ ```
23
+ instead of:
24
+ ```ruby
25
+ {
26
+ type: :ellipsis
27
+ }
28
+ ```
29
+
30
+ ### 🏠 Internal changes
31
+
32
+ Add tests for GOV.UK Frontend fixtures
33
+
34
+ ### 🆕 New features
35
+
36
+ The following GOV.UK helpers have been added:
37
+
38
+ - Exit this page
39
+ - Task list
40
+
1
41
  ## [0.1.2] - 2023-11-16
2
42
 
3
43
  Fix issue with radios component which, when passed a model or form, would treat the value as an array.
data/Gemfile CHANGED
@@ -7,18 +7,19 @@ gemspec
7
7
 
8
8
  # Gems for building the package
9
9
  gem 'bundler', '~> 2.3'
10
- gem 'rake', '~> 13.1'
10
+ gem 'rake', '~> 13.2'
11
11
 
12
12
  # Gems for testing the package
13
- gem 'capybara', '~> 3.39.2'
14
- gem 'rspec', '~> 3.12'
13
+ gem 'capybara', '~> 3.40.0'
14
+ gem 'rspec', '~> 3.13'
15
15
  gem 'simplecov', '~> 0.21'
16
+ gem 'nokogiri-diff', '~> 0.3.0'
16
17
 
17
18
  # Gems for linting/formatting the package
18
- gem 'rubocop', '~> 1.57'
19
- gem 'rubocop-rails', '~> 2.22'
19
+ gem 'rubocop', '~> 1.62'
20
+ gem 'rubocop-rails', '~> 2.24'
20
21
  gem 'rubocop-rake', '~> 0.6'
21
- gem 'rubocop-rspec', '~> 2.25'
22
+ gem 'rubocop-rspec', '~> 2.29'
22
23
 
23
24
  # Gems for documenting the package
24
25
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,41 +1,41 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.2)
4
+ ccs-frontend_helpers (0.3.0)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.2)
11
- actionpack (= 7.1.2)
12
- activesupport (= 7.1.2)
10
+ actioncable (7.1.3.2)
11
+ actionpack (= 7.1.3.2)
12
+ activesupport (= 7.1.3.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.2)
17
- actionpack (= 7.1.2)
18
- activejob (= 7.1.2)
19
- activerecord (= 7.1.2)
20
- activestorage (= 7.1.2)
21
- activesupport (= 7.1.2)
16
+ actionmailbox (7.1.3.2)
17
+ actionpack (= 7.1.3.2)
18
+ activejob (= 7.1.3.2)
19
+ activerecord (= 7.1.3.2)
20
+ activestorage (= 7.1.3.2)
21
+ activesupport (= 7.1.3.2)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.1.2)
27
- actionpack (= 7.1.2)
28
- actionview (= 7.1.2)
29
- activejob (= 7.1.2)
30
- activesupport (= 7.1.2)
26
+ actionmailer (7.1.3.2)
27
+ actionpack (= 7.1.3.2)
28
+ actionview (= 7.1.3.2)
29
+ activejob (= 7.1.3.2)
30
+ activesupport (= 7.1.3.2)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.2)
37
- actionview (= 7.1.2)
38
- activesupport (= 7.1.2)
36
+ actionpack (7.1.3.2)
37
+ actionview (= 7.1.3.2)
38
+ activesupport (= 7.1.3.2)
39
39
  nokogiri (>= 1.8.5)
40
40
  racc
41
41
  rack (>= 2.2.4)
@@ -43,35 +43,35 @@ GEM
43
43
  rack-test (>= 0.6.3)
44
44
  rails-dom-testing (~> 2.2)
45
45
  rails-html-sanitizer (~> 1.6)
46
- actiontext (7.1.2)
47
- actionpack (= 7.1.2)
48
- activerecord (= 7.1.2)
49
- activestorage (= 7.1.2)
50
- activesupport (= 7.1.2)
46
+ actiontext (7.1.3.2)
47
+ actionpack (= 7.1.3.2)
48
+ activerecord (= 7.1.3.2)
49
+ activestorage (= 7.1.3.2)
50
+ activesupport (= 7.1.3.2)
51
51
  globalid (>= 0.6.0)
52
52
  nokogiri (>= 1.8.5)
53
- actionview (7.1.2)
54
- activesupport (= 7.1.2)
53
+ actionview (7.1.3.2)
54
+ activesupport (= 7.1.3.2)
55
55
  builder (~> 3.1)
56
56
  erubi (~> 1.11)
57
57
  rails-dom-testing (~> 2.2)
58
58
  rails-html-sanitizer (~> 1.6)
59
- activejob (7.1.2)
60
- activesupport (= 7.1.2)
59
+ activejob (7.1.3.2)
60
+ activesupport (= 7.1.3.2)
61
61
  globalid (>= 0.3.6)
62
- activemodel (7.1.2)
63
- activesupport (= 7.1.2)
64
- activerecord (7.1.2)
65
- activemodel (= 7.1.2)
66
- activesupport (= 7.1.2)
62
+ activemodel (7.1.3.2)
63
+ activesupport (= 7.1.3.2)
64
+ activerecord (7.1.3.2)
65
+ activemodel (= 7.1.3.2)
66
+ activesupport (= 7.1.3.2)
67
67
  timeout (>= 0.4.0)
68
- activestorage (7.1.2)
69
- actionpack (= 7.1.2)
70
- activejob (= 7.1.2)
71
- activerecord (= 7.1.2)
72
- activesupport (= 7.1.2)
68
+ activestorage (7.1.3.2)
69
+ actionpack (= 7.1.3.2)
70
+ activejob (= 7.1.3.2)
71
+ activerecord (= 7.1.3.2)
72
+ activesupport (= 7.1.3.2)
73
73
  marcel (~> 1.0)
74
- activesupport (7.1.2)
74
+ activesupport (7.1.3.2)
75
75
  base64
76
76
  bigdecimal
77
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -81,41 +81,40 @@ GEM
81
81
  minitest (>= 5.1)
82
82
  mutex_m
83
83
  tzinfo (~> 2.0)
84
- addressable (2.8.4)
84
+ addressable (2.8.6)
85
85
  public_suffix (>= 2.0.2, < 6.0)
86
86
  ast (2.4.2)
87
87
  base64 (0.2.0)
88
- bigdecimal (3.1.4)
88
+ bigdecimal (3.1.7)
89
89
  builder (3.2.4)
90
- capybara (3.39.2)
90
+ capybara (3.40.0)
91
91
  addressable
92
92
  matrix
93
93
  mini_mime (>= 0.1.3)
94
- nokogiri (~> 1.8)
94
+ nokogiri (~> 1.11)
95
95
  rack (>= 1.6.0)
96
96
  rack-test (>= 0.6.3)
97
97
  regexp_parser (>= 1.5, < 3.0)
98
98
  xpath (~> 3.2)
99
- concurrent-ruby (1.2.2)
99
+ concurrent-ruby (1.2.3)
100
100
  connection_pool (2.4.1)
101
101
  crass (1.0.6)
102
102
  date (3.3.4)
103
- diff-lcs (1.5.0)
103
+ diff-lcs (1.5.1)
104
104
  docile (1.4.0)
105
- drb (2.2.0)
106
- ruby2_keywords
105
+ drb (2.2.1)
107
106
  erubi (1.12.0)
108
107
  globalid (1.2.1)
109
108
  activesupport (>= 6.1)
110
- i18n (1.14.1)
109
+ i18n (1.14.4)
111
110
  concurrent-ruby (~> 1.0)
112
- io-console (0.6.0)
113
- irb (1.9.0)
111
+ io-console (0.7.2)
112
+ irb (1.11.2)
114
113
  rdoc
115
- reline (>= 0.3.8)
116
- json (2.6.3)
114
+ reline (>= 0.4.2)
115
+ json (2.7.2)
117
116
  language_server-protocol (3.17.0.3)
118
- loofah (2.21.4)
117
+ loofah (2.22.0)
119
118
  crass (~> 1.0.2)
120
119
  nokogiri (>= 1.12.0)
121
120
  mail (2.8.1)
@@ -126,31 +125,34 @@ GEM
126
125
  marcel (1.0.2)
127
126
  matrix (0.4.2)
128
127
  mini_mime (1.1.5)
129
- minitest (5.20.0)
128
+ minitest (5.22.3)
130
129
  mutex_m (0.2.0)
131
- net-imap (0.4.4)
130
+ net-imap (0.4.10)
132
131
  date
133
132
  net-protocol
134
133
  net-pop (0.1.2)
135
134
  net-protocol
136
135
  net-protocol (0.2.2)
137
136
  timeout
138
- net-smtp (0.4.0)
137
+ net-smtp (0.4.0.1)
139
138
  net-protocol
140
- nio4r (2.5.9)
141
- nokogiri (1.15.4-x86_64-darwin)
139
+ nio4r (2.7.0)
140
+ nokogiri (1.16.2-x86_64-darwin)
142
141
  racc (~> 1.4)
143
- nokogiri (1.15.4-x86_64-linux)
142
+ nokogiri (1.16.2-x86_64-linux)
144
143
  racc (~> 1.4)
145
- parallel (1.23.0)
146
- parser (3.2.2.4)
144
+ nokogiri-diff (0.3.0)
145
+ nokogiri (~> 1.5)
146
+ tdiff (~> 0.4)
147
+ parallel (1.24.0)
148
+ parser (3.3.0.5)
147
149
  ast (~> 2.4.1)
148
150
  racc
149
- psych (5.1.1.1)
151
+ psych (5.1.2)
150
152
  stringio
151
- public_suffix (5.0.1)
153
+ public_suffix (5.0.4)
152
154
  racc (1.7.3)
153
- rack (3.0.8)
155
+ rack (3.0.10)
154
156
  rack-session (2.0.0)
155
157
  rack (>= 3.0.0)
156
158
  rack-test (2.1.0)
@@ -158,20 +160,20 @@ GEM
158
160
  rackup (2.1.0)
159
161
  rack (>= 3)
160
162
  webrick (~> 1.8)
161
- rails (7.1.2)
162
- actioncable (= 7.1.2)
163
- actionmailbox (= 7.1.2)
164
- actionmailer (= 7.1.2)
165
- actionpack (= 7.1.2)
166
- actiontext (= 7.1.2)
167
- actionview (= 7.1.2)
168
- activejob (= 7.1.2)
169
- activemodel (= 7.1.2)
170
- activerecord (= 7.1.2)
171
- activestorage (= 7.1.2)
172
- activesupport (= 7.1.2)
163
+ rails (7.1.3.2)
164
+ actioncable (= 7.1.3.2)
165
+ actionmailbox (= 7.1.3.2)
166
+ actionmailer (= 7.1.3.2)
167
+ actionpack (= 7.1.3.2)
168
+ actiontext (= 7.1.3.2)
169
+ actionview (= 7.1.3.2)
170
+ activejob (= 7.1.3.2)
171
+ activemodel (= 7.1.3.2)
172
+ activerecord (= 7.1.3.2)
173
+ activestorage (= 7.1.3.2)
174
+ activesupport (= 7.1.3.2)
173
175
  bundler (>= 1.15.0)
174
- railties (= 7.1.2)
176
+ railties (= 7.1.3.2)
175
177
  rails-dom-testing (2.2.0)
176
178
  activesupport (>= 5.0.0)
177
179
  minitest
@@ -179,71 +181,75 @@ GEM
179
181
  rails-html-sanitizer (1.6.0)
180
182
  loofah (~> 2.21)
181
183
  nokogiri (~> 1.14)
182
- railties (7.1.2)
183
- actionpack (= 7.1.2)
184
- activesupport (= 7.1.2)
184
+ railties (7.1.3.2)
185
+ actionpack (= 7.1.3.2)
186
+ activesupport (= 7.1.3.2)
185
187
  irb
186
188
  rackup (>= 1.0.0)
187
189
  rake (>= 12.2)
188
190
  thor (~> 1.0, >= 1.2.2)
189
191
  zeitwerk (~> 2.6)
190
192
  rainbow (3.1.1)
191
- rake (13.1.0)
192
- rdoc (6.6.0)
193
+ rake (13.2.1)
194
+ rdoc (6.6.2)
193
195
  psych (>= 4.0.0)
194
- regexp_parser (2.8.2)
195
- reline (0.4.0)
196
+ regexp_parser (2.9.0)
197
+ reline (0.4.2)
196
198
  io-console (~> 0.5)
197
199
  rexml (3.2.6)
198
- rspec (3.12.0)
199
- rspec-core (~> 3.12.0)
200
- rspec-expectations (~> 3.12.0)
201
- rspec-mocks (~> 3.12.0)
202
- rspec-core (3.12.1)
203
- rspec-support (~> 3.12.0)
204
- rspec-expectations (3.12.2)
200
+ rspec (3.13.0)
201
+ rspec-core (~> 3.13.0)
202
+ rspec-expectations (~> 3.13.0)
203
+ rspec-mocks (~> 3.13.0)
204
+ rspec-core (3.13.0)
205
+ rspec-support (~> 3.13.0)
206
+ rspec-expectations (3.13.0)
205
207
  diff-lcs (>= 1.2.0, < 2.0)
206
- rspec-support (~> 3.12.0)
207
- rspec-mocks (3.12.3)
208
+ rspec-support (~> 3.13.0)
209
+ rspec-mocks (3.13.0)
208
210
  diff-lcs (>= 1.2.0, < 2.0)
209
- rspec-support (~> 3.12.0)
210
- rspec-support (3.12.0)
211
- rubocop (1.57.2)
211
+ rspec-support (~> 3.13.0)
212
+ rspec-support (3.13.1)
213
+ rubocop (1.62.1)
212
214
  json (~> 2.3)
213
215
  language_server-protocol (>= 3.17.0)
214
216
  parallel (~> 1.10)
215
- parser (>= 3.2.2.4)
217
+ parser (>= 3.3.0.2)
216
218
  rainbow (>= 2.2.2, < 4.0)
217
219
  regexp_parser (>= 1.8, < 3.0)
218
220
  rexml (>= 3.2.5, < 4.0)
219
- rubocop-ast (>= 1.28.1, < 2.0)
221
+ rubocop-ast (>= 1.31.1, < 2.0)
220
222
  ruby-progressbar (~> 1.7)
221
223
  unicode-display_width (>= 2.4.0, < 3.0)
222
- rubocop-ast (1.30.0)
223
- parser (>= 3.2.1.0)
224
- rubocop-capybara (2.19.0)
224
+ rubocop-ast (1.31.2)
225
+ parser (>= 3.3.0.4)
226
+ rubocop-capybara (2.20.0)
227
+ rubocop (~> 1.41)
228
+ rubocop-factory_bot (2.25.1)
225
229
  rubocop (~> 1.41)
226
- rubocop-factory_bot (2.24.0)
227
- rubocop (~> 1.33)
228
- rubocop-rails (2.22.1)
230
+ rubocop-rails (2.24.1)
229
231
  activesupport (>= 4.2.0)
230
232
  rack (>= 1.1)
231
233
  rubocop (>= 1.33.0, < 2.0)
234
+ rubocop-ast (>= 1.31.1, < 2.0)
232
235
  rubocop-rake (0.6.0)
233
236
  rubocop (~> 1.0)
234
- rubocop-rspec (2.25.0)
237
+ rubocop-rspec (2.29.1)
235
238
  rubocop (~> 1.40)
236
239
  rubocop-capybara (~> 2.17)
237
240
  rubocop-factory_bot (~> 2.22)
241
+ rubocop-rspec_rails (~> 2.28)
242
+ rubocop-rspec_rails (2.28.2)
243
+ rubocop (~> 1.40)
238
244
  ruby-progressbar (1.13.0)
239
- ruby2_keywords (0.0.5)
240
245
  simplecov (0.22.0)
241
246
  docile (~> 1.1)
242
247
  simplecov-html (~> 0.11)
243
248
  simplecov_json_formatter (~> 0.1)
244
249
  simplecov-html (0.12.3)
245
250
  simplecov_json_formatter (0.1.4)
246
- stringio (3.0.9)
251
+ stringio (3.1.0)
252
+ tdiff (0.4.0)
247
253
  thor (1.3.0)
248
254
  timeout (0.4.1)
249
255
  tzinfo (2.0.6)
@@ -255,8 +261,8 @@ GEM
255
261
  websocket-extensions (0.1.5)
256
262
  xpath (3.2.0)
257
263
  nokogiri (~> 1.8)
258
- yard (0.9.34)
259
- zeitwerk (2.6.12)
264
+ yard (0.9.36)
265
+ zeitwerk (2.6.13)
260
266
 
261
267
  PLATFORMS
262
268
  x86_64-darwin-19
@@ -265,14 +271,15 @@ PLATFORMS
265
271
 
266
272
  DEPENDENCIES
267
273
  bundler (~> 2.3)
268
- capybara (~> 3.39.2)
274
+ capybara (~> 3.40.0)
269
275
  ccs-frontend_helpers!
270
- rake (~> 13.1)
271
- rspec (~> 3.12)
272
- rubocop (~> 1.57)
273
- rubocop-rails (~> 2.22)
276
+ nokogiri-diff (~> 0.3.0)
277
+ rake (~> 13.2)
278
+ rspec (~> 3.13)
279
+ rubocop (~> 1.62)
280
+ rubocop-rails (~> 2.24)
274
281
  rubocop-rake (~> 0.6)
275
- rubocop-rspec (~> 2.25)
282
+ rubocop-rspec (~> 2.29)
276
283
  simplecov (~> 0.21)
277
284
  yard (~> 0.9)
278
285
 
data/README.md CHANGED
@@ -8,6 +8,18 @@ This project contains two applications (both use the Ruby on Rails framework):
8
8
  - [Crown Marketplace](https://github.com/Crown-Commercial-Service/crown-marketplace)
9
9
  - [Crown Marketplace Legacy](https://github.com/Crown-Commercial-Service/crown-marketplace-legacy)
10
10
 
11
+ ## Compatibility
12
+
13
+ The following table shows the version of CCS Frontend Helpers that you should use for your targeted version of GOV.UK Frontend:
14
+
15
+ | CCS Frontend Helpers Version | Target GOV.UK Frontend Version |
16
+ | ----------------------------- | ------------------------------ |
17
+ | [0.3.0](https://github.com/tim-s-ccs/ccs-frontend_helpers/releases/tag/v0.3.0) | [5.3.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.3.0) |
18
+ | [0.2.0](https://github.com/tim-s-ccs/ccs-frontend_helpers/releases/tag/v0.2.0) | [5.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.2.0) |
19
+ | [0.1.2](https://github.com/tim-s-ccs/ccs-frontend_helpers/releases/tag/v0.1.2) | [4.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.7.0) |
20
+
21
+ Any other versions of GOV.UK Frontend not shown above _may_ still be compatible, but have not been specifically tested and verified.
22
+
11
23
  ## Installation
12
24
 
13
25
  Install the gem and add to the application's Gemfile by executing:
@@ -37,7 +37,6 @@ module CCS
37
37
  def initialize(navigation: nil, meta: nil, **options)
38
38
  super(**options)
39
39
 
40
- @options[:attributes][:role] = 'contentinfo'
41
40
  @options[:copyright] ||= '© Crown copyright'
42
41
 
43
42
  @navigation = navigation&.map { |navigation_item| Navigation.new(context: @context, **navigation_item) }
@@ -45,7 +45,6 @@ module CCS
45
45
  def initialize(service_authentication_items: nil, navigation: nil, menu_button: nil, service: nil, **options)
46
46
  super(**options)
47
47
 
48
- @options[:attributes][:role] = 'banner'
49
48
  @options[:container_classes] ||= 'govuk-width-container'
50
49
  @options[:homepage_url] ||= 'https://www.crowncommercial.gov.uk'
51
50
 
@@ -41,7 +41,7 @@ module CCS
41
41
  # @return [ActiveSupport::SafeBuffer]
42
42
 
43
43
  def render
44
- tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}", aria: { labelledby: "#{accordion_id}-heading-#{index}" }) do
44
+ tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}") do
45
45
  section[:content] || tag.p(section[:text], class: 'govuk-body')
46
46
  end
47
47
  end
@@ -28,6 +28,12 @@ module CCS
28
28
  #
29
29
  # @option options [String] :classes additional CSS classes for the accordion HTML
30
30
  # @option options [Integer] :heading_level (2) heading level, from 1 to 6
31
+ # @option options [String] :hide_all_sections_text The text content of the ‘Hide all sections’ button at the top of the accordion when all sections are expanded
32
+ # @option options [String] :hide_section_text The text content of the ‘Hide’ button within each section of the accordion, which is visible when the section is expanded
33
+ # @option options [String] :hide_section_aria_label_text Text made available to assistive technologies, like screen-readers, as the final part of the toggle’s accessible name when the section is expanded. Defaults to "Hide this section".
34
+ # @option options [String] :show_all_sections_text The text content of the ‘Show all sections’ button at the top of the accordion when at least one section is collapsed
35
+ # @option options [String] :show_section_text The text content of the ‘Show’ button within each section of the accordion, which is visible when the section is collapsed
36
+ # @option options [String] :show_section_aria_label_text Text made available to assistive technologies, like screen-readers, as the final part of the toggle’s accessible name when the section is collapsed. Defaults to "Show this section".
31
37
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
32
38
 
33
39
  def initialize(accordion_id:, accordion_sections:, **options)
@@ -36,6 +42,11 @@ module CCS
36
42
  @options[:attributes][:id] = accordion_id
37
43
  @options[:heading_level] ||= 2
38
44
 
45
+ %i[hide_all_sections hide_section hide_section_aria_label show_all_sections show_section show_section_aria_label].each do |data_attribute|
46
+ data_attribute_name = :"#{data_attribute}_text"
47
+ @options[:attributes][:data][:"i18n.#{data_attribute.to_s.gsub('_', '-')}"] = options[data_attribute_name] if options[data_attribute_name]
48
+ end
49
+
39
50
  @accordion_sections = accordion_sections.map.with_index(1) { |accordion_section, index| Section.new(section: accordion_section, accordion_id: accordion_id, index: index, heading_level: @options[:heading_level]) }
40
51
  end
41
52
 
@@ -32,7 +32,10 @@ module CCS
32
32
  def initialize(text:, **options)
33
33
  super(**options)
34
34
 
35
- @options[:attributes][:class] << ' govuk-button--disabled' if @options[:attributes][:disabled]
35
+ if @options[:attributes][:disabled]
36
+ @options[:attributes][:aria] ||= {}
37
+ @options[:attributes][:aria][:disabled] = true
38
+ end
36
39
  @options[:attributes][:class] << ' govuk-button--start' if @options[:is_start_button]
37
40
 
38
41
  @text = text
@@ -46,6 +46,7 @@ module CCS
46
46
  if href && options[:attributes][:type] != :button
47
47
  link_to(text, href, **options[:attributes])
48
48
  else
49
+ options[:attributes][:type] ||= :button
49
50
  Button.new(text: text, href: href, context: context, **options).render
50
51
  end
51
52
  end
@@ -56,7 +56,7 @@ module CCS
56
56
  tag.div(class: 'govuk-grid-column-two-thirds') do
57
57
  concat(tag.h2(heading_text, class: 'govuk-cookie-banner__heading govuk-heading-m')) if heading_text
58
58
  concat(tag.div(class: 'govuk-cookie-banner__content') do
59
- content || tag.p(text, class: 'govuk-body')
59
+ content || tag.p(text, class: 'govuk-body') if content || text
60
60
  end)
61
61
  end
62
62
  end)
@@ -46,7 +46,7 @@ module CCS
46
46
 
47
47
  # The default attributes for the details
48
48
 
49
- DEFAULT_ATTRIBUTES = { class: 'govuk-details', data: { module: 'govuk-details' } }.freeze
49
+ DEFAULT_ATTRIBUTES = { class: 'govuk-details' }.freeze
50
50
  end
51
51
  end
52
52
  end
@@ -33,7 +33,7 @@ module CCS
33
33
  def initialize(message:, attribute:, **options)
34
34
  super(**options)
35
35
 
36
- @options[:attributes][:id] ||= "#{attribute}-error"
36
+ @options[:attributes][:id] ||= "#{attribute}-error" if attribute
37
37
 
38
38
  @message = message
39
39
  @attribute = attribute
@@ -46,7 +46,10 @@ module CCS
46
46
 
47
47
  def render
48
48
  tag.p(**options[:attributes]) do
49
- concat(tag.span("#{visually_hidden_text}: ", class: 'govuk-visually-hidden')) if visually_hidden_text.present?
49
+ if visually_hidden_text.present?
50
+ concat(tag.span("#{visually_hidden_text}:", class: 'govuk-visually-hidden'))
51
+ concat(' ')
52
+ end
50
53
  concat(message)
51
54
  end
52
55
  end