govuk_publishing_components 36.0.3 → 36.1.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: fca7a5f4a2f77be1b86157531a3f2884b70ebde62cea12c194bad2b29886d121
4
- data.tar.gz: 9e59cd6485f898e8f86f1b2f21022bca130c5d471d2a87afd498be029811a265
3
+ metadata.gz: 2a1b48c8e40b95414bf80c8315e867f24d29686de682e051b3f85cd7ab0a88b2
4
+ data.tar.gz: dcfa431c373237617dbed7ef353377047874cb3ec7778126db4d5000393fdfb6
5
5
  SHA512:
6
- metadata.gz: 00cb71df653b04a54fd700ab26efedde9852421def70e5e4c5e40b8ac3b90828e926aa9311dd526a0c2f2e417ed6dff0d70cd6197beaad702ffd311ac2e05a31
7
- data.tar.gz: e34e2387ad6ef7903892a12090be73aa46c1307749fde8b38338afb7bcda5cd0f987eb675737012dc6f72b715643f14a16d2795a3593ea8671d04a81761eb8a3
6
+ metadata.gz: b35385b4123f674488ea177d7e2761d6f0c8847af76a3e00d932ee0c8bdbb3536c788fd77db99a31a736982204f4140ba1f2667ca957cc73603f6f132846dfc5
7
+ data.tar.gz: f941bbaebaca0c3ed5a91955a1befe12637861b1bde2a65a6c0ef8f65072f27c8d85755452960df8d8913041fef037081faf15fc07780b0eb3c6c644032e3d74
@@ -161,7 +161,7 @@ module GovukPublishingComponents
161
161
  end
162
162
 
163
163
  def clean_file_path(file)
164
- file[/(?<=#{Regexp.escape(@path.to_s)}\/)[\/a-zA-Z_-]+.[a-zA-Z+.]+/]
164
+ file[/(?<=#{Regexp.escape(@path.to_s)}\/)[\/0-9a-zA-Z_-]+.[0-9a-zA-Z+.]+/]
165
165
  end
166
166
 
167
167
  def clean_file_name(name)
@@ -1,6 +1,8 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("file-upload")
3
3
 
4
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
+
4
6
  id ||= "file-upload-#{SecureRandom.hex(4)}"
5
7
  value ||= nil
6
8
  accept ||= nil
@@ -13,6 +15,8 @@
13
15
  has_error = error_message || error_items.any?
14
16
  hint_id = "hint-#{SecureRandom.hex(4)}"
15
17
  error_id = "error-#{SecureRandom.hex(4)}"
18
+ heading_size = false unless shared_helper.valid_heading_size?(heading_size)
19
+ heading_level ||= nil
16
20
 
17
21
  css_classes = %w(gem-c-file-upload govuk-file-upload)
18
22
  css_classes << "govuk-file-upload--error" if has_error
@@ -30,7 +34,20 @@
30
34
 
31
35
  <%= content_tag :div, class: form_group_css_classes do %>
32
36
  <% if label %>
33
- <%= render "govuk_publishing_components/components/label", { html_for: id, text: label[:text] }.merge(label.symbolize_keys) %>
37
+ <% label_markup = capture do %>
38
+ <%= render "govuk_publishing_components/components/label", {
39
+ html_for: id,
40
+ heading_size: heading_size
41
+ }.merge(label.symbolize_keys) %>
42
+ <% end %>
43
+
44
+ <% if heading_level %>
45
+ <%= content_tag(shared_helper.get_heading_level, class: "govuk-label-wrapper") do %>
46
+ <%= label_markup %>
47
+ <% end %>
48
+ <% else %>
49
+ <%= label_markup %>
50
+ <% end %>
34
51
  <% end %>
35
52
 
36
53
  <% if hint %>
@@ -48,3 +48,14 @@ examples:
48
48
  text: "Upload an image"
49
49
  name: "file-upload-specific"
50
50
  accept: "image/*"
51
+ with_label_as_heading:
52
+ description: |
53
+ Wraps the label in a heading tag. Valid options are `1` to `6`. To adjust the size of the label/heading, use the `heading_size` option. Valid options are `s`, `m`, `l` and `xl`.
54
+
55
+ Based on the [heading/label pattern](https://design-system.service.gov.uk/patterns/question-pages/) in the GOV.UK Design System.
56
+ data:
57
+ label:
58
+ text: "This is a heading 1 and a label"
59
+ name: "name"
60
+ heading_level: 1
61
+ heading_size: "l"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "36.0.3".freeze
2
+ VERSION = "36.1.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 36.0.3
4
+ version: 36.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev