ccs-frontend_helpers 0.1.0.rc.1 → 0.1.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +4 -1
  5. data/Gemfile.lock +71 -71
  6. data/lib/ccs/components/base.rb +64 -0
  7. data/lib/ccs/components/ccs/dashboard_section/panel.rb +57 -0
  8. data/lib/ccs/components/ccs/dashboard_section.rb +73 -0
  9. data/lib/ccs/components/ccs/footer/link.rb +55 -0
  10. data/lib/ccs/components/ccs/footer/meta.rb +59 -0
  11. data/lib/ccs/components/ccs/footer/navigation.rb +60 -0
  12. data/lib/ccs/components/ccs/footer.rb +95 -0
  13. data/lib/ccs/components/ccs/header/link.rb +60 -0
  14. data/lib/ccs/components/ccs/header/navigation.rb +98 -0
  15. data/lib/ccs/components/ccs/header/service_authentication.rb +53 -0
  16. data/lib/ccs/components/ccs/header.rb +110 -0
  17. data/lib/ccs/{frontend_helpers/ccs_frontend → components/ccs}/logo.rb +10 -12
  18. data/lib/ccs/components/govuk/accordion/section/content.rb +53 -0
  19. data/lib/ccs/components/govuk/accordion/section/header.rb +57 -0
  20. data/lib/ccs/components/govuk/accordion/section.rb +61 -0
  21. data/lib/ccs/components/govuk/accordion.rb +58 -0
  22. data/lib/ccs/components/govuk/back_link.rb +51 -0
  23. data/lib/ccs/components/govuk/breadcrumbs/link.rb +57 -0
  24. data/lib/ccs/components/govuk/breadcrumbs.rb +55 -0
  25. data/lib/ccs/components/govuk/button.rb +107 -0
  26. data/lib/ccs/components/govuk/cookie_banner/action.rb +60 -0
  27. data/lib/ccs/components/govuk/cookie_banner/message.rb +80 -0
  28. data/lib/ccs/components/govuk/cookie_banner.rb +55 -0
  29. data/lib/ccs/components/govuk/details.rb +53 -0
  30. data/lib/ccs/components/govuk/error_message.rb +60 -0
  31. data/lib/ccs/components/govuk/error_summary/item.rb +54 -0
  32. data/lib/ccs/components/govuk/error_summary.rb +70 -0
  33. data/lib/ccs/components/govuk/field/input/character_count.rb +129 -0
  34. data/lib/ccs/components/govuk/field/input/file_upload.rb +44 -0
  35. data/lib/ccs/components/govuk/field/input/select.rb +82 -0
  36. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +55 -0
  37. data/lib/ccs/components/govuk/field/input/text_input.rb +97 -0
  38. data/lib/ccs/components/govuk/field/input/textarea.rb +59 -0
  39. data/lib/ccs/components/govuk/field/input.rb +62 -0
  40. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +69 -0
  41. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +65 -0
  42. data/lib/ccs/components/govuk/field/inputs/date_input.rb +89 -0
  43. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +47 -0
  44. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +43 -0
  45. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +50 -0
  46. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +50 -0
  47. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +44 -0
  48. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +43 -0
  49. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +50 -0
  50. data/lib/ccs/components/govuk/field/inputs/item.rb +111 -0
  51. data/lib/ccs/components/govuk/field/inputs/radios.rb +69 -0
  52. data/lib/ccs/components/govuk/field/inputs.rb +57 -0
  53. data/lib/ccs/components/govuk/field.rb +108 -0
  54. data/lib/ccs/components/govuk/fieldset/legend.rb +65 -0
  55. data/lib/ccs/components/govuk/fieldset.rb +54 -0
  56. data/lib/ccs/components/govuk/footer/link.rb +55 -0
  57. data/lib/ccs/components/govuk/footer/meta.rb +59 -0
  58. data/lib/ccs/components/govuk/footer/navigation.rb +60 -0
  59. data/lib/ccs/components/govuk/footer.rb +131 -0
  60. data/lib/ccs/components/govuk/form_group.rb +60 -0
  61. data/lib/ccs/components/govuk/header/link.rb +56 -0
  62. data/lib/ccs/components/govuk/header/navigation.rb +71 -0
  63. data/lib/ccs/components/govuk/header.rb +107 -0
  64. data/lib/ccs/components/govuk/hint.rb +49 -0
  65. data/lib/ccs/components/govuk/inset_text.rb +52 -0
  66. data/lib/ccs/components/govuk/label.rb +85 -0
  67. data/lib/ccs/components/govuk/notification_banner.rb +107 -0
  68. data/lib/ccs/components/govuk/pagination/increment/next.rb +44 -0
  69. data/lib/ccs/components/govuk/pagination/increment/previous.rb +43 -0
  70. data/lib/ccs/components/govuk/pagination/increment.rb +98 -0
  71. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +28 -0
  72. data/lib/ccs/components/govuk/pagination/item/form.rb +49 -0
  73. data/lib/ccs/components/govuk/pagination/item/tag.rb +47 -0
  74. data/lib/ccs/components/govuk/pagination/item.rb +64 -0
  75. data/lib/ccs/components/govuk/pagination.rb +96 -0
  76. data/lib/ccs/components/govuk/panel.rb +62 -0
  77. data/lib/ccs/components/govuk/phase_banner.rb +69 -0
  78. data/lib/ccs/components/govuk/skip_link.rb +51 -0
  79. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +53 -0
  80. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +50 -0
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +45 -0
  82. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +63 -0
  83. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +69 -0
  84. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +56 -0
  85. data/lib/ccs/components/govuk/step_by_step_navigation.rb +59 -0
  86. data/lib/ccs/components/govuk/summary_list/action/link.rb +59 -0
  87. data/lib/ccs/components/govuk/summary_list/card/actions.rb +59 -0
  88. data/lib/ccs/components/govuk/summary_list/card/title.rb +51 -0
  89. data/lib/ccs/components/govuk/summary_list/card.rb +63 -0
  90. data/lib/ccs/components/govuk/summary_list/row/actions.rb +59 -0
  91. data/lib/ccs/components/govuk/summary_list/row/key.rb +47 -0
  92. data/lib/ccs/components/govuk/summary_list/row/value.rb +47 -0
  93. data/lib/ccs/components/govuk/summary_list/row.rb +65 -0
  94. data/lib/ccs/components/govuk/summary_list.rb +74 -0
  95. data/lib/ccs/components/govuk/table/body/data_cell.rb +53 -0
  96. data/lib/ccs/components/govuk/table/body/head_cell.rb +52 -0
  97. data/lib/ccs/components/govuk/table/header/head_cell.rb +54 -0
  98. data/lib/ccs/components/govuk/table.rb +111 -0
  99. data/lib/ccs/components/govuk/tabs/panel.rb +58 -0
  100. data/lib/ccs/components/govuk/tabs/tab.rb +56 -0
  101. data/lib/ccs/components/govuk/tabs.rb +66 -0
  102. data/lib/ccs/components/govuk/tag.rb +51 -0
  103. data/lib/ccs/components/govuk/warning_text.rb +61 -0
  104. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +27 -0
  105. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +6 -119
  106. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +6 -183
  107. data/lib/ccs/frontend_helpers/ccs_frontend.rb +2 -4
  108. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +8 -95
  109. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +6 -17
  110. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +6 -54
  111. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +6 -105
  112. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +28 -0
  113. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +28 -0
  114. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +6 -114
  115. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +28 -0
  116. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +7 -23
  117. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +11 -32
  118. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +13 -65
  119. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +7 -48
  120. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +28 -0
  121. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +6 -161
  122. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +13 -24
  123. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +6 -139
  124. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +8 -17
  125. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +28 -0
  126. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +7 -21
  127. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +7 -70
  128. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +7 -113
  129. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +6 -314
  130. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +7 -28
  131. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +8 -27
  132. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +28 -0
  133. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +28 -0
  134. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +6 -18
  135. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +7 -186
  136. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +6 -204
  137. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +6 -102
  138. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +6 -73
  139. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +7 -21
  140. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +28 -0
  141. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +7 -30
  142. data/lib/ccs/frontend_helpers/govuk_frontend.rb +17 -19
  143. data/lib/ccs/frontend_helpers/version.rb +1 -1
  144. metadata +110 -14
  145. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_panels.rb +0 -79
  146. data/lib/ccs/frontend_helpers/govuk_frontend/field/character_count.rb +0 -165
  147. data/lib/ccs/frontend_helpers/govuk_frontend/field/checkboxes.rb +0 -200
  148. data/lib/ccs/frontend_helpers/govuk_frontend/field/date_input.rb +0 -153
  149. data/lib/ccs/frontend_helpers/govuk_frontend/field/file_upload.rb +0 -83
  150. data/lib/ccs/frontend_helpers/govuk_frontend/field/input.rb +0 -153
  151. data/lib/ccs/frontend_helpers/govuk_frontend/field/radios.rb +0 -201
  152. data/lib/ccs/frontend_helpers/govuk_frontend/field/select.rb +0 -124
  153. data/lib/ccs/frontend_helpers/govuk_frontend/field/textarea.rb +0 -106
  154. data/lib/ccs/frontend_helpers/govuk_frontend/field.rb +0 -213
  155. data/lib/ccs/frontend_helpers/shared_methods.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 688e4ab0ddc41179157be55abb6a1afe720c55e027305e840d009cfbdad580c9
4
- data.tar.gz: c8aa5d34f38f99b2e70f4eea14d0614075bd2c6d58ed7ba1fdb92683594ad65e
3
+ metadata.gz: 675c60c51c25d5cd22e26b1e92a579053d1340200bc4a33e9a4e36e65b6790ca
4
+ data.tar.gz: b90658aa1deadfa04ee5dd2d12be7f8a62b83656017a0fc557812fced67a789f
5
5
  SHA512:
6
- metadata.gz: 7a3f14a98c028b451ba6d39962923eac034b9a0619adb3722d40f7f3230dd860f5ca8bffc4eb1f94292b1c6d87772df96c272a946e0c00d78fdc681f16cb3cc4
7
- data.tar.gz: 89519f4a8a15e9a2d4517a03562e2c001635f5b79fbb1020474393f45b32f7b8f0cf22d3c1541e711e945425542416791cb4cc6c9e4608faf336e14af668277a
6
+ metadata.gz: d5ec2d542ec51558264bfd069546b59969ff401fc1c49c0b332ea547ce7504e477d8dd01ae50f16a7b322d1e80b3d5e584d540259c398090b5aba10af240cd33
7
+ data.tar.gz: 93ed922f0db520239e8d27bf422ebf9badaad94cd014f7af431e6009d5d1ba4b9ffb96cfca565e7e7ff1ed2d4912a2f7189d03c9ec4f4a8f1dfe2650a4cc7b1b
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ require:
3
3
  - rubocop-rspec
4
4
  - rubocop-rails
5
5
  - rubocop-rake
6
+ - rubocop-capybara
6
7
 
7
8
  AllCops:
8
9
  NewCops: enable
@@ -86,6 +87,7 @@ RSpec/ContextWording:
86
87
  Metrics/ModuleLength:
87
88
  Exclude:
88
89
  - 'spec/ccs/frontend_helpers/**/*'
90
+ - 'spec/ccs/components/**/*'
89
91
 
90
92
  RSpec/MultipleMemoizedHelpers:
91
93
  Enabled: false
@@ -113,7 +115,8 @@ RSpec/NestedGroups:
113
115
 
114
116
  RSpec/ExampleLength:
115
117
  Exclude:
116
- - 'spec/ccs/frontend_helpers/**/*'
118
+ - 'spec/ccs/frontend_helpers/**/*'
119
+ - 'spec/ccs/components/**/*'
117
120
 
118
121
  Rails/DynamicFindBy:
119
122
  Whitelist:
@@ -125,3 +128,4 @@ RSpec/MultipleExpectations:
125
128
  RSpec/FilePath:
126
129
  CustomTransform:
127
130
  GovUKFrontend: govuk_frontend
131
+ GovUK: govuk
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.7
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.1.0.rc.1] - 2023-02-22
1
+ ## [0.1.0.rc.3] - 2023-04-05
2
2
 
3
3
  Initial release of CCS Frontend Helpers.
4
4
  This release contains view helpers that are used to create GOV.UK and CCS components.
@@ -19,7 +19,9 @@ The following GOV.UK helpers have been added:
19
19
  - Fieldset
20
20
  - File upload
21
21
  - Footer
22
+ - Form group
22
23
  - Header
24
+ - Hint
23
25
  - Inset text
24
26
  - Notification banner
25
27
  - Pagination
@@ -28,6 +30,7 @@ The following GOV.UK helpers have been added:
28
30
  - Radios
29
31
  - Select
30
32
  - Skip link
33
+ - Step by step navigation
31
34
  - Summary list
32
35
  - Table
33
36
  - Tabs
data/Gemfile.lock CHANGED
@@ -1,73 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.0.rc.1)
4
+ ccs-frontend_helpers (0.1.0.rc.3)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.0.4.2)
11
- actionpack (= 7.0.4.2)
12
- activesupport (= 7.0.4.2)
10
+ actioncable (7.0.4.3)
11
+ actionpack (= 7.0.4.3)
12
+ activesupport (= 7.0.4.3)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (7.0.4.2)
16
- actionpack (= 7.0.4.2)
17
- activejob (= 7.0.4.2)
18
- activerecord (= 7.0.4.2)
19
- activestorage (= 7.0.4.2)
20
- activesupport (= 7.0.4.2)
15
+ actionmailbox (7.0.4.3)
16
+ actionpack (= 7.0.4.3)
17
+ activejob (= 7.0.4.3)
18
+ activerecord (= 7.0.4.3)
19
+ activestorage (= 7.0.4.3)
20
+ activesupport (= 7.0.4.3)
21
21
  mail (>= 2.7.1)
22
22
  net-imap
23
23
  net-pop
24
24
  net-smtp
25
- actionmailer (7.0.4.2)
26
- actionpack (= 7.0.4.2)
27
- actionview (= 7.0.4.2)
28
- activejob (= 7.0.4.2)
29
- activesupport (= 7.0.4.2)
25
+ actionmailer (7.0.4.3)
26
+ actionpack (= 7.0.4.3)
27
+ actionview (= 7.0.4.3)
28
+ activejob (= 7.0.4.3)
29
+ activesupport (= 7.0.4.3)
30
30
  mail (~> 2.5, >= 2.5.4)
31
31
  net-imap
32
32
  net-pop
33
33
  net-smtp
34
34
  rails-dom-testing (~> 2.0)
35
- actionpack (7.0.4.2)
36
- actionview (= 7.0.4.2)
37
- activesupport (= 7.0.4.2)
35
+ actionpack (7.0.4.3)
36
+ actionview (= 7.0.4.3)
37
+ activesupport (= 7.0.4.3)
38
38
  rack (~> 2.0, >= 2.2.0)
39
39
  rack-test (>= 0.6.3)
40
40
  rails-dom-testing (~> 2.0)
41
41
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
- actiontext (7.0.4.2)
43
- actionpack (= 7.0.4.2)
44
- activerecord (= 7.0.4.2)
45
- activestorage (= 7.0.4.2)
46
- activesupport (= 7.0.4.2)
42
+ actiontext (7.0.4.3)
43
+ actionpack (= 7.0.4.3)
44
+ activerecord (= 7.0.4.3)
45
+ activestorage (= 7.0.4.3)
46
+ activesupport (= 7.0.4.3)
47
47
  globalid (>= 0.6.0)
48
48
  nokogiri (>= 1.8.5)
49
- actionview (7.0.4.2)
50
- activesupport (= 7.0.4.2)
49
+ actionview (7.0.4.3)
50
+ activesupport (= 7.0.4.3)
51
51
  builder (~> 3.1)
52
52
  erubi (~> 1.4)
53
53
  rails-dom-testing (~> 2.0)
54
54
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
- activejob (7.0.4.2)
56
- activesupport (= 7.0.4.2)
55
+ activejob (7.0.4.3)
56
+ activesupport (= 7.0.4.3)
57
57
  globalid (>= 0.3.6)
58
- activemodel (7.0.4.2)
59
- activesupport (= 7.0.4.2)
60
- activerecord (7.0.4.2)
61
- activemodel (= 7.0.4.2)
62
- activesupport (= 7.0.4.2)
63
- activestorage (7.0.4.2)
64
- actionpack (= 7.0.4.2)
65
- activejob (= 7.0.4.2)
66
- activerecord (= 7.0.4.2)
67
- activesupport (= 7.0.4.2)
58
+ activemodel (7.0.4.3)
59
+ activesupport (= 7.0.4.3)
60
+ activerecord (7.0.4.3)
61
+ activemodel (= 7.0.4.3)
62
+ activesupport (= 7.0.4.3)
63
+ activestorage (7.0.4.3)
64
+ actionpack (= 7.0.4.3)
65
+ activejob (= 7.0.4.3)
66
+ activerecord (= 7.0.4.3)
67
+ activesupport (= 7.0.4.3)
68
68
  marcel (~> 1.0)
69
69
  mini_mime (>= 1.1.0)
70
- activesupport (7.0.4.2)
70
+ activesupport (7.0.4.3)
71
71
  concurrent-ruby (~> 1.0, >= 1.0.2)
72
72
  i18n (>= 1.6, < 2)
73
73
  minitest (>= 5.1)
@@ -85,7 +85,7 @@ GEM
85
85
  rack-test (>= 0.6.3)
86
86
  regexp_parser (>= 1.5, < 3.0)
87
87
  xpath (~> 3.2)
88
- concurrent-ruby (1.2.0)
88
+ concurrent-ruby (1.2.2)
89
89
  crass (1.0.6)
90
90
  date (3.3.3)
91
91
  diff-lcs (1.5.0)
@@ -108,7 +108,7 @@ GEM
108
108
  matrix (0.4.2)
109
109
  method_source (1.0.0)
110
110
  mini_mime (1.1.2)
111
- minitest (5.17.0)
111
+ minitest (5.18.0)
112
112
  net-imap (0.3.4)
113
113
  date
114
114
  net-protocol
@@ -119,40 +119,40 @@ GEM
119
119
  net-smtp (0.3.3)
120
120
  net-protocol
121
121
  nio4r (2.5.8)
122
- nokogiri (1.14.1-x86_64-darwin)
122
+ nokogiri (1.14.2-x86_64-darwin)
123
123
  racc (~> 1.4)
124
- nokogiri (1.14.1-x86_64-linux)
124
+ nokogiri (1.14.2-x86_64-linux)
125
125
  racc (~> 1.4)
126
126
  parallel (1.22.1)
127
- parser (3.2.1.0)
127
+ parser (3.2.1.1)
128
128
  ast (~> 2.4.1)
129
129
  public_suffix (5.0.1)
130
130
  racc (1.6.2)
131
- rack (2.2.6.2)
132
- rack-test (2.0.2)
131
+ rack (2.2.6.4)
132
+ rack-test (2.1.0)
133
133
  rack (>= 1.3)
134
- rails (7.0.4.2)
135
- actioncable (= 7.0.4.2)
136
- actionmailbox (= 7.0.4.2)
137
- actionmailer (= 7.0.4.2)
138
- actionpack (= 7.0.4.2)
139
- actiontext (= 7.0.4.2)
140
- actionview (= 7.0.4.2)
141
- activejob (= 7.0.4.2)
142
- activemodel (= 7.0.4.2)
143
- activerecord (= 7.0.4.2)
144
- activestorage (= 7.0.4.2)
145
- activesupport (= 7.0.4.2)
134
+ rails (7.0.4.3)
135
+ actioncable (= 7.0.4.3)
136
+ actionmailbox (= 7.0.4.3)
137
+ actionmailer (= 7.0.4.3)
138
+ actionpack (= 7.0.4.3)
139
+ actiontext (= 7.0.4.3)
140
+ actionview (= 7.0.4.3)
141
+ activejob (= 7.0.4.3)
142
+ activemodel (= 7.0.4.3)
143
+ activerecord (= 7.0.4.3)
144
+ activestorage (= 7.0.4.3)
145
+ activesupport (= 7.0.4.3)
146
146
  bundler (>= 1.15.0)
147
- railties (= 7.0.4.2)
147
+ railties (= 7.0.4.3)
148
148
  rails-dom-testing (2.0.3)
149
149
  activesupport (>= 4.2.0)
150
150
  nokogiri (>= 1.6)
151
151
  rails-html-sanitizer (1.5.0)
152
152
  loofah (~> 2.19, >= 2.19.1)
153
- railties (7.0.4.2)
154
- actionpack (= 7.0.4.2)
155
- activesupport (= 7.0.4.2)
153
+ railties (7.0.4.3)
154
+ actionpack (= 7.0.4.3)
155
+ activesupport (= 7.0.4.3)
156
156
  method_source
157
157
  rake (>= 12.2)
158
158
  thor (~> 1.0)
@@ -174,30 +174,30 @@ GEM
174
174
  diff-lcs (>= 1.2.0, < 2.0)
175
175
  rspec-support (~> 3.12.0)
176
176
  rspec-support (3.12.0)
177
- rubocop (1.45.1)
177
+ rubocop (1.48.1)
178
178
  json (~> 2.3)
179
179
  parallel (~> 1.10)
180
180
  parser (>= 3.2.0.0)
181
181
  rainbow (>= 2.2.2, < 4.0)
182
182
  regexp_parser (>= 1.8, < 3.0)
183
183
  rexml (>= 3.2.5, < 4.0)
184
- rubocop-ast (>= 1.24.1, < 2.0)
184
+ rubocop-ast (>= 1.26.0, < 2.0)
185
185
  ruby-progressbar (~> 1.7)
186
186
  unicode-display_width (>= 2.4.0, < 3.0)
187
- rubocop-ast (1.26.0)
187
+ rubocop-ast (1.27.0)
188
188
  parser (>= 3.2.1.0)
189
- rubocop-capybara (2.17.0)
189
+ rubocop-capybara (2.17.1)
190
190
  rubocop (~> 1.41)
191
- rubocop-rails (2.17.4)
191
+ rubocop-rails (2.18.0)
192
192
  activesupport (>= 4.2.0)
193
193
  rack (>= 1.1)
194
194
  rubocop (>= 1.33.0, < 2.0)
195
195
  rubocop-rake (0.6.0)
196
196
  rubocop (~> 1.0)
197
- rubocop-rspec (2.18.1)
197
+ rubocop-rspec (2.19.0)
198
198
  rubocop (~> 1.33)
199
199
  rubocop-capybara (~> 2.17)
200
- ruby-progressbar (1.11.0)
200
+ ruby-progressbar (1.13.0)
201
201
  simplecov (0.22.0)
202
202
  docile (~> 1.1)
203
203
  simplecov-html (~> 0.11)
@@ -205,7 +205,7 @@ GEM
205
205
  simplecov-html (0.12.3)
206
206
  simplecov_json_formatter (0.1.4)
207
207
  thor (1.2.1)
208
- timeout (0.3.1)
208
+ timeout (0.3.2)
209
209
  tzinfo (2.0.6)
210
210
  concurrent-ruby (~> 1.0)
211
211
  unicode-display_width (2.4.2)
@@ -217,7 +217,7 @@ GEM
217
217
  nokogiri (~> 1.8)
218
218
  yard (0.9.28)
219
219
  webrick (~> 1.7.0)
220
- zeitwerk (2.6.6)
220
+ zeitwerk (2.6.7)
221
221
 
222
222
  PLATFORMS
223
223
  x86_64-darwin-19
@@ -238,4 +238,4 @@ DEPENDENCIES
238
238
  yard (~> 0.9)
239
239
 
240
240
  BUNDLED WITH
241
- 2.3.12
241
+ 2.3.24
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CCS
4
+ # Components for the GOV.UK Frontend and CCS Frontend using an Object Oriented pattern
5
+ # These are then used in the {CCS::FrontendHelpers FrontendHelpers}
6
+ # to create view helpers that can be used in a Ruby on Rails project
7
+
8
+ module Components
9
+ # Component base class that all components will inherit from.
10
+ #
11
+ # It's main purpose is to handle the initialisation of the options
12
+ # which is very similar between components
13
+ #
14
+ # @!attribute [r] options
15
+ # @return [Hash] Options for the component which defaults to +{ attributes: {} }+
16
+ # where +attributes+ are HTML attributes
17
+ # @!attribute [r] context
18
+ # @return [ActionView::Base] View context where the components are being rendered
19
+
20
+ class Base
21
+ private
22
+
23
+ attr_accessor :options, :context
24
+
25
+ public
26
+
27
+ delegate :button_tag, :concat, :label_tag, :link_to, :tag, to: :context
28
+
29
+ # @param context [ActionView::Base] the view context where the components are being rendered
30
+ # @param options [Hash] options for the component
31
+
32
+ def initialize(context:, **options)
33
+ options[:attributes] ||= {}
34
+ options[:attributes][:class] = "#{default_attributes[:class]} #{options[:classes]}".strip if default_attributes[:class] || options[:classes]
35
+ (options[:attributes][:data] ||= {})[:module] = default_attributes[:data][:module] if default_attributes.dig(:data, :module)
36
+
37
+ @context = context
38
+ @options = options
39
+ end
40
+
41
+ # The default attributes for the component
42
+
43
+ DEFAULT_ATTRIBUTES = {}.freeze
44
+
45
+ private
46
+
47
+ # The default attributes for the component
48
+ #
49
+ # @return [Hash]
50
+
51
+ def default_attributes
52
+ self.class::DEFAULT_ATTRIBUTES
53
+ end
54
+
55
+ # Sanitizes string used as HTML tag id
56
+ #
57
+ # @return [String]
58
+
59
+ def sanitize_to_id(...)
60
+ @context.send(:sanitize_to_id, ...)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,57 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module CCS
6
+ class DashboardSection < Base
7
+ # = CCS Dashboard Section Panel
8
+ #
9
+ # The individual panel within a dashboard section
10
+ #
11
+ # @!attribute [r] title
12
+ # @return [String] Text for the panel title
13
+ # @!attribute [r] href
14
+ # @return [String] The href for the panel
15
+ # @!attribute [r] description
16
+ # @return [String] Description text for the panel
17
+
18
+ class Panel < Base
19
+ private
20
+
21
+ attr_reader :title, :href, :description
22
+
23
+ public
24
+
25
+ # @param title [String] the text for the panel title
26
+ # @param href [String] the href for the panel
27
+ # @param description [String] the description text for the panel
28
+ # @param options [Hash] options that will be used in customising the HTML
29
+ #
30
+ # @option options [String] :width (default: 'one-third') the width of the panel
31
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
32
+
33
+ def initialize(title:, href:, description:, **options)
34
+ super(**options)
35
+
36
+ @options[:attributes][:class] = "ccs-dashboard-section__panel govuk-grid-column-#{@options[:width] || 'one-third'}"
37
+
38
+ @title = title
39
+ @href = href
40
+ @description = description
41
+ end
42
+
43
+ # Generates the HTML for the CCS Dashboard Section Panel
44
+ #
45
+ # @return [ActiveSupport::SafeBuffer]
46
+
47
+ def render
48
+ tag.div(**options[:attributes]) do
49
+ concat(link_to(title, href, class: 'ccs-dashboard-section__panel-title'))
50
+ concat(tag.p(description, class: 'ccs-dashboard-section__panel-description'))
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,73 @@
1
+ require_relative '../base'
2
+ require_relative 'dashboard_section/panel'
3
+
4
+ module CCS
5
+ module Components
6
+ module CCS
7
+ # = CCS Dashboard Section
8
+ #
9
+ # This is used for generating the dashboard section component
10
+ #
11
+ # @!attribute [r] dashboard_section_panels
12
+ # @return [Array<Link>] An array of the initialised dashboard section panels
13
+ # @!attribute [r] title_text
14
+ # @return [String] Text for the title of a dashboard section
15
+
16
+ class DashboardSection < Base
17
+ private
18
+
19
+ attr_reader :dashboard_section_panels, :title_text
20
+
21
+ public
22
+
23
+ # @param dashboard_section_panels [Array<Hash>] An array of options for the dashboard section panels,
24
+ # See {Components::CCS::DashboardSection::Panel#initialize Panel#initialize} for details of the items in the array.
25
+ # @param title_text [String] text for the title of a dashboard section
26
+ # @param options [Hash] options that will be used in customising the HTML
27
+ #
28
+ # @option options [String] :classes additional CSS classes for the dashboard section HTML
29
+ # @option options [String] :width (default: 'full') the width of the dashboard section
30
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
+
32
+ def initialize(dashboard_section_panels:, title_text: nil, **options)
33
+ super(**options)
34
+
35
+ @options[:width] ||= 'full'
36
+
37
+ @dashboard_section_panels = dashboard_section_panels.map { |dashboard_section_panel| Panel.new(context: @context, **dashboard_section_panel) }
38
+ @title_text = title_text
39
+ end
40
+
41
+ # rubocop:disable Metrics/AbcSize
42
+
43
+ # Generates the HTML for the CCS dashboard section component
44
+ #
45
+ # @return [ActiveSupport::SafeBuffer]
46
+
47
+ def render
48
+ tag.div(**options[:attributes]) do
49
+ tag.div(class: 'govuk-grid-row') do
50
+ tag.div(class: "govuk-grid-column-#{options[:width]}") do
51
+ if title_text
52
+ concat(tag.h2(title_text, class: 'ccs-dashboard-section__heading govuk-heading-m'))
53
+ concat(tag.hr(class: 'ccs-dashboard-section__heading-section-break govuk-section-break govuk-section-break--visible'))
54
+ end
55
+ concat(tag.div(class: 'ccs-dashboard-section__container') do
56
+ tag.div(class: 'govuk-grid-row') do
57
+ dashboard_section_panels.each { |dashboard_section_panel| concat(dashboard_section_panel.render) }
58
+ end
59
+ end)
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ # rubocop:enable Metrics/AbcSize
66
+
67
+ # The default attributes for the dashboard section
68
+
69
+ DEFAULT_ATTRIBUTES = { class: 'ccs-dashboard-section' }.freeze
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,55 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS
4
+ module Components
5
+ module CCS
6
+ class Footer < Base
7
+ # = CCS Footer link
8
+ #
9
+ # The individual footer footer link item
10
+ #
11
+ # @!attribute [r] text
12
+ # @return [String] Text for the footer link
13
+ # @!attribute [r] href
14
+ # @return [String] The href for the footer link
15
+ # @!attribute [r] li_class
16
+ # @return [String] The class for the li elements
17
+
18
+ class Link < Base
19
+ private
20
+
21
+ attr_reader :text, :href, :li_class
22
+
23
+ public
24
+
25
+ # @param text [String] the text for the footer link
26
+ # @param href [String] the href for the footer link
27
+ # @param li_class [String] class for the li elements
28
+ # @param options [Hash] options that will be used in customising the HTML
29
+ #
30
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
+
32
+ def initialize(text:, href:, li_class:, **options)
33
+ super(**options)
34
+
35
+ @text = text
36
+ @href = href
37
+ @li_class = li_class
38
+ end
39
+
40
+ # Generates the HTML for the CCS Footer link
41
+ #
42
+ # @return [ActiveSupport::SafeBuffer]
43
+
44
+ def render
45
+ tag.li(class: li_class) do
46
+ options[:attributes][:class] = 'ccs-footer__link'
47
+
48
+ link_to(text, href, **options[:attributes])
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,59 @@
1
+ require_relative 'link'
2
+
3
+ module CCS
4
+ module Components
5
+ module CCS
6
+ class Footer < Base
7
+ # = CCS Footer Meta
8
+ #
9
+ # The footer meta section
10
+ #
11
+ # @!attribute [r] meta_links
12
+ # @return [Array<Link>] An array of the initialised meta links
13
+ # @!attribute [r] visually_hidden_title
14
+ # @return [String] Title for the meta section
15
+ # @!attribute [r] text
16
+ # @return [String] Text to add to the meta section of the footer
17
+
18
+ class Meta
19
+ include ActionView::Context
20
+ include ActionView::Helpers
21
+
22
+ private
23
+
24
+ attr_reader :meta_links, :visually_hidden_title, :text
25
+
26
+ public
27
+
28
+ # @param items [Array<Hash>] an array of links for the meta section.
29
+ # See {Components::CCS::Footer::Link#initialize Link#initialize} for details of the items in the array.
30
+ # @param visually_hidden_title [String] ('Support links') title for the meta section
31
+ # @param text [String] text to add to the meta section of the footer
32
+ # @param context [ActionView::Base] the view context
33
+
34
+ def initialize(context:, items: nil, visually_hidden_title: nil, text: nil)
35
+ @meta_links = items&.map { |meta_link| Link.new(li_class: 'ccs-footer__inline-list-item', context: context, **meta_link) }
36
+ @visually_hidden_title = visually_hidden_title || 'Support links'
37
+ @text = text
38
+ end
39
+
40
+ # Generates the HTML for the CCS Footer Meta sections
41
+ #
42
+ # @return [ActiveSupport::SafeBuffer]
43
+
44
+ def render
45
+ capture do
46
+ concat(tag.h2(visually_hidden_title, class: 'govuk-visually-hidden'))
47
+ if meta_links
48
+ concat(tag.ul(class: 'ccs-footer__inline-list') do
49
+ meta_links.each { |meta_link| concat(meta_link.render) }
50
+ end)
51
+ end
52
+ concat(tag.div(text, class: 'ccs-footer__meta-custom')) if text
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end