govuk_publishing_components 9.20.0 → 9.21.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: b8b733af63849beccb409796dd794bb2593467df0a64cd90d60bfae2909ff3c5
4
- data.tar.gz: 82c6bbb1291172e1ab12572d9bd012444ae2851c882ad597600601178182d870
3
+ metadata.gz: 55ad79f1bb2e0d87fefc7c68af65e712885251ecf110806681bdb8a387e84fac
4
+ data.tar.gz: 61591e06015bcac46ec5646e43a7580f7afa018f88d38bd318cf061c0ada9b1a
5
5
  SHA512:
6
- metadata.gz: 2771e19f937c02e943a8224e6d00955cde020969635d6ef5c271ac4d6d199475ed42a2ca096a7853545c0650f84486cfca9458a732e2d417caaf8b6cceaf8521
7
- data.tar.gz: 5ea10099bc9a63554b0f0d5065b0e3ed6382eff753dac27f09ce75304c25827b233616e2d753fe47d1f2d9367d884e4410c2ee1d387db8045276450e94b57a5b
6
+ metadata.gz: cc27199d7464e20dcf691f0580ffc4304e50c2e4615f185337062fdaab57cd84d791b599cf2ae22141e31505e05eb16fb0e67a293a7834d14fc2e395721c5815
7
+ data.tar.gz: 97da9fd42557e53dc5505f4b5794d9e9e3349ce2b62738a8138f720d2bab7178da11082a7ef7df3e3bf1935272fd5c30e71a3e4a1c900784935a6ffa214ac54b
@@ -18,6 +18,7 @@
18
18
  @import "components/error-summary";
19
19
  @import "components/feedback";
20
20
  @import "components/fieldset";
21
+ @import "components/file-upload";
21
22
  @import "components/govspeak";
22
23
  @import "components/heading";
23
24
  @import "components/highlight-boxes";
@@ -0,0 +1,7 @@
1
+ // This component relies on styles from GOV.UK Frontend
2
+
3
+ // Specify the functions used to resolve assets paths in SCSS
4
+ $govuk-font-url-function: "font-url";
5
+
6
+ @import "../../../../node_modules/govuk-frontend/components/file-upload/file-upload";
7
+ @import "../../../../node_modules/govuk-frontend/objects/form-group";
@@ -3,7 +3,7 @@
3
3
  <%= tag.div class: "gem-c-error-alert", data: { module: "initial-focus" }, role: "alert", tabindex: "-1" do %>
4
4
  <% if description.present? %>
5
5
  <%= tag.h2 message, class: "gem-c-error-summary__title" %>
6
- <%= tag.p description, class: "gem-c-error-summary__body" %>
6
+ <%= tag.div description, class: "gem-c-error-summary__body" %>
7
7
  <% else %>
8
8
  <%= tag.p message, class: "gem-c-error-alert__message" %>
9
9
  <% end %>
@@ -0,0 +1,56 @@
1
+ <%
2
+ id ||= "file-upload-#{SecureRandom.hex(4)}"
3
+ value ||= nil
4
+ accept ||= nil
5
+ data ||= nil
6
+
7
+ label ||= nil
8
+ hint ||= nil
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
12
+
13
+ css_classes = %w(gem-c-file-upload govuk-file-upload)
14
+ css_classes << "govuk-file-upload--error" if error_message
15
+ form_group_css_classes = %w(govuk-form-group)
16
+ form_group_css_classes << "govuk-form-group--error" if error_message
17
+
18
+ aria_described_by ||= nil
19
+ if hint || error_message
20
+ aria_described_by = []
21
+ aria_described_by << hint_id if hint
22
+ aria_described_by << error_message_id if error_message
23
+ aria_described_by = aria_described_by.join(" ")
24
+ end
25
+ %>
26
+
27
+ <%= content_tag :div, class: form_group_css_classes do %>
28
+ <% if label %>
29
+ <%= render "govuk_publishing_components/components/label", { html_for: id, text: label[:text] }.merge(label) %>
30
+ <% end %>
31
+
32
+ <% if hint %>
33
+ <%= render "govuk_publishing_components/components/hint", {
34
+ id: hint_id,
35
+ text: hint
36
+ } %>
37
+ <% end %>
38
+
39
+ <% if error_message %>
40
+ <%= render "govuk_publishing_components/components/error_message", {
41
+ id: error_message_id,
42
+ text: error_message
43
+ } %>
44
+ <% end %>
45
+
46
+ <%= tag.input name: name,
47
+ type: "file",
48
+ value: value,
49
+ class: css_classes,
50
+ id: id,
51
+ data: data,
52
+ accept: accept,
53
+ aria: {
54
+ describedby: aria_described_by
55
+ } %>
56
+ <% end %>
@@ -3,7 +3,7 @@
3
3
  <%= tag.div class: "gem-c-success-alert", data: { module: "initial-focus" }, role: "alert", tabindex: "-1" do %>
4
4
  <% if description.present? %>
5
5
  <%= tag.h2 message, class: "gem-c-success-summary__title" %>
6
- <%= tag.p description, class: "gem-c-success-summary__body" %>
6
+ <%= tag.div description, class: "gem-c-success-summary__body" %>
7
7
  <% else %>
8
8
  <%= tag.p message, class: "gem-c-success-alert__message" %>
9
9
  <% end %>
@@ -0,0 +1,40 @@
1
+ name: Form file upload
2
+ description: Help users select and upload a file
3
+ govuk_frontend_components:
4
+ - file-upload
5
+ accessibility_criteria: |
6
+ The component must:
7
+
8
+ - accept focus
9
+ - be focusable with a keyboard
10
+ - be usable with a keyboard
11
+ - be usable with touch
12
+ - indicate when they have focus
13
+ - be recognisable as input field elements
14
+ - have correctly associated labels
15
+
16
+ Labels use the [label component](/component-guide/label).
17
+ examples:
18
+ default:
19
+ data:
20
+ label:
21
+ text: "Upload a file"
22
+ name: "file-upload"
23
+ with_hint:
24
+ data:
25
+ label:
26
+ text: "Upload a file"
27
+ name: "file-upload-with-hint"
28
+ hint: "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
29
+ with_error:
30
+ data:
31
+ label:
32
+ text: "Upload a file"
33
+ name: "file-upload-with-error"
34
+ error_message: "Please upload a file"
35
+ with_file_accept:
36
+ data:
37
+ label:
38
+ text: "Upload an image"
39
+ name: "file-upload-specific"
40
+ accept: "image/*"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '9.20.0'.freeze
2
+ VERSION = '9.21.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: 9.20.0
4
+ version: 9.21.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-09-10 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -350,6 +350,7 @@ files:
350
350
  - app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss
351
351
  - app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss
352
352
  - app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss
353
+ - app/assets/stylesheets/govuk_publishing_components/components/_file-upload.scss
353
354
  - app/assets/stylesheets/govuk_publishing_components/components/_govspeak-html-publication.scss
354
355
  - app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss
355
356
  - app/assets/stylesheets/govuk_publishing_components/components/_heading.scss
@@ -455,6 +456,7 @@ files:
455
456
  - app/views/govuk_publishing_components/components/_error_summary.html.erb
456
457
  - app/views/govuk_publishing_components/components/_feedback.html.erb
457
458
  - app/views/govuk_publishing_components/components/_fieldset.html.erb
459
+ - app/views/govuk_publishing_components/components/_file_upload.html.erb
458
460
  - app/views/govuk_publishing_components/components/_google_tag_manager_script.html.erb
459
461
  - app/views/govuk_publishing_components/components/_government_navigation.html.erb
460
462
  - app/views/govuk_publishing_components/components/_govspeak.html.erb
@@ -510,6 +512,7 @@ files:
510
512
  - app/views/govuk_publishing_components/components/docs/error_summary.yml
511
513
  - app/views/govuk_publishing_components/components/docs/feedback.yml
512
514
  - app/views/govuk_publishing_components/components/docs/fieldset.yml
515
+ - app/views/govuk_publishing_components/components/docs/file_upload.yml
513
516
  - app/views/govuk_publishing_components/components/docs/google_tag_manager_script.yml
514
517
  - app/views/govuk_publishing_components/components/docs/government_navigation.yml
515
518
  - app/views/govuk_publishing_components/components/docs/govspeak.yml