ccs-frontend_helpers 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +90 -85
- data/README.md +2 -0
- data/lib/ccs/components/ccs/footer.rb +0 -1
- data/lib/ccs/components/ccs/header.rb +0 -1
- data/lib/ccs/components/govuk/error_summary.rb +6 -4
- data/lib/ccs/components/govuk/field/input/character_count/count_message.rb +62 -0
- data/lib/ccs/components/govuk/field/input/character_count.rb +30 -60
- data/lib/ccs/components/govuk/field/input/password_input/show_hide_button.rb +72 -0
- data/lib/ccs/components/govuk/field/input/password_input.rb +101 -0
- data/lib/ccs/components/govuk/field/input/text_input.rb +23 -7
- data/lib/ccs/components/govuk/field/input.rb +4 -0
- data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +1 -22
- data/lib/ccs/components/govuk/field/inputs/date_input.rb +1 -22
- data/lib/ccs/components/govuk/field/inputs/radios.rb +2 -17
- data/lib/ccs/components/govuk/field/inputs.rb +8 -2
- data/lib/ccs/components/govuk/field.rb +12 -2
- data/lib/ccs/components/govuk/footer.rb +0 -1
- data/lib/ccs/components/govuk/header.rb +0 -1
- data/lib/ccs/components/govuk/pagination.rb +0 -1
- data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +1 -1
- data/lib/ccs/frontend_helpers/govuk_frontend/password_input.rb +28 -0
- data/lib/ccs/frontend_helpers/govuk_frontend.rb +2 -0
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- data/package.json +1 -1
- data/yarn.lock +4 -4
- metadata +6 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fca2cbae35b1e0e0845af49145d1c9141bdcf235dea294ab305acbbeb301f781
         | 
| 4 | 
            +
              data.tar.gz: 3e874c9bc894b40c56efefd54397f134b697ad717ce5b4ab9a3247fe36160d67
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6109e7f5c6a7bb6d210c47b07ce9e88f83ccb81a6c76fba097bf9ce467423aca549230686f78ec6fcabfe8e48443f9cfe9c41f8cb947181631ce33895ee7ccf6
         | 
| 7 | 
            +
              data.tar.gz: c6cd26aedc098f409ecb4a625daef8236f3eabe9a071dfb611d6352f9c5e6595034de5b3a9d5b260c724cec5b1be41bd1e974153e43d6b1e9a8e6b47cfeae662
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,17 @@ | |
| 1 | 
            +
            ## [0.4.0] - 2024-05-20
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Update components to be compatible with GOV.UK Frontend v5.4
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## [0.3.0] - 2024-04-12
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Update components to be compatible with GOV.UK Frontend v5.3
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### 🆕 New features
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            The following GOV.UK helpers have been added:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            - Password input
         | 
| 14 | 
            +
             | 
| 1 15 | 
             
            ## [0.2.0] - 2024-03-13
         | 
| 2 16 |  | 
| 3 17 | 
             
            ### 💥 Breaking changes
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -7,7 +7,7 @@ gemspec | |
| 7 7 |  | 
| 8 8 | 
             
            # Gems for building the package
         | 
| 9 9 | 
             
            gem 'bundler', '~> 2.3'
         | 
| 10 | 
            -
            gem 'rake', '~> 13. | 
| 10 | 
            +
            gem 'rake', '~> 13.2'
         | 
| 11 11 |  | 
| 12 12 | 
             
            # Gems for testing the package
         | 
| 13 13 | 
             
            gem 'capybara', '~> 3.40.0'
         | 
| @@ -16,10 +16,10 @@ 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. | 
| 20 | 
            -
            gem 'rubocop-rails', '~> 2. | 
| 19 | 
            +
            gem 'rubocop', '~> 1.63'
         | 
| 20 | 
            +
            gem 'rubocop-rails', '~> 2.25'
         | 
| 21 21 | 
             
            gem 'rubocop-rake', '~> 0.6'
         | 
| 22 | 
            -
            gem 'rubocop-rspec', '~> 2. | 
| 22 | 
            +
            gem 'rubocop-rspec', '~> 2.29'
         | 
| 23 23 |  | 
| 24 24 | 
             
            # Gems for documenting the package
         | 
| 25 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. | 
| 4 | 
            +
                ccs-frontend_helpers (0.4.0)
         | 
| 5 5 | 
             
                  rails (>= 6.0)
         | 
| 6 6 |  | 
| 7 7 | 
             
            GEM
         | 
| 8 8 | 
             
              remote: https://rubygems.org/
         | 
| 9 9 | 
             
              specs:
         | 
| 10 | 
            -
                actioncable (7.1.3. | 
| 11 | 
            -
                  actionpack (= 7.1.3. | 
| 12 | 
            -
                  activesupport (= 7.1.3. | 
| 10 | 
            +
                actioncable (7.1.3.3)
         | 
| 11 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 12 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 13 13 | 
             
                  nio4r (~> 2.0)
         | 
| 14 14 | 
             
                  websocket-driver (>= 0.6.1)
         | 
| 15 15 | 
             
                  zeitwerk (~> 2.6)
         | 
| 16 | 
            -
                actionmailbox (7.1.3. | 
| 17 | 
            -
                  actionpack (= 7.1.3. | 
| 18 | 
            -
                  activejob (= 7.1.3. | 
| 19 | 
            -
                  activerecord (= 7.1.3. | 
| 20 | 
            -
                  activestorage (= 7.1.3. | 
| 21 | 
            -
                  activesupport (= 7.1.3. | 
| 16 | 
            +
                actionmailbox (7.1.3.3)
         | 
| 17 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 18 | 
            +
                  activejob (= 7.1.3.3)
         | 
| 19 | 
            +
                  activerecord (= 7.1.3.3)
         | 
| 20 | 
            +
                  activestorage (= 7.1.3.3)
         | 
| 21 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 22 22 | 
             
                  mail (>= 2.7.1)
         | 
| 23 23 | 
             
                  net-imap
         | 
| 24 24 | 
             
                  net-pop
         | 
| 25 25 | 
             
                  net-smtp
         | 
| 26 | 
            -
                actionmailer (7.1.3. | 
| 27 | 
            -
                  actionpack (= 7.1.3. | 
| 28 | 
            -
                  actionview (= 7.1.3. | 
| 29 | 
            -
                  activejob (= 7.1.3. | 
| 30 | 
            -
                  activesupport (= 7.1.3. | 
| 26 | 
            +
                actionmailer (7.1.3.3)
         | 
| 27 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 28 | 
            +
                  actionview (= 7.1.3.3)
         | 
| 29 | 
            +
                  activejob (= 7.1.3.3)
         | 
| 30 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 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.3. | 
| 37 | 
            -
                  actionview (= 7.1.3. | 
| 38 | 
            -
                  activesupport (= 7.1.3. | 
| 36 | 
            +
                actionpack (7.1.3.3)
         | 
| 37 | 
            +
                  actionview (= 7.1.3.3)
         | 
| 38 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 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.3. | 
| 47 | 
            -
                  actionpack (= 7.1.3. | 
| 48 | 
            -
                  activerecord (= 7.1.3. | 
| 49 | 
            -
                  activestorage (= 7.1.3. | 
| 50 | 
            -
                  activesupport (= 7.1.3. | 
| 46 | 
            +
                actiontext (7.1.3.3)
         | 
| 47 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 48 | 
            +
                  activerecord (= 7.1.3.3)
         | 
| 49 | 
            +
                  activestorage (= 7.1.3.3)
         | 
| 50 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 51 51 | 
             
                  globalid (>= 0.6.0)
         | 
| 52 52 | 
             
                  nokogiri (>= 1.8.5)
         | 
| 53 | 
            -
                actionview (7.1.3. | 
| 54 | 
            -
                  activesupport (= 7.1.3. | 
| 53 | 
            +
                actionview (7.1.3.3)
         | 
| 54 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 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.3. | 
| 60 | 
            -
                  activesupport (= 7.1.3. | 
| 59 | 
            +
                activejob (7.1.3.3)
         | 
| 60 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 61 61 | 
             
                  globalid (>= 0.3.6)
         | 
| 62 | 
            -
                activemodel (7.1.3. | 
| 63 | 
            -
                  activesupport (= 7.1.3. | 
| 64 | 
            -
                activerecord (7.1.3. | 
| 65 | 
            -
                  activemodel (= 7.1.3. | 
| 66 | 
            -
                  activesupport (= 7.1.3. | 
| 62 | 
            +
                activemodel (7.1.3.3)
         | 
| 63 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 64 | 
            +
                activerecord (7.1.3.3)
         | 
| 65 | 
            +
                  activemodel (= 7.1.3.3)
         | 
| 66 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 67 67 | 
             
                  timeout (>= 0.4.0)
         | 
| 68 | 
            -
                activestorage (7.1.3. | 
| 69 | 
            -
                  actionpack (= 7.1.3. | 
| 70 | 
            -
                  activejob (= 7.1.3. | 
| 71 | 
            -
                  activerecord (= 7.1.3. | 
| 72 | 
            -
                  activesupport (= 7.1.3. | 
| 68 | 
            +
                activestorage (7.1.3.3)
         | 
| 69 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 70 | 
            +
                  activejob (= 7.1.3.3)
         | 
| 71 | 
            +
                  activerecord (= 7.1.3.3)
         | 
| 72 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 73 73 | 
             
                  marcel (~> 1.0)
         | 
| 74 | 
            -
                activesupport (7.1.3. | 
| 74 | 
            +
                activesupport (7.1.3.3)
         | 
| 75 75 | 
             
                  base64
         | 
| 76 76 | 
             
                  bigdecimal
         | 
| 77 77 | 
             
                  concurrent-ruby (~> 1.0, >= 1.0.2)
         | 
| @@ -85,7 +85,7 @@ GEM | |
| 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. | 
| 88 | 
            +
                bigdecimal (3.1.8)
         | 
| 89 89 | 
             
                builder (3.2.4)
         | 
| 90 90 | 
             
                capybara (3.40.0)
         | 
| 91 91 | 
             
                  addressable
         | 
| @@ -106,13 +106,13 @@ GEM | |
| 106 106 | 
             
                erubi (1.12.0)
         | 
| 107 107 | 
             
                globalid (1.2.1)
         | 
| 108 108 | 
             
                  activesupport (>= 6.1)
         | 
| 109 | 
            -
                i18n (1.14. | 
| 109 | 
            +
                i18n (1.14.5)
         | 
| 110 110 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 111 111 | 
             
                io-console (0.7.2)
         | 
| 112 | 
            -
                irb (1. | 
| 113 | 
            -
                  rdoc
         | 
| 112 | 
            +
                irb (1.13.1)
         | 
| 113 | 
            +
                  rdoc (>= 4.0.0)
         | 
| 114 114 | 
             
                  reline (>= 0.4.2)
         | 
| 115 | 
            -
                json (2.7. | 
| 115 | 
            +
                json (2.7.2)
         | 
| 116 116 | 
             
                language_server-protocol (3.17.0.3)
         | 
| 117 117 | 
             
                loofah (2.22.0)
         | 
| 118 118 | 
             
                  crass (~> 1.0.2)
         | 
| @@ -122,37 +122,37 @@ GEM | |
| 122 122 | 
             
                  net-imap
         | 
| 123 123 | 
             
                  net-pop
         | 
| 124 124 | 
             
                  net-smtp
         | 
| 125 | 
            -
                marcel (1.0. | 
| 125 | 
            +
                marcel (1.0.4)
         | 
| 126 126 | 
             
                matrix (0.4.2)
         | 
| 127 127 | 
             
                mini_mime (1.1.5)
         | 
| 128 | 
            -
                minitest (5. | 
| 128 | 
            +
                minitest (5.23.0)
         | 
| 129 129 | 
             
                mutex_m (0.2.0)
         | 
| 130 | 
            -
                net-imap (0.4. | 
| 130 | 
            +
                net-imap (0.4.11)
         | 
| 131 131 | 
             
                  date
         | 
| 132 132 | 
             
                  net-protocol
         | 
| 133 133 | 
             
                net-pop (0.1.2)
         | 
| 134 134 | 
             
                  net-protocol
         | 
| 135 135 | 
             
                net-protocol (0.2.2)
         | 
| 136 136 | 
             
                  timeout
         | 
| 137 | 
            -
                net-smtp (0. | 
| 137 | 
            +
                net-smtp (0.5.0)
         | 
| 138 138 | 
             
                  net-protocol
         | 
| 139 | 
            -
                nio4r (2.7. | 
| 140 | 
            -
                nokogiri (1.16. | 
| 139 | 
            +
                nio4r (2.7.3)
         | 
| 140 | 
            +
                nokogiri (1.16.5-x86_64-darwin)
         | 
| 141 141 | 
             
                  racc (~> 1.4)
         | 
| 142 | 
            -
                nokogiri (1.16. | 
| 142 | 
            +
                nokogiri (1.16.5-x86_64-linux)
         | 
| 143 143 | 
             
                  racc (~> 1.4)
         | 
| 144 144 | 
             
                nokogiri-diff (0.3.0)
         | 
| 145 145 | 
             
                  nokogiri (~> 1.5)
         | 
| 146 146 | 
             
                  tdiff (~> 0.4)
         | 
| 147 147 | 
             
                parallel (1.24.0)
         | 
| 148 | 
            -
                parser (3.3.0 | 
| 148 | 
            +
                parser (3.3.1.0)
         | 
| 149 149 | 
             
                  ast (~> 2.4.1)
         | 
| 150 150 | 
             
                  racc
         | 
| 151 151 | 
             
                psych (5.1.2)
         | 
| 152 152 | 
             
                  stringio
         | 
| 153 153 | 
             
                public_suffix (5.0.4)
         | 
| 154 | 
            -
                racc (1. | 
| 155 | 
            -
                rack (3.0. | 
| 154 | 
            +
                racc (1.8.0)
         | 
| 155 | 
            +
                rack (3.0.11)
         | 
| 156 156 | 
             
                rack-session (2.0.0)
         | 
| 157 157 | 
             
                  rack (>= 3.0.0)
         | 
| 158 158 | 
             
                rack-test (2.1.0)
         | 
| @@ -160,20 +160,20 @@ GEM | |
| 160 160 | 
             
                rackup (2.1.0)
         | 
| 161 161 | 
             
                  rack (>= 3)
         | 
| 162 162 | 
             
                  webrick (~> 1.8)
         | 
| 163 | 
            -
                rails (7.1.3. | 
| 164 | 
            -
                  actioncable (= 7.1.3. | 
| 165 | 
            -
                  actionmailbox (= 7.1.3. | 
| 166 | 
            -
                  actionmailer (= 7.1.3. | 
| 167 | 
            -
                  actionpack (= 7.1.3. | 
| 168 | 
            -
                  actiontext (= 7.1.3. | 
| 169 | 
            -
                  actionview (= 7.1.3. | 
| 170 | 
            -
                  activejob (= 7.1.3. | 
| 171 | 
            -
                  activemodel (= 7.1.3. | 
| 172 | 
            -
                  activerecord (= 7.1.3. | 
| 173 | 
            -
                  activestorage (= 7.1.3. | 
| 174 | 
            -
                  activesupport (= 7.1.3. | 
| 163 | 
            +
                rails (7.1.3.3)
         | 
| 164 | 
            +
                  actioncable (= 7.1.3.3)
         | 
| 165 | 
            +
                  actionmailbox (= 7.1.3.3)
         | 
| 166 | 
            +
                  actionmailer (= 7.1.3.3)
         | 
| 167 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 168 | 
            +
                  actiontext (= 7.1.3.3)
         | 
| 169 | 
            +
                  actionview (= 7.1.3.3)
         | 
| 170 | 
            +
                  activejob (= 7.1.3.3)
         | 
| 171 | 
            +
                  activemodel (= 7.1.3.3)
         | 
| 172 | 
            +
                  activerecord (= 7.1.3.3)
         | 
| 173 | 
            +
                  activestorage (= 7.1.3.3)
         | 
| 174 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 175 175 | 
             
                  bundler (>= 1.15.0)
         | 
| 176 | 
            -
                  railties (= 7.1.3. | 
| 176 | 
            +
                  railties (= 7.1.3.3)
         | 
| 177 177 | 
             
                rails-dom-testing (2.2.0)
         | 
| 178 178 | 
             
                  activesupport (>= 5.0.0)
         | 
| 179 179 | 
             
                  minitest
         | 
| @@ -181,22 +181,23 @@ GEM | |
| 181 181 | 
             
                rails-html-sanitizer (1.6.0)
         | 
| 182 182 | 
             
                  loofah (~> 2.21)
         | 
| 183 183 | 
             
                  nokogiri (~> 1.14)
         | 
| 184 | 
            -
                railties (7.1.3. | 
| 185 | 
            -
                  actionpack (= 7.1.3. | 
| 186 | 
            -
                  activesupport (= 7.1.3. | 
| 184 | 
            +
                railties (7.1.3.3)
         | 
| 185 | 
            +
                  actionpack (= 7.1.3.3)
         | 
| 186 | 
            +
                  activesupport (= 7.1.3.3)
         | 
| 187 187 | 
             
                  irb
         | 
| 188 188 | 
             
                  rackup (>= 1.0.0)
         | 
| 189 189 | 
             
                  rake (>= 12.2)
         | 
| 190 190 | 
             
                  thor (~> 1.0, >= 1.2.2)
         | 
| 191 191 | 
             
                  zeitwerk (~> 2.6)
         | 
| 192 192 | 
             
                rainbow (3.1.1)
         | 
| 193 | 
            -
                rake (13.1 | 
| 194 | 
            -
                rdoc (6.6. | 
| 193 | 
            +
                rake (13.2.1)
         | 
| 194 | 
            +
                rdoc (6.6.3.1)
         | 
| 195 195 | 
             
                  psych (>= 4.0.0)
         | 
| 196 | 
            -
                regexp_parser (2.9. | 
| 197 | 
            -
                reline (0. | 
| 196 | 
            +
                regexp_parser (2.9.2)
         | 
| 197 | 
            +
                reline (0.5.7)
         | 
| 198 198 | 
             
                  io-console (~> 0.5)
         | 
| 199 | 
            -
                rexml (3.2. | 
| 199 | 
            +
                rexml (3.2.8)
         | 
| 200 | 
            +
                  strscan (>= 3.0.9)
         | 
| 200 201 | 
             
                rspec (3.13.0)
         | 
| 201 202 | 
             
                  rspec-core (~> 3.13.0)
         | 
| 202 203 | 
             
                  rspec-expectations (~> 3.13.0)
         | 
| @@ -210,7 +211,7 @@ GEM | |
| 210 211 | 
             
                  diff-lcs (>= 1.2.0, < 2.0)
         | 
| 211 212 | 
             
                  rspec-support (~> 3.13.0)
         | 
| 212 213 | 
             
                rspec-support (3.13.1)
         | 
| 213 | 
            -
                rubocop (1. | 
| 214 | 
            +
                rubocop (1.63.5)
         | 
| 214 215 | 
             
                  json (~> 2.3)
         | 
| 215 216 | 
             
                  language_server-protocol (>= 3.17.0)
         | 
| 216 217 | 
             
                  parallel (~> 1.10)
         | 
| @@ -221,23 +222,26 @@ GEM | |
| 221 222 | 
             
                  rubocop-ast (>= 1.31.1, < 2.0)
         | 
| 222 223 | 
             
                  ruby-progressbar (~> 1.7)
         | 
| 223 224 | 
             
                  unicode-display_width (>= 2.4.0, < 3.0)
         | 
| 224 | 
            -
                rubocop-ast (1.31. | 
| 225 | 
            -
                  parser (>= 3.3.0 | 
| 225 | 
            +
                rubocop-ast (1.31.3)
         | 
| 226 | 
            +
                  parser (>= 3.3.1.0)
         | 
| 226 227 | 
             
                rubocop-capybara (2.20.0)
         | 
| 227 228 | 
             
                  rubocop (~> 1.41)
         | 
| 228 229 | 
             
                rubocop-factory_bot (2.25.1)
         | 
| 229 230 | 
             
                  rubocop (~> 1.41)
         | 
| 230 | 
            -
                rubocop-rails (2. | 
| 231 | 
            +
                rubocop-rails (2.25.0)
         | 
| 231 232 | 
             
                  activesupport (>= 4.2.0)
         | 
| 232 233 | 
             
                  rack (>= 1.1)
         | 
| 233 234 | 
             
                  rubocop (>= 1.33.0, < 2.0)
         | 
| 234 235 | 
             
                  rubocop-ast (>= 1.31.1, < 2.0)
         | 
| 235 236 | 
             
                rubocop-rake (0.6.0)
         | 
| 236 237 | 
             
                  rubocop (~> 1.0)
         | 
| 237 | 
            -
                rubocop-rspec (2. | 
| 238 | 
            +
                rubocop-rspec (2.29.2)
         | 
| 238 239 | 
             
                  rubocop (~> 1.40)
         | 
| 239 240 | 
             
                  rubocop-capybara (~> 2.17)
         | 
| 240 241 | 
             
                  rubocop-factory_bot (~> 2.22)
         | 
| 242 | 
            +
                  rubocop-rspec_rails (~> 2.28)
         | 
| 243 | 
            +
                rubocop-rspec_rails (2.28.3)
         | 
| 244 | 
            +
                  rubocop (~> 1.40)
         | 
| 241 245 | 
             
                ruby-progressbar (1.13.0)
         | 
| 242 246 | 
             
                simplecov (0.22.0)
         | 
| 243 247 | 
             
                  docile (~> 1.1)
         | 
| @@ -246,8 +250,9 @@ GEM | |
| 246 250 | 
             
                simplecov-html (0.12.3)
         | 
| 247 251 | 
             
                simplecov_json_formatter (0.1.4)
         | 
| 248 252 | 
             
                stringio (3.1.0)
         | 
| 253 | 
            +
                strscan (3.1.0)
         | 
| 249 254 | 
             
                tdiff (0.4.0)
         | 
| 250 | 
            -
                thor (1.3. | 
| 255 | 
            +
                thor (1.3.1)
         | 
| 251 256 | 
             
                timeout (0.4.1)
         | 
| 252 257 | 
             
                tzinfo (2.0.6)
         | 
| 253 258 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| @@ -259,7 +264,7 @@ GEM | |
| 259 264 | 
             
                xpath (3.2.0)
         | 
| 260 265 | 
             
                  nokogiri (~> 1.8)
         | 
| 261 266 | 
             
                yard (0.9.36)
         | 
| 262 | 
            -
                zeitwerk (2.6. | 
| 267 | 
            +
                zeitwerk (2.6.14)
         | 
| 263 268 |  | 
| 264 269 | 
             
            PLATFORMS
         | 
| 265 270 | 
             
              x86_64-darwin-19
         | 
| @@ -271,12 +276,12 @@ DEPENDENCIES | |
| 271 276 | 
             
              capybara (~> 3.40.0)
         | 
| 272 277 | 
             
              ccs-frontend_helpers!
         | 
| 273 278 | 
             
              nokogiri-diff (~> 0.3.0)
         | 
| 274 | 
            -
              rake (~> 13. | 
| 279 | 
            +
              rake (~> 13.2)
         | 
| 275 280 | 
             
              rspec (~> 3.13)
         | 
| 276 | 
            -
              rubocop (~> 1. | 
| 277 | 
            -
              rubocop-rails (~> 2. | 
| 281 | 
            +
              rubocop (~> 1.63)
         | 
| 282 | 
            +
              rubocop-rails (~> 2.25)
         | 
| 278 283 | 
             
              rubocop-rake (~> 0.6)
         | 
| 279 | 
            -
              rubocop-rspec (~> 2. | 
| 284 | 
            +
              rubocop-rspec (~> 2.29)
         | 
| 280 285 | 
             
              simplecov (~> 0.21)
         | 
| 281 286 | 
             
              yard (~> 0.9)
         | 
| 282 287 |  | 
    
        data/README.md
    CHANGED
    
    | @@ -14,6 +14,8 @@ 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 |
         | 
| 16 16 | 
             
            | ----------------------------- | ------------------------------ |
         | 
| 17 | 
            +
            | [0.4.0](https://github.com/tim-s-ccs/ccs-frontend_helpers/releases/tag/v0.4.0) | [5.4.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.4.0) |
         | 
| 18 | 
            +
            | [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) |
         | 
| 17 19 | 
             
            | [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) |
         | 
| 18 20 | 
             
            | [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) |
         | 
| 19 21 |  | 
| @@ -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 |  | 
| @@ -31,7 +31,7 @@ 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 | 
| 34 | 
            +
                    def initialize(title:, error_summary_items: [], description: nil, **options)
         | 
| 35 35 | 
             
                      super(**options)
         | 
| 36 36 |  | 
| 37 37 | 
             
                      @title = title
         | 
| @@ -51,9 +51,11 @@ module CCS | |
| 51 51 | 
             
                          concat(tag.h2(title, class: 'govuk-error-summary__title'))
         | 
| 52 52 | 
             
                          concat(tag.div(class: 'govuk-error-summary__body') do
         | 
| 53 53 | 
             
                            concat(tag.p(description)) if description
         | 
| 54 | 
            -
                             | 
| 55 | 
            -
                               | 
| 56 | 
            -
             | 
| 54 | 
            +
                            if error_summary_items.any?
         | 
| 55 | 
            +
                              concat(tag.ul(class: 'govuk-list govuk-error-summary__list') do
         | 
| 56 | 
            +
                                error_summary_items.each { |error_summary_item| concat(error_summary_item.render) }
         | 
| 57 | 
            +
                              end)
         | 
| 58 | 
            +
                            end
         | 
| 57 59 | 
             
                          end)
         | 
| 58 60 | 
             
                        end
         | 
| 59 61 | 
             
                      end
         | 
| @@ -0,0 +1,62 @@ | |
| 1 | 
            +
            module CCS
         | 
| 2 | 
            +
              module Components
         | 
| 3 | 
            +
                module GovUK
         | 
| 4 | 
            +
                  class Field < Base
         | 
| 5 | 
            +
                    class Input < Field
         | 
| 6 | 
            +
                      class CharacterCount
         | 
| 7 | 
            +
                        # = GOV.UK Character count message
         | 
| 8 | 
            +
                        #
         | 
| 9 | 
            +
                        # This is used to generate the character count message
         | 
| 10 | 
            +
                        #
         | 
| 11 | 
            +
                        # @!attribute [r] count_message
         | 
| 12 | 
            +
                        #   @return [Hint] Hint with the count message
         | 
| 13 | 
            +
                        # @!attribute [r] after_input
         | 
| 14 | 
            +
                        #   @return [String] Text or HTML for after the textarea input
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                        class CountMessage
         | 
| 17 | 
            +
                          include ActionView::Context
         | 
| 18 | 
            +
                          include ActionView::Helpers
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                          private
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                          attr_reader :count_message, :after_input
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                          public
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                          # @param character_count_attribute [String] the name of the field as it will appear in the textarea
         | 
| 27 | 
            +
                          # @param context [ActionView::Base] the view context
         | 
| 28 | 
            +
                          # @param character_count_options (see CCS::Components::GovUK::Field::Input::CharacterCount.get_character_count_from_group_options)
         | 
| 29 | 
            +
                          # @param after_input [String] Text or HTML that goes after the input
         | 
| 30 | 
            +
                          #
         | 
| 31 | 
            +
                          # @option (see CCS::Components::GovUK::Field::Input::CharacterCount.get_character_count_from_group_options)
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                          def initialize(character_count_attribute:, context:, character_count_options:, after_input: nil)
         | 
| 34 | 
            +
                            count_message = character_count_options[:textarea_description] || {}
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                            count_message_length = character_count_options[:maxwords] || character_count_options[:maxlength]
         | 
| 37 | 
            +
                            count_message_default = "You can enter up to %<count>s #{character_count_options[:maxwords] ? 'words' : 'characters'}"
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                            text = count_message_length ? format(count_message[:count_message] || count_message_default, count: count_message_length) : ''
         | 
| 40 | 
            +
                            classes = "govuk-character-count__message #{count_message[:classes]}".rstrip
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                            @count_message = Hint.new(text: text, classes: classes, attributes: { id: "#{character_count_attribute}-info" }, context: context)
         | 
| 43 | 
            +
                            @after_input = after_input
         | 
| 44 | 
            +
                          end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                          # Generates the HTML for the GOV.UK Character count message
         | 
| 47 | 
            +
                          #
         | 
| 48 | 
            +
                          # @return [ActiveSupport::SafeBuffer]
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                          def render
         | 
| 51 | 
            +
                            capture do
         | 
| 52 | 
            +
                              concat(count_message.render)
         | 
| 53 | 
            +
                              concat(after_input) if after_input
         | 
| 54 | 
            +
                            end
         | 
| 55 | 
            +
                          end
         | 
| 56 | 
            +
                        end
         | 
| 57 | 
            +
                      end
         | 
| 58 | 
            +
                    end
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
              end
         | 
| 62 | 
            +
            end
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            require_relative 'textarea'
         | 
| 2 | 
            -
            require_relative ' | 
| 2 | 
            +
            require_relative 'character_count/count_message'
         | 
| 3 3 |  | 
| 4 4 | 
             
            module CCS
         | 
| 5 5 | 
             
              module Components
         | 
| @@ -21,12 +21,9 @@ module CCS | |
| 21 21 | 
             
                      #   @return [Hash] HTML options for the character count
         | 
| 22 22 |  | 
| 23 23 | 
             
                      class CharacterCount
         | 
| 24 | 
            -
                        include ActionView::Context
         | 
| 25 | 
            -
                        include ActionView::Helpers
         | 
| 26 | 
            -
             | 
| 27 24 | 
             
                        private
         | 
| 28 25 |  | 
| 29 | 
            -
                        attr_reader :textarea, :textarea_description | 
| 26 | 
            +
                        attr_reader :textarea, :textarea_description
         | 
| 30 27 |  | 
| 31 28 | 
             
                        public
         | 
| 32 29 |  | 
| @@ -41,21 +38,10 @@ module CCS | |
| 41 38 | 
             
                        def initialize(attribute:, context:, character_count_options: {}, **options)
         | 
| 42 39 | 
             
                          character_count_attribute = options[:form] ? "#{options[:form].object_name}_#{attribute}" : attribute
         | 
| 43 40 |  | 
| 44 | 
            -
                          initialise_textarea(attribute, character_count_attribute, context, options)
         | 
| 45 | 
            -
                          initialise_character_count_html_options(character_count_options)
         | 
| 46 | 
            -
                          initialise_textarea_description(character_count_attribute, context, character_count_options)
         | 
| 41 | 
            +
                          initialise_textarea(attribute, character_count_attribute, character_count_options, context, options)
         | 
| 47 42 | 
             
                        end
         | 
| 48 43 |  | 
| 49 | 
            -
                         | 
| 50 | 
            -
                        #
         | 
| 51 | 
            -
                        # @return [ActiveSupport::SafeBuffer]
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                        def render
         | 
| 54 | 
            -
                          tag.div(**character_count_html_options) do
         | 
| 55 | 
            -
                            concat(textarea.render)
         | 
| 56 | 
            -
                            concat(textarea_description.render)
         | 
| 57 | 
            -
                          end
         | 
| 58 | 
            -
                        end
         | 
| 44 | 
            +
                        delegate :render, to: :textarea
         | 
| 59 45 |  | 
| 60 46 | 
             
                        private
         | 
| 61 47 |  | 
| @@ -63,19 +49,23 @@ module CCS | |
| 63 49 | 
             
                        #
         | 
| 64 50 | 
             
                        # @param attribute [Symbol] the attribute of the field
         | 
| 65 51 | 
             
                        # @param character_count_attribute [String] the name of the field as it will appear in the textarea
         | 
| 52 | 
            +
                        # @param character_count_options [Hash] options for the character count
         | 
| 66 53 | 
             
                        # @param context [ActionView::Base] the view context
         | 
| 67 54 | 
             
                        # @param options [Hash] options that will be used for the textarea
         | 
| 68 55 | 
             
                        #
         | 
| 69 56 | 
             
                        # @option (see CCS::Components::GovUK::Field::Input::Textarea#initialize)
         | 
| 70 57 |  | 
| 71 | 
            -
                        def initialise_textarea(attribute, character_count_attribute, context, options)
         | 
| 58 | 
            +
                        def initialise_textarea(attribute, character_count_attribute, character_count_options, context, options)
         | 
| 59 | 
            +
                          set_character_count_from_group_options(character_count_options, options)
         | 
| 60 | 
            +
             | 
| 72 61 | 
             
                          ((options[:attributes] ||= {})[:aria] ||= {})[:describedby] = [options.dig(:attributes, :aria, :describedby), "#{character_count_attribute}-info"].compact.join(' ')
         | 
| 73 62 | 
             
                          options[:classes] = "govuk-js-character-count #{options[:classes]}".rstrip
         | 
| 74 63 |  | 
| 75 | 
            -
                           | 
| 64 | 
            +
                          count_message = CountMessage.new(character_count_attribute: character_count_attribute, context: context, character_count_options: character_count_options, after_input: options.delete(:after_input))
         | 
| 65 | 
            +
                          @textarea = Textarea.new(attribute: attribute, context: context, after_input: count_message.render, **options)
         | 
| 76 66 | 
             
                        end
         | 
| 77 67 |  | 
| 78 | 
            -
                        #  | 
| 68 | 
            +
                        # Sets the charcter count form group options
         | 
| 79 69 | 
             
                        #
         | 
| 80 70 | 
             
                        # @param character_count_options [Hash] options for the charcter count
         | 
| 81 71 | 
             
                        #
         | 
| @@ -91,50 +81,29 @@ module CCS | |
| 91 81 | 
             
                        #                                                            - +:count_message+ replaced the default text for the count message.
         | 
| 92 82 | 
             
                        #                                                                               If you want the count number to appear, put %<count>s in the string and it will be replaced with the number
         | 
| 93 83 | 
             
                        #                                                            - +classes+ additional CSS classes for the textarea description HTML
         | 
| 94 | 
            -
                        # @option character_count_options [ | 
| 84 | 
            +
                        # @option character_count_options [String] :characters_under_limit Message displayed when the number of characters is under the configured maximum, maxlength
         | 
| 95 85 | 
             
                        # @option character_count_options [String] :characters_at_limit_text Message displayed when the number of characters reaches the configured maximum, maxlength
         | 
| 96 | 
            -
                        # @option character_count_options [ | 
| 97 | 
            -
                        # @option character_count_options [ | 
| 86 | 
            +
                        # @option character_count_options [String] :characters_over_limit Message displayed when the number of characters is over the configured maximum, maxlength
         | 
| 87 | 
            +
                        # @option character_count_options [String] :words_under_limit Message displayed when the number of words is under the configured maximum, maxwords
         | 
| 98 88 | 
             
                        # @option character_count_options [String] :words_at_limit_text Message displayed when the number of words reaches the configured maximum, maxwords
         | 
| 99 | 
            -
                        # @option character_count_options [ | 
| 89 | 
            +
                        # @option character_count_options [String] :words_over_limit Message displayed when the number of words is over the configured maximum, maxwords
         | 
| 100 90 |  | 
| 101 | 
            -
                        def  | 
| 102 | 
            -
                           | 
| 91 | 
            +
                        def set_character_count_from_group_options(character_count_options, options)
         | 
| 92 | 
            +
                          (options[:form_group] ||= {})[:classes] = "govuk-character-count #{options.dig(:form_group, :classes)}".rstrip
         | 
| 93 | 
            +
                          ((options[:form_group][:attributes] ||= {})[:data] ||= {})[:module] = 'govuk-character-count'
         | 
| 103 94 |  | 
| 104 95 | 
             
                          %i[maxlength threshold maxwords].each do |data_attribute|
         | 
| 105 | 
            -
                             | 
| 96 | 
            +
                            options[:form_group][:attributes][:data][data_attribute] = character_count_options[data_attribute].to_s if character_count_options[data_attribute]
         | 
| 106 97 | 
             
                          end
         | 
| 107 98 |  | 
| 108 | 
            -
                          get_chacrter_count_translations(character_count_options) | 
| 109 | 
            -
                             | 
| 99 | 
            +
                          get_chacrter_count_translations(character_count_options) do |data_attribute, value|
         | 
| 100 | 
            +
                            options[:form_group][:attributes][:data][data_attribute] = value
         | 
| 110 101 | 
             
                          end
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                          @character_count_html_options = character_count_html_options
         | 
| 113 | 
            -
                        end
         | 
| 114 | 
            -
             | 
| 115 | 
            -
                        # Initialises the charcter count textarea description
         | 
| 116 | 
            -
                        #
         | 
| 117 | 
            -
                        # @param character_count_attribute [String] the name of the field as it will appear in the textarea
         | 
| 118 | 
            -
                        # @param context [ActionView::Base] the view context
         | 
| 119 | 
            -
                        # @param (see initialise_character_count_html_options)
         | 
| 120 | 
            -
                        #
         | 
| 121 | 
            -
                        # @option (see initialise_character_count_html_options)
         | 
| 122 | 
            -
             | 
| 123 | 
            -
                        def initialise_textarea_description(character_count_attribute, context, character_count_options)
         | 
| 124 | 
            -
                          textarea_description = character_count_options[:textarea_description] || {}
         | 
| 125 | 
            -
             | 
| 126 | 
            -
                          textarea_description_length = character_count_options[:maxwords] || character_count_options[:maxlength]
         | 
| 127 | 
            -
                          textarea_description_default = "You can enter up to %<count>s #{character_count_options[:maxwords] ? 'words' : 'characters'}"
         | 
| 128 | 
            -
             | 
| 129 | 
            -
                          text = textarea_description_length ? format(textarea_description[:count_message] || textarea_description_default, count: textarea_description_length) : ''
         | 
| 130 | 
            -
                          classes = "govuk-character-count__message #{textarea_description[:classes]}".rstrip
         | 
| 131 | 
            -
             | 
| 132 | 
            -
                          @textarea_description = Hint.new(text: text, classes: classes, attributes: { id: "#{character_count_attribute}-info" }, context: context)
         | 
| 133 102 | 
             
                        end
         | 
| 134 103 |  | 
| 135 104 | 
             
                        # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
         | 
| 136 105 |  | 
| 137 | 
            -
                        #  | 
| 106 | 
            +
                        # Generator for the translation options for character count
         | 
| 138 107 | 
             
                        #
         | 
| 139 108 | 
             
                        # @param (see initialise_character_count_html_options)
         | 
| 140 109 | 
             
                        #
         | 
| @@ -143,24 +112,25 @@ module CCS | |
| 143 112 | 
             
                        # @return [Hash]
         | 
| 144 113 |  | 
| 145 114 | 
             
                        def get_chacrter_count_translations(character_count_options)
         | 
| 146 | 
            -
                          character_count_data_options = {}
         | 
| 147 | 
            -
             | 
| 148 115 | 
             
                          %i[characters_at_limit words_at_limit].each do |data_attribute|
         | 
| 149 116 | 
             
                            data_attribute_name = :"#{data_attribute}_text"
         | 
| 150 | 
            -
             | 
| 117 | 
            +
             | 
| 118 | 
            +
                            next unless character_count_options[data_attribute_name]
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                            yield :"i18n.#{data_attribute.to_s.gsub('_', '-')}", character_count_options[data_attribute_name]
         | 
| 151 121 | 
             
                          end
         | 
| 152 122 |  | 
| 153 123 | 
             
                          %i[characters_under_limit characters_over_limit words_under_limit words_over_limit].each do |data_attribute|
         | 
| 154 124 | 
             
                            next unless character_count_options[data_attribute]
         | 
| 155 125 |  | 
| 156 126 | 
             
                            %i[other one].each do |plural_rule|
         | 
| 157 | 
            -
                               | 
| 127 | 
            +
                              next unless character_count_options[data_attribute][plural_rule]
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                              yield :"i18n.#{data_attribute.to_s.gsub('_', '-')}.#{plural_rule}", character_count_options[data_attribute][plural_rule]
         | 
| 158 130 | 
             
                            end
         | 
| 159 131 | 
             
                          end
         | 
| 160 132 |  | 
| 161 | 
            -
                           | 
| 162 | 
            -
             | 
| 163 | 
            -
                          character_count_data_options
         | 
| 133 | 
            +
                          yield :'i18n.textarea-description.other', character_count_options[:textarea_description][:count_message] if character_count_options.dig(:textarea_description, :count_message) && !(character_count_options[:maxwords] || character_count_options[:maxlength])
         | 
| 164 134 | 
             
                        end
         | 
| 165 135 |  | 
| 166 136 | 
             
                        # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
         |