govuk_publishing_components 21.13.5 → 21.14.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: 113c90c657165b95aed0112c3c892190385c255cb028b664bf29735b4a605a75
4
- data.tar.gz: c104896167741173f9f127096340e9c1753a0112e25e5da40798c48d96873112
3
+ metadata.gz: f3b8b720833271b00598f634fa50424361c265ea3f4bf42cef01184a5b36af26
4
+ data.tar.gz: 6b4a2ae3ee350c4e4a45cbdac9ab04e9412a1c66fb361b05c706fdcca1ba6240
5
5
  SHA512:
6
- metadata.gz: 9300d97c50a83521e395203eb8afbefbaab6eb49c306498f025c5e0359a549bd1116660200802c1f40d567f9e1004ba640f41c43dff9711601784c3385635a17
7
- data.tar.gz: 15e2d799244da0bc626f67033f07fb4901fe0b38799f59aeaadbe0ea023824fd41883a1b1656d145b119593cd6be624fb825c0a12ff37a95a4996049fb0a97f1
6
+ metadata.gz: e7840cdd577f7307231fc74e67aa8e0e0d81e5929fecd0408297e79c82e268a916466633ea8efce01b8f8d0dd8c1f4a73965b761f9d08df9c720334733fd4fe8
7
+ data.tar.gz: 7ebb8a3c9a9442e323955a5b815e97d673e7fbb292da063dc0f14a513c6b91a49cfb418fc293c10149cd9c05002d9b46c5c3250044294b32ce75efd1b66d6d2d
@@ -1,7 +1,10 @@
1
1
  <%
2
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
+
2
4
  text = text || yield
3
5
  describedby ||= nil
4
6
  role ||= nil
7
+ heading_level ||= nil
5
8
  heading_size = false unless ['s', 'm', 'l', 'xl'].include?(heading_size)
6
9
  error_message ||= nil
7
10
  error_id ||= nil
@@ -22,8 +25,17 @@
22
25
  %>
23
26
  <%= tag.div class: css_classes do %>
24
27
  <%= tag.fieldset class: fieldset_classes, aria: { describedby: describedby }, role: role, id: id do %>
25
- <%= tag.legend class: legend_classes do %>
26
- <%= legend_text %>
28
+ <% if heading_level %>
29
+ <%= tag.legend class: legend_classes do %>
30
+ <%= content_tag(
31
+ shared_helper.get_heading_level,
32
+ legend_text,
33
+ class: "govuk-fieldset__heading"
34
+ )
35
+ %>
36
+ <% end %>
37
+ <% else %>
38
+ <%= tag.legend legend_text, class: legend_classes %>
27
39
  <% end %>
28
40
  <% if error_message %>
29
41
  <%= render "govuk_publishing_components/components/error_message", {
@@ -10,60 +10,58 @@ examples:
10
10
  default:
11
11
  data:
12
12
  legend_text: 'Do you have a passport?'
13
- text: |
13
+ block: |
14
14
  <!-- Use the radio component, this is hardcoded only for this example -->
15
- <input type="radio" id="default-yes" name="default">
16
- <label for="default-yes">Yes</label>
15
+ <input type="radio" id="default-yes" name="default">
16
+ <label for="default-yes">Yes</label>
17
17
 
18
- <input type="radio" id="default-no" name="default">
19
- <label for="default-no">No</label>
18
+ <input type="radio" id="default-no" name="default">
19
+ <label for="default-no">No</label>
20
20
  with_id_attribute:
21
21
  data:
22
22
  legend_text: 'Do you have a passport?'
23
23
  id: passports
24
- text: |
24
+ block: |
25
25
  <!-- Use the radio component, this is hardcoded only for this example -->
26
- <input type="radio" id="passport-yes" name="default">
27
- <label for="passport-yes">Yes</label>
26
+ <input type="radio" id="passport-yes" name="default">
27
+ <label for="passport-yes">Yes</label>
28
28
 
29
- <input type="radio" id="passport-no" name="default">
30
- <label for="passport-no">No</label>
31
- with_custom_legend_size:
29
+ <input type="radio" id="passport-no" name="default">
30
+ <label for="passport-no">No</label>
31
+ with_heading:
32
32
  description: Make the legend different sizes. Valid options are 's', 'm', 'l' and 'xl'.
33
33
  data:
34
34
  legend_text: 'Do you have a driving license?'
35
- heading_size: 'l'
36
- text: |
35
+ heading_level: 2
36
+ heading_size: 'm'
37
+ block: |
37
38
  <!-- Use the radio component, this is hardcoded only for this example -->
38
- <input type="radio" id="size-yes" name="default">
39
- <label for="size-yes">Yes</label>
39
+ <input type="radio" id="level-yes" name="default">
40
+ <label for="level-yes">Yes</label>
40
41
 
41
- <input type="radio" id="size-no" name="default">
42
- <label for="size-no">No</label>
43
- with_html_legend:
44
- description: 'If you only have one fieldset on the page you might want to include the title of the page as the legend text. Used with a [captured](http://api.rubyonrails.org/classes/ActionView/Helpers/CaptureHelper.html#method-i-capture) [title](http://components.publishing.service.gov.uk/component-guide/title)'
42
+ <input type="radio" id="level-no" name="default">
43
+ <label for="level-no">No</label>
44
+ with_custom_legend_size:
45
+ description: Make the legend different sizes. Valid options are 's', 'm', 'l' and 'xl'.
45
46
  data:
46
- legend_text: |
47
- <!-- Use the title component, this is hardcoded only for this example -->
48
- <h1 style="font-size: 48px; line-height: 1.0416666667; font-weight: bold; margin: 0 0 30px 0;">
49
- Do you have a passport?
50
- </h1>
51
- text: |
47
+ legend_text: 'Do you have a driving license?'
48
+ heading_size: 'l'
49
+ block: |
52
50
  <!-- Use the radio component, this is hardcoded only for this example -->
53
- <input type="radio" id="html-legend-yes" name="html-legend">
54
- <label for="html-legend-yes">Yes</label>
51
+ <input type="radio" id="size-yes" name="default">
52
+ <label for="size-yes">Yes</label>
55
53
 
56
- <input type="radio" id="html-legend-no" name="html-legend">
57
- <label for="html-legend-no">No</label>
54
+ <input type="radio" id="size-no" name="default">
55
+ <label for="size-no">No</label>
58
56
  with_error_message:
59
57
  description: The component also accepts an error_id, or generates one automatically.
60
58
  data:
61
59
  legend_text: 'Do you have a passport?'
62
60
  error_message: 'Please choose an option'
63
- text: |
61
+ block: |
64
62
  <!-- Use the radio component, this is hardcoded only for this example -->
65
- <input type="radio" id="default2-yes" name="default2">
66
- <label for="default2-yes">Yes</label>
63
+ <input type="radio" id="default2-yes" name="default2">
64
+ <label for="default2-yes">Yes</label>
67
65
 
68
- <input type="radio" id="default2-no" name="default2">
69
- <label for="default2-no">No</label>
66
+ <input type="radio" id="default2-no" name="default2">
67
+ <label for="default2-no">No</label>
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '21.13.5'.freeze
2
+ VERSION = '21.14.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: 21.13.5
4
+ version: 21.14.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: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2019-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters