govuk_publishing_components 12.7.1 → 12.8.0

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: cfdd3079ae3a6f82e937daabce31c39802425c6aacb5a43058c790cf014f3aaa
4
- data.tar.gz: 9cd7474fb49eb06f86aed091092f94d86955c949a7d1b49a277a1c84bcf81bfa
3
+ metadata.gz: a387aeb59072c1b6409f0b54132f6468f45065bca13fc551327ccdb1675d42b1
4
+ data.tar.gz: c3ffb8f5c1d721e27c44206763cffe6f2f1b7d0885451585ac6f7b6502b1db60
5
5
  SHA512:
6
- metadata.gz: 4fd65bf35f92694de070420bf166f0b56981f87898960c6e5c2b7aff92b0874b5f61d5808a7a7036b7dfa60d19aafe8624b5db3f08fb59bf3f061cf1c3b2120d
7
- data.tar.gz: 1bba4aeca78d0bf298999d7ebbc8bb8b0d0d8d9baaf1ed820cb5d40508b0a9702f02c68a966b3727b42a824b473a7e838e21f81e515356dad98091ea31a7ebca
6
+ metadata.gz: 0eb5c5f693e7dcf997ee9255300d344c8432941194954a020c67de631b3650f3511715f4feeeb538ea2f614b6e1bb674e4c5e3bcbfa816206d20b4b1c9b01e55
7
+ data.tar.gz: 8887d46f6cba2359e83ce7fdc092c9b62b43267d4ad5d25c21b548673fcc2d3fe399614a51e2da85e31eb1428118eadf59732eb24df46b368b3fc6a1797e9786
@@ -28,6 +28,7 @@
28
28
  @import "components/feedback";
29
29
  @import "components/fieldset";
30
30
  @import "components/file-upload";
31
+ @import "components/govspeak-html-publication";
31
32
  @import "components/govspeak";
32
33
  @import "components/heading";
33
34
  @import "components/highlight-boxes";
@@ -1,4 +1,5 @@
1
1
  <%
2
+ id ||= "error-summary-#{SecureRandom.hex(4)}"
2
3
  title ||= false
3
4
  description ||= false
4
5
  items ||= []
@@ -13,6 +14,7 @@
13
14
  aria-labelledby="<%= title_id %>"
14
15
  role="alert"
15
16
  tabindex="-1"
17
+ id="<%= id %>"
16
18
  >
17
19
  <% if title %>
18
20
  <h2 class="gem-c-error-summary__title" id="<%= title_id %>">
@@ -7,19 +7,21 @@
7
7
  label ||= nil
8
8
  hint ||= nil
9
9
  error_message ||= nil
10
- hint_id = "hint-#{SecureRandom.hex(4)}" if hint
11
- error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
10
+ error_items ||= nil
11
+ has_error = error_message || error_items&.any?
12
+ hint_id = "hint-#{SecureRandom.hex(4)}"
13
+ error_id = "error-#{SecureRandom.hex(4)}"
12
14
 
13
15
  css_classes = %w(gem-c-file-upload govuk-file-upload)
14
- css_classes << "govuk-file-upload--error" if error_message
16
+ css_classes << "govuk-file-upload--error" if has_error
15
17
  form_group_css_classes = %w(govuk-form-group)
16
- form_group_css_classes << "govuk-form-group--error" if error_message
18
+ form_group_css_classes << "govuk-form-group--error" if has_error
17
19
 
18
20
  aria_described_by ||= nil
19
- if hint || error_message
21
+ if hint || has_error
20
22
  aria_described_by = []
21
23
  aria_described_by << hint_id if hint
22
- aria_described_by << error_message_id if error_message
24
+ aria_described_by << error_id if has_error
23
25
  aria_described_by = aria_described_by.join(" ")
24
26
  end
25
27
  %>
@@ -38,9 +40,14 @@
38
40
 
39
41
  <% if error_message %>
40
42
  <%= render "govuk_publishing_components/components/error_message", {
41
- id: error_message_id,
43
+ id: error_id,
42
44
  text: error_message
43
45
  } %>
46
+ <% elsif error_items %>
47
+ <%= render "govuk_publishing_components/components/error_summary", {
48
+ id: error_id,
49
+ items: error_items
50
+ } %>
44
51
  <% end %>
45
52
 
46
53
  <%= tag.input name: name,
@@ -8,21 +8,23 @@
8
8
  label ||= nil
9
9
  hint ||= nil
10
10
  error_message ||= nil
11
+ error_items ||= nil
11
12
  autofocus ||= nil
12
13
  tabindex ||= nil
13
- hint_id = "hint-#{SecureRandom.hex(4)}" if hint
14
- error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
14
+ has_error = error_message || error_items&.any?
15
+ hint_id = "hint-#{SecureRandom.hex(4)}"
16
+ error_id = "error-#{SecureRandom.hex(4)}"
15
17
 
16
18
  css_classes = %w(gem-c-input govuk-input)
17
- css_classes << "govuk-input--error" if error_message
19
+ css_classes << "govuk-input--error" if has_error
18
20
  form_group_css_classes = %w(govuk-form-group)
19
- form_group_css_classes << "govuk-form-group--error" if error_message
21
+ form_group_css_classes << "govuk-form-group--error" if has_error
20
22
 
21
23
  aria_described_by ||= nil
22
- if hint || error_message || describedby
24
+ if hint || has_error || describedby
23
25
  aria_described_by = []
24
26
  aria_described_by << hint_id if hint
25
- aria_described_by << error_message_id if error_message
27
+ aria_described_by << error_id if has_error
26
28
  aria_described_by << describedby if describedby
27
29
  aria_described_by = aria_described_by.join(" ")
28
30
  end
@@ -45,9 +47,14 @@
45
47
 
46
48
  <% if error_message %>
47
49
  <%= render "govuk_publishing_components/components/error_message", {
48
- id: error_message_id,
50
+ id: error_id,
49
51
  text: error_message
50
52
  } %>
53
+ <% elsif error_items %>
54
+ <%= render "govuk_publishing_components/components/error_summary", {
55
+ id: error_id,
56
+ items: error_items
57
+ } %>
51
58
  <% end %>
52
59
 
53
60
  <%= tag.input name: name,
@@ -5,11 +5,13 @@
5
5
  label ||= nil
6
6
  hint ||= nil
7
7
  error_message ||= nil
8
- hint_id = "hint-#{SecureRandom.hex(4)}" if hint
9
- error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
8
+ error_items ||= nil
9
+ has_error = error_message || error_items&.any?
10
+ hint_id = "hint-#{SecureRandom.hex(4)}"
11
+ error_id = "error-#{SecureRandom.hex(4)}"
10
12
 
11
13
  form_group_css_classes = %w(govuk-form-group)
12
- form_group_css_classes << "govuk-form-group--error" if error_message
14
+ form_group_css_classes << "govuk-form-group--error" if has_error
13
15
 
14
16
  # check if any item is set as being conditional
15
17
  has_conditional = items.any? { |item| item.is_a?(Hash) && item[:conditional] }
@@ -25,9 +27,14 @@
25
27
 
26
28
  <% if error_message %>
27
29
  <%= render "govuk_publishing_components/components/error_message", {
28
- id: error_message_id,
30
+ id: error_id,
29
31
  text: error_message
30
32
  } %>
33
+ <% elsif error_items %>
34
+ <%= render "govuk_publishing_components/components/error_summary", {
35
+ id: error_id,
36
+ items: error_items
37
+ } %>
31
38
  <% end %>
32
39
 
33
40
  <%= content_tag :div, class: "govuk-radios",
@@ -8,21 +8,23 @@
8
8
  label ||= nil
9
9
  hint ||= nil
10
10
  error_message ||= nil
11
+ error_items ||= nil
11
12
  character_count ||= nil
12
- hint_id = "hint-#{SecureRandom.hex(4)}" if hint
13
- error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
13
+ hint_id = "hint-#{SecureRandom.hex(4)}"
14
+ has_error ||= error_message || error_items&.any?
15
+ error_id = "error-#{SecureRandom.hex(4)}"
14
16
 
15
17
  css_classes = %w(gem-c-textarea govuk-textarea)
16
18
  css_classes << "js-character-count" if character_count
17
- css_classes << "govuk-textarea--error" if error_message
19
+ css_classes << "govuk-textarea--error" if has_error
18
20
  form_group_css_classes = %w(govuk-form-group)
19
- form_group_css_classes << "govuk-form-group--error" if error_message
21
+ form_group_css_classes << "govuk-form-group--error" if has_error
20
22
 
21
23
  aria_described_by ||= nil
22
- if hint || error_message
24
+ if hint || has_error
23
25
  aria_described_by = []
24
26
  aria_described_by << hint_id if hint
25
- aria_described_by << error_message_id if error_message
27
+ aria_described_by << error_id if has_error
26
28
  aria_described_by = aria_described_by.join(" ")
27
29
  end
28
30
  %>
@@ -41,9 +43,14 @@
41
43
 
42
44
  <% if error_message %>
43
45
  <%= render "govuk_publishing_components/components/error_message", {
44
- id: error_message_id,
46
+ id: error_id,
45
47
  text: error_message
46
48
  } %>
49
+ <% elsif error_items %>
50
+ <%= render "govuk_publishing_components/components/error_summary", {
51
+ id: error_id,
52
+ items: error_items
53
+ } %>
47
54
  <% end %>
48
55
 
49
56
  <%= tag.textarea name: name,
@@ -8,6 +8,7 @@ shared_accessibility_criteria:
8
8
  examples:
9
9
  default:
10
10
  data:
11
+ id: error-summary
11
12
  title: Message to alert the user to a problem goes here
12
13
  description: Optional description of the errors and how to correct them
13
14
  items:
@@ -32,6 +32,14 @@ examples:
32
32
  text: "Upload a file"
33
33
  name: "file-upload-with-error"
34
34
  error_message: "Please upload a file"
35
+ with_error_items:
36
+ data:
37
+ label:
38
+ text: "Upload a file"
39
+ name: "file-upload-with-error"
40
+ error_items:
41
+ - text: Descriptive link to the question with an error 1
42
+ href: '#example-error-1'
35
43
  with_file_accept:
36
44
  data:
37
45
  label:
@@ -52,6 +52,14 @@ examples:
52
52
  text: "What is your name?"
53
53
  name: "name"
54
54
  error_message: "Please could you provide your name"
55
+ with_error_items:
56
+ data:
57
+ label:
58
+ text: "What is your name?"
59
+ name: "name"
60
+ error_items:
61
+ - text: Descriptive link to the question with an error 1
62
+ href: '#example-error-1'
55
63
  with_value:
56
64
  data:
57
65
  label:
@@ -140,6 +140,18 @@ examples:
140
140
  text: "Use Government Gateway"
141
141
  - value: "govuk-verify"
142
142
  text: "Use GOV.UK Verify"
143
+ with_error_items_on_form_group:
144
+ data:
145
+ name: "radio-group-error"
146
+ id_prefix: "error"
147
+ error_items:
148
+ - text: Descriptive link to the question with an error 1
149
+ href: '#example-error-1'
150
+ items:
151
+ - value: "government-gateway"
152
+ text: "Use Government Gateway"
153
+ - value: "govuk-verify"
154
+ text: "Use GOV.UK Verify"
143
155
  conditional:
144
156
  data:
145
157
  name: "radio-group-conditional"
@@ -39,6 +39,14 @@ examples:
39
39
  text: "Can you provide more detail?"
40
40
  name: "more-detail-error"
41
41
  error_message: "Please could you provide more detail"
42
+ with_error_items:
43
+ data:
44
+ label:
45
+ text: "Can you provide more detail?"
46
+ name: "more-detail-error"
47
+ error_items:
48
+ - text: Descriptive link to the question with an error 1
49
+ href: '#example-error-1'
42
50
  with_value:
43
51
  data:
44
52
  label:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '12.7.1'.freeze
2
+ VERSION = '12.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.7.1
4
+ version: 12.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2018-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config