govuk-components 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 803f46227b24a4b94f6c9a18dba4040b95de1248ec04711fdba577848ed69d9c
4
- data.tar.gz: 05d27bec17047ccf6dbb45b9e7bd2d7d5986dad4edb8724c3a144139d5e03baa
3
+ metadata.gz: 8ea92186b060054ebbab68352b115d86c1a051ac637fa6cb2baf16299a0e1c9e
4
+ data.tar.gz: 4e230e506c271f6c905ae11f1b9703449d9cff10385b9722643865b55e135377
5
5
  SHA512:
6
- metadata.gz: 6a3b59c877f5dd616144faca5585a4a8c7750d78f7398f3424de98f4096af2e30c70aaa9fa3b959de294a064bdaeee55560aac2c0a43c135ee76ce6f5b92397e
7
- data.tar.gz: '00668905d6bb618e00f3c61283b74d093d978c33c55d2e5fd0723bf3ac002d52e8ee6ec2b4a409f02e81ec89f2342afe15fda0cc8245468a06c66a7365e69862'
6
+ metadata.gz: ad1b1774616a6345aacda5a61d92d7a11f4074d72eb00a86f055db0ad1d77f98485b843892d1f482fa231513f9a163b01bbb54e07b5be44e58e0c8884a6cf8a3
7
+ data.tar.gz: 773ab4a3aa83dc5eff40e946ceea1a9fda5d414cbabcaf8bd3838140cc0525ea97b151b3d7b98bca6e638be820ee7b133cd8a9089c8b7dce2485a9319866bcac
@@ -3,7 +3,7 @@ class GovukComponent::AccordionComponent < GovukComponent::Base
3
3
  GovukComponent::AccordionComponent::SectionComponent.new(
4
4
  classes: classes,
5
5
  expanded: expanded,
6
- heading_level: heading_level, # set once at parent level, passed to all children
6
+ heading_level: heading_level, # set once at parent level, passed to all children
7
7
  html_attributes: html_attributes,
8
8
  summary_text: summary_text,
9
9
  heading_text: heading_text,
@@ -23,7 +23,7 @@ private
23
23
 
24
24
  def initialize(label:, text: nil, classes: [], html_attributes: {})
25
25
  @label = label
26
- @text = text
26
+ @text = h(text)
27
27
 
28
28
  super(classes: classes, html_attributes: html_attributes)
29
29
  end
@@ -1,10 +1,11 @@
1
1
  module GovukComponent
2
2
  class TaskListComponent::ItemComponent < GovukComponent::Base
3
- renders_one :status, ->(text: nil, classes: [], html_attributes: {}, &block) do
3
+ renders_one :status, ->(text: nil, cannot_start_yet: false, classes: [], html_attributes: {}, &block) do
4
4
  GovukComponent::TaskListComponent::StatusComponent.new(
5
5
  id_prefix: @id_prefix,
6
6
  count: @count,
7
7
  text: text,
8
+ cannot_start_yet: cannot_start_yet,
8
9
  classes: classes,
9
10
  html_attributes: html_attributes,
10
11
  &block
@@ -39,6 +40,10 @@ module GovukComponent
39
40
  end
40
41
 
41
42
  def call
43
+ if href.presence && status_content.cannot_start_yet
44
+ fail(ArgumentError, "item cannot have a href with status where cannot_start_yet: true")
45
+ end
46
+
42
47
  adjusted_html_attributes = if href.present? || title&.href.present?
43
48
  html_attributes_with_link_class
44
49
  else
@@ -1,11 +1,12 @@
1
1
  module GovukComponent
2
2
  class TaskListComponent::StatusComponent < GovukComponent::Base
3
- attr_reader :id_prefix, :text, :count
3
+ attr_reader :id_prefix, :text, :cannot_start_yet, :count
4
4
 
5
- def initialize(text: nil, id_prefix: nil, count: nil, classes: [], html_attributes: {})
6
- @text = text
7
- @count = count
8
- @id_prefix = id_prefix
5
+ def initialize(text: nil, id_prefix: nil, count: nil, cannot_start_yet: false, classes: [], html_attributes: {})
6
+ @text = text
7
+ @count = count
8
+ @id_prefix = id_prefix
9
+ @cannot_start_yet = cannot_start_yet
9
10
 
10
11
  super(classes: classes, html_attributes: html_attributes)
11
12
  end
@@ -21,7 +22,13 @@ module GovukComponent
21
22
  private
22
23
 
23
24
  def default_attributes
24
- { class: %w(govuk-task-list__status), id: [id_prefix, count, "status"].compact.join("-") }
25
+ {
26
+ class: class_names(
27
+ "govuk-task-list__status",
28
+ "govuk-task-list__status--cannot-start-yet" => cannot_start_yet,
29
+ ),
30
+ id: [id_prefix, count, "status"].compact.join("-"),
31
+ }
25
32
  end
26
33
 
27
34
  def status_text
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '5.0.1'.freeze
3
+ VERSION = '5.0.2'.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: 5.0.1
4
+ version: 5.0.2
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-12-21 00:00:00.000000000 Z
11
+ date: 2024-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -50,20 +50,20 @@ dependencies:
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: '3.3'
53
+ version: '3.9'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '3.9'
56
+ version: '3.10'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: '3.3'
63
+ version: '3.9'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '3.9'
66
+ version: '3.10'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: deep_merge
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -126,14 +126,14 @@ dependencies:
126
126
  requirements:
127
127
  - - '='
128
128
  - !ruby/object:Gem::Version
129
- version: 4.12.0
129
+ version: 4.13.0
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - '='
135
135
  - !ruby/object:Gem::Version
136
- version: 4.12.0
136
+ version: 4.13.0
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: sassc-rails
139
139
  requirement: !ruby/object:Gem::Requirement