govuk-components 4.0.0a2 → 4.0.0rc1
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/app/components/govuk_component/accordion_component/section_component.rb +7 -4
 - data/app/components/govuk_component/accordion_component.rb +4 -2
 - data/app/components/govuk_component/header_component.rb +2 -2
 - data/app/components/govuk_component/notification_banner_component.rb +1 -1
 - data/app/components/govuk_component/summary_list_component/action_component.rb +2 -2
 - data/lib/govuk/components/version.rb +1 -1
 - metadata +8 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bd7e8066fccea2b88cdf610a3311daf69e72552d2025e740417a8716851866bc
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 506bd4f0a292bae9d908038af9597c83adca6e3b2a8cc912adb79566977d238c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f77444b5107f2a0d3ccb9166bb28297b6a8d643a0e4d4ac9310dd33699df7de1e51ab9ccd4ce4fc457267f43b497d5b17b2f5904b79007dac418f987900364ea
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fc20ae15eba5a9d0faf7e953a9d28958928ecbed0b9a82c4d23643cac88ca60846e7f5cffa1fe11d38ad38c90ebb9582ef6abf0d3be9c1fa85b3f101e4281d2d
         
     | 
| 
         @@ -1,26 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class GovukComponent::AccordionComponent::SectionComponent < GovukComponent::Base
         
     | 
| 
       2 
     | 
    
         
            -
              attr_reader :heading_text, :summary_text, :expanded, :heading_level
         
     | 
| 
      
 2 
     | 
    
         
            +
              attr_reader :heading_text, :summary_text, :expanded, :heading_level, :accordion_id
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
              renders_one :heading_html
         
     | 
| 
       5 
5 
     | 
    
         
             
              renders_one :summary_html
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              alias_method :expanded?, :expanded
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              def initialize(heading_text:, summary_text:, expanded:, heading_level:, classes: [], html_attributes: {})
         
     | 
| 
      
 9 
     | 
    
         
            +
              def initialize(heading_text:, summary_text:, expanded:, heading_level:, accordion_id: nil, classes: [], html_attributes: {})
         
     | 
| 
       10 
10 
     | 
    
         
             
                @heading_text  = heading_text
         
     | 
| 
       11 
11 
     | 
    
         
             
                @summary_text  = summary_text
         
     | 
| 
       12 
12 
     | 
    
         
             
                @expanded      = expanded
         
     | 
| 
       13 
13 
     | 
    
         
             
                @heading_level = heading_level
         
     | 
| 
      
 14 
     | 
    
         
            +
                @accordion_id  = accordion_id
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
16 
     | 
    
         
             
                super(classes: classes, html_attributes: html_attributes)
         
     | 
| 
       16 
17 
     | 
    
         
             
              end
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
              def id(suffix: nil)
         
     | 
| 
      
 20 
     | 
    
         
            +
                prefix = @accordion_id
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       19 
22 
     | 
    
         
             
                # generate a random number if we don't have heading_text to avoid attempting
         
     | 
| 
       20 
23 
     | 
    
         
             
                # to parameterize a potentially-huge chunk of HTML
         
     | 
| 
       21 
     | 
    
         
            -
                @ 
     | 
| 
      
 24 
     | 
    
         
            +
                @unique_identifier ||= heading_text&.parameterize || SecureRandom.hex(4)
         
     | 
| 
       22 
25 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
                [ 
     | 
| 
      
 26 
     | 
    
         
            +
                [prefix, @unique_identifier, suffix].compact.join('-')
         
     | 
| 
       24 
27 
     | 
    
         
             
              end
         
     | 
| 
       25 
28 
     | 
    
         | 
| 
       26 
29 
     | 
    
         
             
              def heading_content
         
     | 
| 
         @@ -7,14 +7,16 @@ class GovukComponent::AccordionComponent < GovukComponent::Base 
     | 
|
| 
       7 
7 
     | 
    
         
             
                  html_attributes: html_attributes,
         
     | 
| 
       8 
8 
     | 
    
         
             
                  summary_text: summary_text,
         
     | 
| 
       9 
9 
     | 
    
         
             
                  heading_text: heading_text,
         
     | 
| 
      
 10 
     | 
    
         
            +
                  accordion_id: accordion_id,
         
     | 
| 
       10 
11 
     | 
    
         
             
                  &block
         
     | 
| 
       11 
12 
     | 
    
         
             
                )
         
     | 
| 
       12 
13 
     | 
    
         
             
              end
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              attr_reader : 
     | 
| 
      
 15 
     | 
    
         
            +
              attr_reader :accordion_id, :heading_level
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
17 
     | 
    
         
             
              def initialize(heading_level: 2, classes: [], html_attributes: {})
         
     | 
| 
       17 
18 
     | 
    
         
             
                @heading_level = heading_tag(heading_level)
         
     | 
| 
      
 19 
     | 
    
         
            +
                @accordion_id  = html_attributes[:id]
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
21 
     | 
    
         
             
                super(classes: classes, html_attributes: html_attributes)
         
     | 
| 
       20 
22 
     | 
    
         
             
              end
         
     | 
| 
         @@ -22,7 +24,7 @@ class GovukComponent::AccordionComponent < GovukComponent::Base 
     | 
|
| 
       22 
24 
     | 
    
         
             
            private
         
     | 
| 
       23 
25 
     | 
    
         | 
| 
       24 
26 
     | 
    
         
             
              def default_attributes
         
     | 
| 
       25 
     | 
    
         
            -
                { class: %w(govuk-accordion), data: { module: 'govuk-accordion' } }
         
     | 
| 
      
 27 
     | 
    
         
            +
                { class: %w(govuk-accordion), data: { module: 'govuk-accordion' } }.compact
         
     | 
| 
       26 
28 
     | 
    
         
             
              end
         
     | 
| 
       27 
29 
     | 
    
         | 
| 
       28 
30 
     | 
    
         
             
              def heading_tag(level)
         
     | 
| 
         @@ -125,11 +125,11 @@ private 
     | 
|
| 
       125 
125 
     | 
    
         
             
                end
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
       127 
127 
     | 
    
         
             
                def render?
         
     | 
| 
       128 
     | 
    
         
            -
                  name.present? || content 
     | 
| 
      
 128 
     | 
    
         
            +
                  name.present? || content?
         
     | 
| 
       129 
129 
     | 
    
         
             
                end
         
     | 
| 
       130 
130 
     | 
    
         | 
| 
       131 
131 
     | 
    
         
             
                def call
         
     | 
| 
       132 
     | 
    
         
            -
                  if content 
     | 
| 
      
 132 
     | 
    
         
            +
                  if content?
         
     | 
| 
       133 
133 
     | 
    
         
             
                    tag.div(content, **html_attributes)
         
     | 
| 
       134 
134 
     | 
    
         
             
                  else
         
     | 
| 
       135 
135 
     | 
    
         
             
                    tag.span(name, **html_attributes)
         
     | 
| 
         @@ -20,7 +20,7 @@ class GovukComponent::SummaryListComponent::ActionComponent < GovukComponent::Ba 
     | 
|
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              def call
         
     | 
| 
       22 
22 
     | 
    
         
             
                link_to(href, **html_attributes) do
         
     | 
| 
       23 
     | 
    
         
            -
                  safe_join([action_text, visually_hidden_span].compact 
     | 
| 
      
 23 
     | 
    
         
            +
                  safe_join([action_text, visually_hidden_span].compact)
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
         @@ -37,6 +37,6 @@ private 
     | 
|
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
              def visually_hidden_span
         
     | 
| 
       40 
     | 
    
         
            -
                tag.span(visually_hidden_text, class: "govuk-visually-hidden") if visually_hidden_text.present?
         
     | 
| 
      
 40 
     | 
    
         
            +
                tag.span(%( #{visually_hidden_text}), class: "govuk-visually-hidden") if visually_hidden_text.present?
         
     | 
| 
       41 
41 
     | 
    
         
             
              end
         
     | 
| 
       42 
42 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: govuk-components
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 4.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 4.0.0rc1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - DfE developers
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-04-13 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: html-attributes-utils
         
     | 
| 
         @@ -50,14 +50,14 @@ dependencies: 
     | 
|
| 
       50 
50 
     | 
    
         
             
                requirements:
         
     | 
| 
       51 
51 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       52 
52 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
     | 
    
         
            -
                    version: 3.0. 
     | 
| 
      
 53 
     | 
    
         
            +
                    version: 3.0.0rc6
         
     | 
| 
       54 
54 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       55 
55 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       56 
56 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
57 
     | 
    
         
             
                requirements:
         
     | 
| 
       58 
58 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       59 
59 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       60 
     | 
    
         
            -
                    version: 3.0. 
     | 
| 
      
 60 
     | 
    
         
            +
                    version: 3.0.0rc6
         
     | 
| 
       61 
61 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       62 
62 
     | 
    
         
             
              name: deep_merge
         
     | 
| 
       63 
63 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -218,14 +218,14 @@ dependencies: 
     | 
|
| 
       218 
218 
     | 
    
         
             
                requirements:
         
     | 
| 
       219 
219 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       220 
220 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       221 
     | 
    
         
            -
                    version: 4. 
     | 
| 
      
 221 
     | 
    
         
            +
                    version: 4.1.0
         
     | 
| 
       222 
222 
     | 
    
         
             
              type: :development
         
     | 
| 
       223 
223 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       224 
224 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       225 
225 
     | 
    
         
             
                requirements:
         
     | 
| 
       226 
226 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       227 
227 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       228 
     | 
    
         
            -
                    version: 4. 
     | 
| 
      
 228 
     | 
    
         
            +
                    version: 4.1.0
         
     | 
| 
       229 
229 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       230 
230 
     | 
    
         
             
              name: rubypants
         
     | 
| 
       231 
231 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -274,14 +274,14 @@ dependencies: 
     | 
|
| 
       274 
274 
     | 
    
         
             
                requirements:
         
     | 
| 
       275 
275 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       276 
276 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       277 
     | 
    
         
            -
                    version:  
     | 
| 
      
 277 
     | 
    
         
            +
                    version: 5.1.0
         
     | 
| 
       278 
278 
     | 
    
         
             
              type: :development
         
     | 
| 
       279 
279 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       280 
280 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       281 
281 
     | 
    
         
             
                requirements:
         
     | 
| 
       282 
282 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       283 
283 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       284 
     | 
    
         
            -
                    version:  
     | 
| 
      
 284 
     | 
    
         
            +
                    version: 5.1.0
         
     | 
| 
       285 
285 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       286 
286 
     | 
    
         
             
              name: slim_lint
         
     | 
| 
       287 
287 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |