govuk-components 3.1.3 → 3.2.0b1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d96973745655e46c089832c7bf7045995f5026ad65acacebba3b2eaaec72ba8
4
- data.tar.gz: bdf4bd50011bf68cba44cd4df794ed59988154bd204461f0630433f55a23a55a
3
+ metadata.gz: baf575169df70b76806ee48f46c1043b2923df01f0f03c60fe80b6a2ed7b2e47
4
+ data.tar.gz: 9cfdb4dc1d0fbd2e1bed77df6efc633f2f1a33ee068664e1562e523e4088f761
5
5
  SHA512:
6
- metadata.gz: 977b348a414cf49fb9e7fd59022ff60698175a50da1489e44b0c84db0d5bf1dff5b8e6035bade8e1a3d3cc7089c98c52fcae4bda995c1a912460efa9f6c3f6dd
7
- data.tar.gz: 05fb69a77e3441634eb377d15a7a271ce945e0f27701f1fb8d1073acf8af678ab9fcacc479e328cf2ad171b2b2fcea06294048a218e03d47281de543d164d2be
6
+ metadata.gz: e27fccc13b9c2d7d590f75f0617037ad9be59598d38a7422d7b93e61ec5c1ca021b31f8bf4ad075ebe9e3869038cff7696e19c119398c7aa58890a585e1e976c
7
+ data.tar.gz: 55d4ac92ddab808a1c33d360172f318bf56eb801c0b44532920c1b91f57efe7d625cf0ab31828443c96e1568d59eb8909f44cc290093f823a3e6c4b6be69d7bd
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Gem](https://img.shields.io/gem/dt/govuk-components?logo=rubygems)](https://rubygems.org/gems/govuk-components)
7
7
  [![Test Coverage](https://api.codeclimate.com/v1/badges/cbcbc140f300b920d833/test_coverage)](https://codeclimate.com/github/DFE-Digital/govuk-components/test_coverage)
8
8
  [![GitHub license](https://img.shields.io/github/license/DFE-Digital/govuk-components)](https://github.com/DFE-Digital/govuk-components/blob/main/LICENSE)
9
- [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-4.2.0-brightgreen)](https://design-system.service.gov.uk)
9
+ [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-4.3.0-brightgreen)](https://design-system.service.gov.uk)
10
10
  [![Rails](https://img.shields.io/badge/Rails-6.1.5%20%E2%95%B1%207.0.3-E16D6D)](https://weblog.rubyonrails.org/releases/)
11
11
  [![Ruby](https://img.shields.io/badge/Ruby-2.7.5%20%20%E2%95%B1%203.0.3%20%20%E2%95%B1%203.1.2-E16D6D)](https://www.ruby-lang.org/en/downloads/)
12
12
 
@@ -14,6 +14,15 @@ This gem provides a suite of reusable components for the [GOV.UK Design System](
14
14
 
15
15
  It aims to implement the functionality from the original Nunjucks macros in a way that will feel more familiar to Rails developers. Blocks are preferred over strings of HTML, beneath the surface each component is just a Ruby object, everything is inheritable and overrideable.
16
16
 
17
+ ## Documentation
18
+
19
+ The gem comes with [a full guide](https://govuk-components.netlify.app/) that
20
+ covers most aspects of day-to-day use, along with code and output examples. The
21
+ examples in the guide (and the guide itself) are built using the components,
22
+ so it will always be up to date.
23
+
24
+ [![Netlify Status](https://api.netlify.com/api/v1/badges/d40a5a0a-b086-4c35-b046-97fbcbf9f219/deploy-status)](https://app.netlify.com/sites/govuk-components/deploys)
25
+
17
26
  ## What’s included?
18
27
 
19
28
  All of the non-form components from the GOV.UK Design System are implemented by this library as ViewComponents. Form components are implemented by the [GOV.UK Form Builder](https://govuk-form-builder.netlify.app/).
@@ -28,7 +28,7 @@ private
28
28
  when Hash
29
29
  breadcrumbs.map { |text, link| build_list_item(text, link) }
30
30
  else
31
- fail(ArgumentError, "breadcrumb must be an array or hash")
31
+ fail(ArgumentError, "breadcrumbs must be an array or hash")
32
32
  end
33
33
  end
34
34
 
@@ -65,9 +65,14 @@ private
65
65
  def build_meta_links(links)
66
66
  return [] if links.blank?
67
67
 
68
- fail(ArgumentError, 'meta links must be a hash') unless links.is_a?(Hash)
69
-
70
- links.map { |text, href| raw(link_to(text, href, class: %w(govuk-footer__link))) }
68
+ case links
69
+ when Array
70
+ links.map { |link| raw(link_to(link[:text], link[:href], class: %w(govuk-footer__link), **link.fetch(:attr, {}))) }
71
+ when Hash
72
+ links.map { |text, href| raw(link_to(text, href, class: %w(govuk-footer__link))) }
73
+ else
74
+ fail(ArgumentError, 'meta links must be a hash or array of hashes') unless links.is_a?(Hash)
75
+ end
71
76
  end
72
77
 
73
78
  def default_licence
@@ -37,7 +37,7 @@
37
37
 
38
38
  <% if navigation_items.any? %>
39
39
  <%= tag.nav(**navigation_html_attributes) do %>
40
- <%= tag.button("Menu", type: "button", class: %w(govuk-header__menu-button govuk-js-header-toggle), aria: { controls: "navigation", label: menu_button_label }) %>
40
+ <%= tag.button("Menu", type: "button", class: %w(govuk-header__menu-button govuk-js-header-toggle), hidden: true, aria: { controls: "navigation", label: menu_button_label }) %>
41
41
  <ul id="navigation" class="govuk-header__navigation-list">
42
42
  <% navigation_items.each do |item| %>
43
43
  <%= item %>
@@ -105,6 +105,7 @@ private
105
105
 
106
106
  def active?
107
107
  return @active_override unless @active_override.nil?
108
+ return false if href.blank?
108
109
 
109
110
  current_page?(href)
110
111
  end
@@ -56,11 +56,7 @@ module GovukLinkHelper
56
56
  html_options = build_html_options(extra_options, style: :button)
57
57
 
58
58
  if block_given?
59
- if Rails.version >= "7.0.0" && name.is_a?(Hash)
60
- button_to(name.merge(html_options), &block)
61
- else
62
- button_to(name, html_options, &block)
63
- end
59
+ button_to(options, html_options, &block)
64
60
  else
65
61
  button_to(name, options, html_options)
66
62
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '3.1.3'.freeze
3
+ VERSION = '3.2.0b1'.freeze
4
4
  end
5
5
  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: 3.1.3
4
+ version: 3.2.0b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-05 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -260,14 +260,14 @@ dependencies:
260
260
  requirements:
261
261
  - - "~>"
262
262
  - !ruby/object:Gem::Version
263
- version: 3.29.0
263
+ version: 3.30.0
264
264
  type: :development
265
265
  prerelease: false
266
266
  version_requirements: !ruby/object:Gem::Requirement
267
267
  requirements:
268
268
  - - "~>"
269
269
  - !ruby/object:Gem::Version
270
- version: 3.29.0
270
+ version: 3.30.0
271
271
  - !ruby/object:Gem::Dependency
272
272
  name: rubypants
273
273
  requirement: !ruby/object:Gem::Requirement
@@ -360,7 +360,6 @@ executables: []
360
360
  extensions: []
361
361
  extra_rdoc_files: []
362
362
  files:
363
- - MIT-LICENSE
364
363
  - README.md
365
364
  - Rakefile
366
365
  - app/components/govuk_component.rb
@@ -439,9 +438,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
439
438
  version: '0'
440
439
  required_rubygems_version: !ruby/object:Gem::Requirement
441
440
  requirements:
442
- - - ">="
441
+ - - ">"
443
442
  - !ruby/object:Gem::Version
444
- version: '0'
443
+ version: 1.3.1
445
444
  requirements: []
446
445
  rubygems_version: 3.1.6
447
446
  signing_key:
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2020 Peter Yates
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.