govuk-components 5.2.1 → 5.3.1
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/footer_component.html.erb +2 -1
- data/app/components/govuk_component/footer_component.rb +7 -4
- data/app/components/govuk_component/header_component.html.erb +1 -1
- data/app/components/govuk_component/pagination_component.rb +1 -1
- data/app/components/govuk_component/tab_component.html.erb +1 -1
- data/app/components/govuk_component/tab_component.rb +1 -1
- data/app/helpers/govuk_link_helper.rb +14 -3
- data/app/helpers/govuk_list_helper.rb +29 -0
- data/app/helpers/govuk_rails_compatible_link_helper.rb +1 -1
- data/lib/govuk/components/version.rb +1 -1
- metadata +19 -12
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bfb9138d8ba86a92cb9809920d7f33b7caa759733fd269c0289be8afab08d41a
         | 
| 4 | 
            +
              data.tar.gz: 93bbe281a1a5ed4d4d0d7b8e052599ec4a222534f1cd2286caca59c6cea4728d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e0d5ee5981ae15bf402b81297b63a9a70caf177f427fc5e0206245d7d6d08e39daa83d4f7dbbd2fe3f6543fcb096578c997165aaeb54143c318b120d6e2311cc
         | 
| 7 | 
            +
              data.tar.gz: ea18f289337c0b3aa68af67184cb6250296ba016a3972a097f11456c90014b634a544268e5c5ecc147d1cbbc08c8203924f630805cf43fdd92cde04a814f9d1e
         | 
| @@ -15,7 +15,7 @@ | |
| 15 15 | 
             
                    <div class="<%= brand %>-footer__meta-item <%= brand %>-footer__meta-item--grow">
         | 
| 16 16 | 
             
                      <% if meta_items.any? %>
         | 
| 17 17 | 
             
                        <h2 class="<%= brand %>-visually-hidden"><%= meta_items_title %></h2>
         | 
| 18 | 
            -
             | 
| 18 | 
            +
                        <%= content_before_meta_items %>
         | 
| 19 19 | 
             
                        <ul class="<%= brand %>-footer__inline-list">
         | 
| 20 20 | 
             
                          <% @meta_items.each do |hyperlink| %>
         | 
| 21 21 | 
             
                            <li class="<%= brand %>-footer__inline-list-item">
         | 
| @@ -23,6 +23,7 @@ | |
| 23 23 | 
             
                            </li>
         | 
| 24 24 | 
             
                          <% end %>
         | 
| 25 25 | 
             
                        </ul>
         | 
| 26 | 
            +
                        <%= content_after_meta_items %>
         | 
| 26 27 | 
             
                      <% end %>
         | 
| 27 28 |  | 
| 28 29 | 
             
                      <% if meta_content.present? %>
         | 
| @@ -4,8 +4,10 @@ class GovukComponent::FooterComponent < GovukComponent::Base | |
| 4 4 | 
             
              renders_one :meta_html
         | 
| 5 5 | 
             
              renders_one :meta
         | 
| 6 6 | 
             
              renders_one :navigation
         | 
| 7 | 
            +
              renders_one :content_before_meta_items
         | 
| 8 | 
            +
              renders_one :content_after_meta_items
         | 
| 7 9 |  | 
| 8 | 
            -
              attr_reader :meta_items, :meta_text, :meta_items_title, :meta_licence, : | 
| 10 | 
            +
              attr_reader :meta_items, :meta_text, :meta_items_title, :meta_licence, :copyright_text, :copyright_url, :custom_container_classes
         | 
| 9 11 |  | 
| 10 12 | 
             
              def initialize(
         | 
| 11 13 | 
             
                classes: [],
         | 
| @@ -27,7 +29,8 @@ class GovukComponent::FooterComponent < GovukComponent::Base | |
| 27 29 | 
             
                @meta_licence                     = meta_licence
         | 
| 28 30 | 
             
                @custom_meta_classes              = meta_classes
         | 
| 29 31 | 
             
                @custom_meta_html_attributes      = meta_html_attributes
         | 
| 30 | 
            -
                @ | 
| 32 | 
            +
                @copyright_text                   = copyright_text
         | 
| 33 | 
            +
                @copyright_url                    = copyright_url
         | 
| 31 34 | 
             
                @custom_container_classes         = container_classes
         | 
| 32 35 | 
             
                @custom_container_html_attributes = container_html_attributes
         | 
| 33 36 |  | 
| @@ -81,7 +84,7 @@ private | |
| 81 84 | 
             
                raw(%(All content is available under the #{link}, except where otherwise stated))
         | 
| 82 85 | 
             
              end
         | 
| 83 86 |  | 
| 84 | 
            -
              def  | 
| 85 | 
            -
                link_to( | 
| 87 | 
            +
              def copyright
         | 
| 88 | 
            +
                link_to(copyright_text, copyright_url, class: "#{brand}-footer__link #{brand}-footer__copyright-logo")
         | 
| 86 89 | 
             
              end
         | 
| 87 90 | 
             
            end
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            <%= tag.header( | 
| 1 | 
            +
            <%= tag.header(data: { module: "#{brand}-header" }, **html_attributes) do %>
         | 
| 2 2 | 
             
              <%= tag.div(**container_html_attributes) do %>
         | 
| 3 3 | 
             
                <div class="<%= brand %>-header__logo">
         | 
| 4 4 | 
             
                  <%= link_to(homepage_url, class: ["#{brand}-header__link", "#{brand}-header__link--homepage"]) do %>
         | 
| @@ -85,7 +85,7 @@ class GovukComponent::PaginationComponent < GovukComponent::Base | |
| 85 85 | 
             
            private
         | 
| 86 86 |  | 
| 87 87 | 
             
              def default_attributes
         | 
| 88 | 
            -
                {  | 
| 88 | 
            +
                { aria: { label: landmark_label }, class: "#{brand}-pagination" }
         | 
| 89 89 | 
             
              end
         | 
| 90 90 |  | 
| 91 91 | 
             
              def build_previous
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            <%= tag.div(**html_attributes) do %>
         | 
| 2 | 
            -
              <%= tag.h2(title, class: "#{brand}-tabs__title") %>
         | 
| 2 | 
            +
              <%= tag.h2(title, class: "#{brand}-tabs__title") if title %>
         | 
| 3 3 | 
             
              <ul class="<%= brand %>-tabs__list">
         | 
| 4 4 | 
             
                <% tabs.each.with_index do |tab, i| %>
         | 
| 5 5 | 
             
                  <%= tag.li(tab.li_link, class: tab.li_classes(i)) %>
         | 
| @@ -5,7 +5,7 @@ class GovukComponent::TabComponent < GovukComponent::Base | |
| 5 5 |  | 
| 6 6 | 
             
              attr_reader :title, :id
         | 
| 7 7 |  | 
| 8 | 
            -
              def initialize(title | 
| 8 | 
            +
              def initialize(title: 'Contents', id: nil, classes: [], html_attributes: {})
         | 
| 9 9 | 
             
                @title = title
         | 
| 10 10 | 
             
                @id    = id
         | 
| 11 11 |  | 
| @@ -115,14 +115,16 @@ private | |
| 115 115 | 
             
                Rails.logger.warn(controller_warning_message(kwargs.fetch(:controller))) if kwargs.key?(:controller)
         | 
| 116 116 |  | 
| 117 117 | 
             
                button_classes = extract_button_classes(inverse:, secondary:, warning:)
         | 
| 118 | 
            +
                data_attributes = build_data_attributes("#{brand}-button")
         | 
| 118 119 |  | 
| 119 | 
            -
                { **button_classes, **button_attributes(disabled), **new_tab_args(new_tab) }.deep_merge_html_attributes(kwargs)
         | 
| 120 | 
            +
                { **button_classes, **data_attributes, **button_attributes(disabled), **new_tab_args(new_tab) }.deep_merge_html_attributes(kwargs)
         | 
| 120 121 | 
             
              end
         | 
| 121 122 |  | 
| 122 | 
            -
              def extract_button_args(disabled: false, inverse: false, secondary: false, warning: false, **kwargs)
         | 
| 123 | 
            +
              def extract_button_args(disabled: false, inverse: false, secondary: false, warning: false, prevent_double_click: nil, **kwargs)
         | 
| 123 124 | 
             
                button_classes = extract_button_classes(inverse:, secondary:, warning:)
         | 
| 125 | 
            +
                data_attributes = build_data_attributes("#{brand}-button", prevent_double_click:)
         | 
| 124 126 |  | 
| 125 | 
            -
                { **button_classes, **button_attributes(disabled) }.deep_merge_html_attributes(kwargs)
         | 
| 127 | 
            +
                { **button_classes, **data_attributes, **button_attributes(disabled) }.deep_merge_html_attributes(kwargs)
         | 
| 126 128 | 
             
              end
         | 
| 127 129 |  | 
| 128 130 | 
             
              def extract_link_classes(inverse: false, muted: false, no_underline: false, no_visited_state: false, text_colour: false)
         | 
| @@ -183,6 +185,15 @@ private | |
| 183 185 | 
             
              def controller_warning_message(value)
         | 
| 184 186 | 
             
                "controller: '#{value}' parameter detected. Support for old style controller/action links has been removed. See https://github.com/x-govuk/govuk-components/releases/tag/v5.0.0"
         | 
| 185 187 | 
             
              end
         | 
| 188 | 
            +
             | 
| 189 | 
            +
              def build_data_attributes(data_module, prevent_double_click: nil)
         | 
| 190 | 
            +
                {
         | 
| 191 | 
            +
                  data: {
         | 
| 192 | 
            +
                    module: data_module,
         | 
| 193 | 
            +
                    "prevent-double-click": prevent_double_click
         | 
| 194 | 
            +
                  }.compact
         | 
| 195 | 
            +
                }
         | 
| 196 | 
            +
              end
         | 
| 186 197 | 
             
            end
         | 
| 187 198 |  | 
| 188 199 | 
             
            ActiveSupport.on_load(:action_view) { include GovukLinkHelper }
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            module GovukListHelper
         | 
| 2 | 
            +
              def govuk_list(array = nil, type: nil, spaced: nil, classes: nil, html_attributes: {}, &block)
         | 
| 3 | 
            +
                type = type.to_s
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                fail "Unrecognised type for govuk_list - should be :bullet or :number or nil" unless type.in?(["bullet", "number", ""])
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                tag_type = (type == "number") ? "ol" : "ul"
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                html_classes = class_names(
         | 
| 10 | 
            +
                  "#{brand}-list",
         | 
| 11 | 
            +
                  *classes,
         | 
| 12 | 
            +
                  "#{brand}-list--bullet" => (type == "bullet"),
         | 
| 13 | 
            +
                  "#{brand}-list--number" => (type == "number"),
         | 
| 14 | 
            +
                  "#{brand}-list--spaced" => spaced
         | 
| 15 | 
            +
                )
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                if block_given?
         | 
| 18 | 
            +
                  content_tag(tag_type, class: html_classes, **html_attributes, &block)
         | 
| 19 | 
            +
                else
         | 
| 20 | 
            +
                  content_tag(tag_type, class: html_classes, **html_attributes) do
         | 
| 21 | 
            +
                    array.each do |item|
         | 
| 22 | 
            +
                      concat tag.li(item)
         | 
| 23 | 
            +
                    end
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            ActiveSupport.on_load(:action_view) { include GovukListHelper }
         | 
| @@ -44,7 +44,7 @@ module GovukRailsCompatibleLinkHelper | |
| 44 44 | 
             
              def govuk_button_to(name = nil, options = nil, extra_options = {}, &block)
         | 
| 45 45 | 
             
                extra_options = options if block_given?
         | 
| 46 46 | 
             
                html_options = {
         | 
| 47 | 
            -
                  data: { module: " | 
| 47 | 
            +
                  data: { module: "#{brand}-button" }
         | 
| 48 48 | 
             
                }
         | 
| 49 49 |  | 
| 50 50 | 
             
                if extra_options && extra_options[:prevent_double_click]
         | 
    
        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: 5. | 
| 4 | 
            +
              version: 5.3.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - DfE developers
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-04-08 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: html-attributes-utils
         | 
| @@ -34,16 +34,22 @@ dependencies: | |
| 34 34 | 
             
              name: pagy
         | 
| 35 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 36 36 | 
             
                requirements:
         | 
| 37 | 
            -
                - - " | 
| 37 | 
            +
                - - ">="
         | 
| 38 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 39 | 
            +
                    version: '6'
         | 
| 40 | 
            +
                - - "<"
         | 
| 38 41 | 
             
                  - !ruby/object:Gem::Version
         | 
| 39 | 
            -
                    version: ' | 
| 42 | 
            +
                    version: '8'
         | 
| 40 43 | 
             
              type: :runtime
         | 
| 41 44 | 
             
              prerelease: false
         | 
| 42 45 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 43 46 | 
             
                requirements:
         | 
| 44 | 
            -
                - - " | 
| 47 | 
            +
                - - ">="
         | 
| 48 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            +
                    version: '6'
         | 
| 50 | 
            +
                - - "<"
         | 
| 45 51 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version: ' | 
| 52 | 
            +
                    version: '8'
         | 
| 47 53 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 54 | 
             
              name: view_component
         | 
| 49 55 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -53,7 +59,7 @@ dependencies: | |
| 53 59 | 
             
                    version: '3.9'
         | 
| 54 60 | 
             
                - - "<"
         | 
| 55 61 | 
             
                  - !ruby/object:Gem::Version
         | 
| 56 | 
            -
                    version: '3. | 
| 62 | 
            +
                    version: '3.12'
         | 
| 57 63 | 
             
              type: :runtime
         | 
| 58 64 | 
             
              prerelease: false
         | 
| 59 65 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -63,7 +69,7 @@ dependencies: | |
| 63 69 | 
             
                    version: '3.9'
         | 
| 64 70 | 
             
                - - "<"
         | 
| 65 71 | 
             
                  - !ruby/object:Gem::Version
         | 
| 66 | 
            -
                    version: '3. | 
| 72 | 
            +
                    version: '3.12'
         | 
| 67 73 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 68 74 | 
             
              name: deep_merge
         | 
| 69 75 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -126,14 +132,14 @@ dependencies: | |
| 126 132 | 
             
                requirements:
         | 
| 127 133 | 
             
                - - '='
         | 
| 128 134 | 
             
                  - !ruby/object:Gem::Version
         | 
| 129 | 
            -
                    version: 4. | 
| 135 | 
            +
                    version: 4.16.0
         | 
| 130 136 | 
             
              type: :development
         | 
| 131 137 | 
             
              prerelease: false
         | 
| 132 138 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 133 139 | 
             
                requirements:
         | 
| 134 140 | 
             
                - - '='
         | 
| 135 141 | 
             
                  - !ruby/object:Gem::Version
         | 
| 136 | 
            -
                    version: 4. | 
| 142 | 
            +
                    version: 4.16.0
         | 
| 137 143 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 138 144 | 
             
              name: sassc-rails
         | 
| 139 145 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -294,14 +300,14 @@ dependencies: | |
| 294 300 | 
             
                requirements:
         | 
| 295 301 | 
             
                - - "~>"
         | 
| 296 302 | 
             
                  - !ruby/object:Gem::Version
         | 
| 297 | 
            -
                    version: 0. | 
| 303 | 
            +
                    version: 0.27.0
         | 
| 298 304 | 
             
              type: :development
         | 
| 299 305 | 
             
              prerelease: false
         | 
| 300 306 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 301 307 | 
             
                requirements:
         | 
| 302 308 | 
             
                - - "~>"
         | 
| 303 309 | 
             
                  - !ruby/object:Gem::Version
         | 
| 304 | 
            -
                    version: 0. | 
| 310 | 
            +
                    version: 0.27.0
         | 
| 305 311 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 306 312 | 
             
              name: webrick
         | 
| 307 313 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -384,6 +390,7 @@ files: | |
| 384 390 | 
             
            - app/helpers/govuk_components_helper.rb
         | 
| 385 391 | 
             
            - app/helpers/govuk_exit_this_page_link_helper.rb
         | 
| 386 392 | 
             
            - app/helpers/govuk_link_helper.rb
         | 
| 393 | 
            +
            - app/helpers/govuk_list_helper.rb
         | 
| 387 394 | 
             
            - app/helpers/govuk_rails_compatible_link_helper.rb
         | 
| 388 395 | 
             
            - app/helpers/govuk_skip_link_helper.rb
         | 
| 389 396 | 
             
            - app/helpers/govuk_visually_hidden_helper.rb
         |