govuk-components 1.1.2 → 1.1.7

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: d3430369791dc162f3624dbd60986f511ab6d01134c26458f66c26229da1a104
4
- data.tar.gz: b10aa6ae0151000e95f205b48125a5def70ff0a44824887503a1719a1f7c101b
3
+ metadata.gz: 8fa9844129aad4b89c9845af6db1fbd942d0bde94823f891f65164163b935295
4
+ data.tar.gz: 962375a05bc998a2b5caf5e3eeccb2a7f12a8dd120e8054857e79128287d3b8f
5
5
  SHA512:
6
- metadata.gz: cef1afe63eb5b9532db2c29e86d20fbf36373bdba14b8f9833e8fa770b8ca2029736bed2709bc89843fd41dd9e862c038992992a8101ae9562ff06d4f4e79523
7
- data.tar.gz: 1040a0ad99e2946e32f88d985685abd167aecd0ae325c9fb4fc81ce20ecc6c832f551e4a03e1d22ec32eaafbdb9c741740c0a1e4473eb67dc9a3452ab6fad857
6
+ metadata.gz: '048424bb98e6ed1ba126dfa971310ffa8b61629aea7394c1da291eeaa0c9bf31b1d1d547d190bcf8e31ce17f13b8b9d501bb8e9ccd01e2ba5c3a2f9444b6693d'
7
+ data.tar.gz: 4c30a89b2f53b0cdcc869ae766182249f7d0c34b2c81c507c8ae6835344cc2b734b065ada162643a1ad15cb701d5af2445abec5173a400470c5cf458f28146ba
@@ -1,15 +1,20 @@
1
1
  class GovukComponent::Breadcrumbs < GovukComponent::Base
2
2
  attr_accessor :breadcrumbs
3
3
 
4
- def initialize(breadcrumbs:, classes: [], html_attributes: {})
4
+ def initialize(breadcrumbs:, hide_in_print: false, collapse_on_mobile: false, classes: [], html_attributes: {})
5
5
  super(classes: classes, html_attributes: html_attributes)
6
6
 
7
- @breadcrumbs = breadcrumbs
7
+ @breadcrumbs = breadcrumbs
8
+ @hide_in_print = hide_in_print
9
+ @collapse_on_mobile = collapse_on_mobile
8
10
  end
9
11
 
10
12
  private
11
13
 
12
14
  def default_classes
13
- %w(govuk-breadcrumbs)
15
+ %w(govuk-breadcrumbs).tap do |classes|
16
+ classes << "govuk-!-display-none-print" if @hide_in_print
17
+ classes << "govuk-breadcrumbs--collapse-on-mobile" if @collapse_on_mobile
18
+ end
14
19
  end
15
20
  end
@@ -5,6 +5,6 @@
5
5
  </span>
6
6
  </summary>
7
7
  <div class="govuk-details__text">
8
- <%= @description || content %>
8
+ <%= content.presence || @description %>
9
9
  </div>
10
10
  <% end %>
@@ -12,6 +12,15 @@
12
12
  </span>
13
13
  </span>
14
14
  </a>
15
+ <% if @product_name.present? %>
16
+ <span class="govuk-header__product-name">
17
+ <%= @product_name %>
18
+ </span>
19
+ <% end %>
20
+
21
+ <% if product_description.present? %>
22
+ <%= product_description.content %>
23
+ <% end %>
15
24
  </div>
16
25
  <div class="govuk-header__content">
17
26
  <% if @service_name.present? %>
@@ -1,18 +1,22 @@
1
1
  class GovukComponent::Header < GovukComponent::Base
2
2
  include ViewComponent::Slotable
3
3
 
4
- attr_accessor :logo, :logo_href, :service_name, :service_name_href
4
+ attr_accessor :logo, :logo_href, :service_name, :service_name_href, :product_name
5
5
 
6
6
  with_slot :item, collection: true, class_name: 'Item'
7
7
  wrap_slot :item
8
8
 
9
- def initialize(logo: 'GOV.UK', logo_href: '/', service_name: nil, service_name_href: '/', classes: [], html_attributes: {})
9
+ with_slot :product_description
10
+ wrap_slot :product_description
11
+
12
+ def initialize(logo: 'GOV.UK', logo_href: '/', service_name: nil, service_name_href: '/', product_name: nil, classes: [], html_attributes: {})
10
13
  super(classes: classes, html_attributes: html_attributes)
11
14
 
12
15
  @logo = logo
13
16
  @logo_href = logo_href
14
17
  @service_name = service_name
15
18
  @service_name_href = service_name_href
19
+ @product_name = product_name
16
20
  end
17
21
 
18
22
  private
@@ -1,14 +1,18 @@
1
1
  class GovukComponent::InsetText < GovukComponent::Base
2
2
  attr_accessor :text
3
3
 
4
- def initialize(text:, classes: [], html_attributes: {})
4
+ def initialize(text: nil, classes: [], html_attributes: {})
5
5
  super(classes: classes, html_attributes: html_attributes)
6
6
 
7
7
  @text = text
8
8
  end
9
9
 
10
10
  def call
11
- tag.div(class: classes, **html_attributes) { @text }
11
+ tag.div(class: classes, **html_attributes) { content.presence || @text }
12
+ end
13
+
14
+ def render?
15
+ @text.present? || content.present?
12
16
  end
13
17
 
14
18
  private
@@ -24,7 +24,7 @@ class GovukComponent::NotificationBanner < GovukComponent::Base
24
24
  end
25
25
 
26
26
  def render?
27
- headings.any?
27
+ headings.any? || content.present?
28
28
  end
29
29
 
30
30
  def title_tag
@@ -1,9 +1,13 @@
1
1
  <%= tag.div(class: classes, **html_attributes) do %>
2
- <h1 class="govuk-panel__title">
3
- <%= @title %>
4
- </h1>
2
+ <% if display_title? %>
3
+ <h1 class="govuk-panel__title">
4
+ <%= @title %>
5
+ </h1>
6
+ <% end %>
5
7
 
6
- <div class="govuk-panel__body">
7
- <%= @body %>
8
- </div>
8
+ <% if display_body? %>
9
+ <div class="govuk-panel__body">
10
+ <%= content.presence || @body %>
11
+ </div>
12
+ <% end %>
9
13
  <% end %>
@@ -1,7 +1,7 @@
1
1
  class GovukComponent::Panel < GovukComponent::Base
2
2
  attr_accessor :title, :body
3
3
 
4
- def initialize(title:, body:, classes: [], html_attributes: {})
4
+ def initialize(title: nil, body: nil, classes: [], html_attributes: {})
5
5
  super(classes: classes, html_attributes: html_attributes)
6
6
 
7
7
  @title = title
@@ -13,4 +13,16 @@ private
13
13
  def default_classes
14
14
  %w(govuk-panel govuk-panel--confirmation)
15
15
  end
16
+
17
+ def display_title?
18
+ @title.present?
19
+ end
20
+
21
+ def display_body?
22
+ [@body, content].any?(&:present?)
23
+ end
24
+
25
+ def render?
26
+ display_title? || display_body?
27
+ end
16
28
  end
@@ -1,10 +1,8 @@
1
1
  <%= tag.div(class: classes, **html_attributes) do %>
2
2
  <p class="govuk-phase-banner__content">
3
- <strong class="govuk-tag govuk-phase-banner__content__tag">
4
- <%= @phase %>
5
- </strong>
3
+ <%= render(phase_tag) %>
6
4
  <span class="govuk-phase-banner__text">
7
- <%= @text || content %>
5
+ <%= content.presence || @text %>
8
6
  </span>
9
7
  </p>
10
8
  <% end %>
@@ -1,11 +1,11 @@
1
1
  class GovukComponent::PhaseBanner < GovukComponent::Base
2
- attr_accessor :phase, :text
2
+ attr_accessor :phase_tag, :text
3
3
 
4
- def initialize(phase:, text: nil, classes: [], html_attributes: {})
4
+ def initialize(phase_tag: nil, text: nil, classes: [], html_attributes: {})
5
5
  super(classes: classes, html_attributes: html_attributes)
6
6
 
7
- @phase = phase
8
- @text = text
7
+ @phase_tag = GovukComponent::Tag.new(classes: "govuk-phase-banner__content__tag", **phase_tag)
8
+ @text = text
9
9
  end
10
10
 
11
11
  private
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '1.1.2'.freeze
3
+ VERSION = '1.1.7'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-02 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,25 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: view_component
28
+ name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 2.22.1
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 2.27.0
33
+ version: '6.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
- version: 2.22.1
44
- - - "<"
40
+ version: '6.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: view_component
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.20'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
45
53
  - !ruby/object:Gem::Version
46
- version: 2.27.0
54
+ version: '2.20'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: capybara
49
57
  requirement: !ruby/object:Gem::Requirement
@@ -215,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
223
  - !ruby/object:Gem::Version
216
224
  version: '0'
217
225
  requirements: []
218
- rubygems_version: 3.1.2
226
+ rubygems_version: 3.1.4
219
227
  signing_key:
220
228
  specification_version: 4
221
229
  summary: Lightweight set of reusable GOV.UK Design System components