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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) 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 +55 -0
  8. data/lib/ccs/components/ccs/dashboard_section.rb +71 -0
  9. data/lib/ccs/components/ccs/footer/link.rb +53 -0
  10. data/lib/ccs/components/ccs/footer/meta.rb +58 -0
  11. data/lib/ccs/components/ccs/footer/navigation.rb +59 -0
  12. data/lib/ccs/components/ccs/footer.rb +93 -0
  13. data/lib/ccs/components/ccs/header/link.rb +58 -0
  14. data/lib/ccs/components/ccs/header/navigation.rb +97 -0
  15. data/lib/ccs/components/ccs/header/service_authentication.rb +52 -0
  16. data/lib/ccs/components/ccs/header.rb +108 -0
  17. data/lib/ccs/components/ccs/logo.rb +45 -0
  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 +60 -0
  21. data/lib/ccs/components/govuk/accordion.rb +56 -0
  22. data/lib/ccs/components/govuk/back_link.rb +49 -0
  23. data/lib/ccs/components/govuk/breadcrumbs/link.rb +55 -0
  24. data/lib/ccs/components/govuk/breadcrumbs.rb +53 -0
  25. data/lib/ccs/components/govuk/button.rb +105 -0
  26. data/lib/ccs/components/govuk/cookie_banner/action.rb +58 -0
  27. data/lib/ccs/components/govuk/cookie_banner/message.rb +78 -0
  28. data/lib/ccs/components/govuk/cookie_banner.rb +53 -0
  29. data/lib/ccs/components/govuk/details.rb +51 -0
  30. data/lib/ccs/components/govuk/error_message.rb +58 -0
  31. data/lib/ccs/components/govuk/error_summary/item.rb +52 -0
  32. data/lib/ccs/components/govuk/error_summary.rb +68 -0
  33. data/lib/ccs/components/govuk/field/input/character_count.rb +127 -0
  34. data/lib/ccs/components/govuk/field/input/file_upload.rb +42 -0
  35. data/lib/ccs/components/govuk/field/input/select.rb +80 -0
  36. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +53 -0
  37. data/lib/ccs/components/govuk/field/input/text_input.rb +95 -0
  38. data/lib/ccs/components/govuk/field/input/textarea.rb +57 -0
  39. data/lib/ccs/components/govuk/field/input.rb +60 -0
  40. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +67 -0
  41. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +63 -0
  42. data/lib/ccs/components/govuk/field/inputs/date_input.rb +87 -0
  43. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +45 -0
  44. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +41 -0
  45. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +48 -0
  46. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +48 -0
  47. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +42 -0
  48. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +41 -0
  49. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +48 -0
  50. data/lib/ccs/components/govuk/field/inputs/item.rb +109 -0
  51. data/lib/ccs/components/govuk/field/inputs/radios.rb +67 -0
  52. data/lib/ccs/components/govuk/field/inputs.rb +55 -0
  53. data/lib/ccs/components/govuk/field.rb +106 -0
  54. data/lib/ccs/components/govuk/fieldset/legend.rb +63 -0
  55. data/lib/ccs/components/govuk/fieldset.rb +52 -0
  56. data/lib/ccs/components/govuk/footer/link.rb +53 -0
  57. data/lib/ccs/components/govuk/footer/meta.rb +58 -0
  58. data/lib/ccs/components/govuk/footer/navigation.rb +59 -0
  59. data/lib/ccs/components/govuk/footer.rb +129 -0
  60. data/lib/ccs/components/govuk/form_group.rb +58 -0
  61. data/lib/ccs/components/govuk/header/link.rb +54 -0
  62. data/lib/ccs/components/govuk/header/navigation.rb +70 -0
  63. data/lib/ccs/components/govuk/header.rb +105 -0
  64. data/lib/ccs/components/govuk/hint.rb +47 -0
  65. data/lib/ccs/components/govuk/inset_text.rb +50 -0
  66. data/lib/ccs/components/govuk/label.rb +83 -0
  67. data/lib/ccs/components/govuk/notification_banner.rb +105 -0
  68. data/lib/ccs/components/govuk/pagination/increment/next.rb +42 -0
  69. data/lib/ccs/components/govuk/pagination/increment/previous.rb +41 -0
  70. data/lib/ccs/components/govuk/pagination/increment.rb +96 -0
  71. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +26 -0
  72. data/lib/ccs/components/govuk/pagination/item/form.rb +47 -0
  73. data/lib/ccs/components/govuk/pagination/item/tag.rb +45 -0
  74. data/lib/ccs/components/govuk/pagination/item.rb +62 -0
  75. data/lib/ccs/components/govuk/pagination.rb +94 -0
  76. data/lib/ccs/components/govuk/panel.rb +60 -0
  77. data/lib/ccs/components/govuk/phase_banner.rb +67 -0
  78. data/lib/ccs/components/govuk/skip_link.rb +49 -0
  79. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +51 -0
  80. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +48 -0
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +43 -0
  82. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +61 -0
  83. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +67 -0
  84. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +54 -0
  85. data/lib/ccs/components/govuk/step_by_step_navigation.rb +57 -0
  86. data/lib/ccs/components/govuk/summary_list/action/link.rb +57 -0
  87. data/lib/ccs/components/govuk/summary_list/card/actions.rb +57 -0
  88. data/lib/ccs/components/govuk/summary_list/card/title.rb +49 -0
  89. data/lib/ccs/components/govuk/summary_list/card.rb +61 -0
  90. data/lib/ccs/components/govuk/summary_list/row/actions.rb +57 -0
  91. data/lib/ccs/components/govuk/summary_list/row/key.rb +45 -0
  92. data/lib/ccs/components/govuk/summary_list/row/value.rb +45 -0
  93. data/lib/ccs/components/govuk/summary_list/row.rb +63 -0
  94. data/lib/ccs/components/govuk/summary_list.rb +72 -0
  95. data/lib/ccs/components/govuk/table/body/data_cell.rb +51 -0
  96. data/lib/ccs/components/govuk/table/body/head_cell.rb +50 -0
  97. data/lib/ccs/components/govuk/table/header/head_cell.rb +52 -0
  98. data/lib/ccs/components/govuk/table.rb +109 -0
  99. data/lib/ccs/components/govuk/tabs/panel.rb +56 -0
  100. data/lib/ccs/components/govuk/tabs/tab.rb +54 -0
  101. data/lib/ccs/components/govuk/tabs.rb +64 -0
  102. data/lib/ccs/components/govuk/tag.rb +49 -0
  103. data/lib/ccs/components/govuk/warning_text.rb +59 -0
  104. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +25 -0
  105. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +16 -131
  106. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +16 -195
  107. data/lib/ccs/frontend_helpers/ccs_frontend.rb +2 -4
  108. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +16 -105
  109. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +16 -29
  110. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +16 -66
  111. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +16 -117
  112. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +26 -0
  113. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +26 -0
  114. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +16 -126
  115. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +26 -0
  116. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +18 -36
  117. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +31 -54
  118. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +32 -86
  119. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +18 -61
  120. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +26 -0
  121. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +16 -173
  122. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +26 -39
  123. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +16 -151
  124. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +17 -28
  125. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +26 -0
  126. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +18 -34
  127. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +17 -82
  128. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +18 -126
  129. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +16 -326
  130. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +18 -41
  131. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +18 -39
  132. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +26 -0
  133. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +26 -0
  134. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +16 -30
  135. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +23 -204
  136. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +16 -216
  137. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +16 -114
  138. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +16 -85
  139. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +16 -32
  140. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +26 -0
  141. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +18 -43
  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/ccs_frontend/logo.rb +0 -49
  147. data/lib/ccs/frontend_helpers/govuk_frontend/field/character_count.rb +0 -165
  148. data/lib/ccs/frontend_helpers/govuk_frontend/field/checkboxes.rb +0 -200
  149. data/lib/ccs/frontend_helpers/govuk_frontend/field/date_input.rb +0 -153
  150. data/lib/ccs/frontend_helpers/govuk_frontend/field/file_upload.rb +0 -83
  151. data/lib/ccs/frontend_helpers/govuk_frontend/field/input.rb +0 -153
  152. data/lib/ccs/frontend_helpers/govuk_frontend/field/radios.rb +0 -201
  153. data/lib/ccs/frontend_helpers/govuk_frontend/field/select.rb +0 -124
  154. data/lib/ccs/frontend_helpers/govuk_frontend/field/textarea.rb +0 -106
  155. data/lib/ccs/frontend_helpers/govuk_frontend/field.rb +0 -213
  156. 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: b8953dff436dfc45a5f342ee8914f5e784ab794670e6bf3ddb8490b5a4405044
4
+ data.tar.gz: 95a5eb7c860225423cab0f0a7876357195e078e8b4a101efdf9540a7fec8d96a
5
5
  SHA512:
6
- metadata.gz: 7a3f14a98c028b451ba6d39962923eac034b9a0619adb3722d40f7f3230dd860f5ca8bffc4eb1f94292b1c6d87772df96c272a946e0c00d78fdc681f16cb3cc4
7
- data.tar.gz: 89519f4a8a15e9a2d4517a03562e2c001635f5b79fbb1020474393f45b32f7b8f0cf22d3c1541e711e945425542416791cb4cc6c9e4608faf336e14af668277a
6
+ metadata.gz: c18444fc0a1442a00be351944e9d23cd32800da85e73b2b57c6c150a3b75b87f01ae8c6e520092439f35ac45bccd63c1d390a1935b1d8d4e41427cff229161e1
7
+ data.tar.gz: e44027d75f86627f1360be7bc60e3e3c149de32a4847dbf8fc7c6f188a9951882e46347849f24f8cb28fc720f0de54a45e3e005fa36b7bc4877181f495bba54c
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] - 2023-02-22
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.2)
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,55 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS::Components
4
+ module CCS
5
+ class DashboardSection < Base
6
+ # = CCS Dashboard Section Panel
7
+ #
8
+ # The individual panel within a dashboard section
9
+ #
10
+ # @!attribute [r] title
11
+ # @return [String] Text for the panel title
12
+ # @!attribute [r] href
13
+ # @return [String] The href for the panel
14
+ # @!attribute [r] description
15
+ # @return [String] Description text for the panel
16
+
17
+ class Panel < Base
18
+ private
19
+
20
+ attr_reader :title, :href, :description
21
+
22
+ public
23
+
24
+ # @param title [String] the text for the panel title
25
+ # @param href [String] the href for the panel
26
+ # @param description [String] the description text for the panel
27
+ # @param options [Hash] options that will be used in customising the HTML
28
+ #
29
+ # @option options [String] :width (default: 'one-third') the width of the panel
30
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
31
+
32
+ def initialize(title:, href:, description:, **options)
33
+ super(**options)
34
+
35
+ @options[:attributes][:class] = "ccs-dashboard-section__panel govuk-grid-column-#{@options[:width] || 'one-third'}"
36
+
37
+ @title = title
38
+ @href = href
39
+ @description = description
40
+ end
41
+
42
+ # Generates the HTML for the CCS Dashboard Section Panel
43
+ #
44
+ # @return [ActiveSupport::SafeBuffer]
45
+
46
+ def render
47
+ tag.div(**options[:attributes]) do
48
+ concat(link_to(title, href, class: 'ccs-dashboard-section__panel-title'))
49
+ concat(tag.p(description, class: 'ccs-dashboard-section__panel-description'))
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,71 @@
1
+ require_relative '../base'
2
+ require_relative 'dashboard_section/panel'
3
+
4
+ module CCS::Components
5
+ module CCS
6
+ # = CCS Dashboard Section
7
+ #
8
+ # This is used for generating the dashboard section component
9
+ #
10
+ # @!attribute [r] dashboard_section_panels
11
+ # @return [Array<Link>] An array of the initialised dashboard section panels
12
+ # @!attribute [r] title_text
13
+ # @return [String] Text for the title of a dashboard section
14
+
15
+ class DashboardSection < Base
16
+ private
17
+
18
+ attr_reader :dashboard_section_panels, :title_text
19
+
20
+ public
21
+
22
+ # @param dashboard_section_panels [Array<Hash>] An array of options for the dashboard section panels,
23
+ # See {Components::CCS::DashboardSection::Panel#initialize Panel#initialize} for details of the items in the array.
24
+ # @param title_text [String] text for the title of a dashboard section
25
+ # @param options [Hash] options that will be used in customising the HTML
26
+ #
27
+ # @option options [String] :classes additional CSS classes for the dashboard section HTML
28
+ # @option options [String] :width (default: 'full') the width of the dashboard section
29
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
30
+
31
+ def initialize(dashboard_section_panels:, title_text: nil, **options)
32
+ super(**options)
33
+
34
+ @options[:width] ||= 'full'
35
+
36
+ @dashboard_section_panels = dashboard_section_panels.map { |dashboard_section_panel| Panel.new(context: @context, **dashboard_section_panel) }
37
+ @title_text = title_text
38
+ end
39
+
40
+ # rubocop:disable Metrics/AbcSize
41
+
42
+ # Generates the HTML for the CCS dashboard section component
43
+ #
44
+ # @return [ActiveSupport::SafeBuffer]
45
+
46
+ def render
47
+ tag.div(**options[:attributes]) do
48
+ tag.div(class: 'govuk-grid-row') do
49
+ tag.div(class: "govuk-grid-column-#{options[:width]}") do
50
+ if title_text
51
+ concat(tag.h2(title_text, class: 'ccs-dashboard-section__heading govuk-heading-m'))
52
+ concat(tag.hr(class: 'ccs-dashboard-section__heading-section-break govuk-section-break govuk-section-break--visible'))
53
+ end
54
+ concat(tag.div(class: 'ccs-dashboard-section__container') do
55
+ tag.div(class: 'govuk-grid-row') do
56
+ dashboard_section_panels.each { |dashboard_section_panel| concat(dashboard_section_panel.render) }
57
+ end
58
+ end)
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+ # rubocop:enable Metrics/AbcSize
65
+
66
+ # The default attributes for the dashboard section
67
+
68
+ DEFAULT_ATTRIBUTES = { class: 'ccs-dashboard-section' }.freeze
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,53 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS::Components
4
+ module CCS
5
+ class Footer < Base
6
+ # = CCS Footer link
7
+ #
8
+ # The individual footer footer link item
9
+ #
10
+ # @!attribute [r] text
11
+ # @return [String] Text for the footer link
12
+ # @!attribute [r] href
13
+ # @return [String] The href for the footer link
14
+ # @!attribute [r] li_class
15
+ # @return [String] The class for the li elements
16
+
17
+ class Link < Base
18
+ private
19
+
20
+ attr_reader :text, :href, :li_class
21
+
22
+ public
23
+
24
+ # @param text [String] the text for the footer link
25
+ # @param href [String] the href for the footer link
26
+ # @param li_class [String] class for the li elements
27
+ # @param options [Hash] options that will be used in customising the HTML
28
+ #
29
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
30
+
31
+ def initialize(text:, href:, li_class:, **options)
32
+ super(**options)
33
+
34
+ @text = text
35
+ @href = href
36
+ @li_class = li_class
37
+ end
38
+
39
+ # Generates the HTML for the CCS Footer link
40
+ #
41
+ # @return [ActiveSupport::SafeBuffer]
42
+
43
+ def render
44
+ tag.li(class: li_class) do
45
+ options[:attributes][:class] = 'ccs-footer__link'
46
+
47
+ link_to(text, href, **options[:attributes])
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,58 @@
1
+ require_relative '../../base'
2
+ require_relative 'link'
3
+
4
+ module CCS::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
@@ -0,0 +1,59 @@
1
+ require_relative '../../base'
2
+ require_relative 'link'
3
+
4
+ module CCS::Components
5
+ module CCS
6
+ class Footer < Base
7
+ # = CCS Footer Navigation
8
+ #
9
+ # The individual footer navigation item
10
+ #
11
+ # @!attribute [r] title
12
+ # @return [String] Title for the navigation section
13
+ # @!attribute [r] navigation_links
14
+ # @return [Array<Link>] An array of the initialised navigation links
15
+ # @!attribute [r] width
16
+ # @return [String] Width of the navigation section
17
+ # @!attribute [r] columns
18
+ # @return [Integer] Number of columns to display the links in
19
+
20
+ class Navigation
21
+ include ActionView::Context
22
+ include ActionView::Helpers
23
+
24
+ private
25
+
26
+ attr_reader :title, :navigation_links, :width, :columns
27
+
28
+ public
29
+
30
+ # @param title [String] the title for the navigation section
31
+ # @param items [Array<Hash>] an array of links for the navigation section.
32
+ # See {Components::CCS::Footer::Link#initialize Link#initialize} for details of the items in the array.
33
+ # @param width [String] ('full') width of each navigation section in the footer
34
+ # @param columns [Integer] (nil) number of columns to display the links
35
+ # @param context [ActionView::Base] the view context
36
+
37
+ def initialize(title:, items:, context:, width: nil, columns: nil)
38
+ @title = title
39
+ @navigation_links = items.map { |navigation_link| Link.new(li_class: 'ccs-footer__list-item', context: context, **navigation_link) }
40
+ @width = width || 'full'
41
+ @columns = columns
42
+ end
43
+
44
+ # Generates the HTML for the CCS Footer Navigation sections
45
+ #
46
+ # @return [ActiveSupport::SafeBuffer]
47
+
48
+ def render
49
+ tag.div(class: "ccs-footer__section govuk-grid-column-#{width}") do
50
+ concat(tag.h2(title, class: 'ccs-footer__heading govuk-heading-m'))
51
+ concat(tag.ul(class: "ccs-footer__list #{"ccs-footer__list--columns-#{columns}" if columns}".rstrip) do
52
+ navigation_links.each { |navigation_link| concat(navigation_link.render) }
53
+ end)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end