govuk_publishing_components 9.16.1 → 9.17

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: 5cd424c3c2aa6fc31e7f9f582556cfd084a835cb539889f92e898f409def0926
4
- data.tar.gz: 1869d558b4ac733e50c56bacbc2eaa1825d9f2439eb27a18d232e2e74c7bc14b
3
+ metadata.gz: ec89233d9f7da4f9dcdb946c1645fa062512e48904759fa21a4f16960672ef1f
4
+ data.tar.gz: f0c9c9973d0b38994c7f3f03768f71edd5b62bbd6a6ce5dd4d2b6670b34a5506
5
5
  SHA512:
6
- metadata.gz: 4cbb54d78eae8f05c56e8f7f5a84f14a6d9c1a240eb083ad92101599408e8581a4a8a28384313a592a08f063a3a478a6bbc05cf257d20dcb179ef2686cbd78f7
7
- data.tar.gz: 77a079982ca721df47434317d32ef49715ccd76718f3bf73d7533a8b6cf0572d095ea149277896dafd9b39bee590421e17054149d744cbd15e385136d9c3733f
6
+ metadata.gz: 92118daef28751e5bfaf15995976ccc15aca0beafe5ad1bc4a9cd11de2e0d63c6ca250fd17a6f75d5b8a9f8605334d5a32f730ec8c9d8adb16f6b51468b95a41
7
+ data.tar.gz: 7cccc89992dd48e17f8f00bcc8f0631bc0b500ebd69050a0736adae3771e8596865f0fd3564c674ffb22178ff62f7a89b3c756ebc4510c65c80eac75373d6dbb
@@ -0,0 +1,19 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (global, GOVUK) {
5
+ 'use strict'
6
+
7
+ GOVUK.Modules.CopyToClipboard = function () {
8
+ this.start = function (element) {
9
+ var copyButton = element[0].querySelector('.gem-c-button')
10
+
11
+ copyButton.addEventListener('click', function (event) {
12
+ event.preventDefault()
13
+ var input = element[0].querySelector('.gem-c-input')
14
+ input.select()
15
+ document.execCommand('copy')
16
+ })
17
+ }
18
+ }
19
+ })(window, window.GOVUK)
@@ -13,6 +13,7 @@
13
13
  @import "components/breadcrumbs";
14
14
  @import "components/button";
15
15
  @import "components/contents-list";
16
+ @import "components/copy-to-clipboard";
16
17
  @import "components/document-list";
17
18
  @import "components/error-summary";
18
19
  @import "components/feedback";
@@ -0,0 +1 @@
1
+ // No styles, this component just uses subcomponents
@@ -13,6 +13,21 @@
13
13
  @include bold-19;
14
14
  }
15
15
 
16
+ .gem-c-success-summary__title {
17
+ margin-top: 0;
18
+ margin-bottom: $gem-spacing-scale-3;
19
+
20
+ @include media(tablet) {
21
+ margin-bottom: $gem-spacing-scale-4;
22
+ }
23
+
24
+ @include bold-24;
25
+ }
26
+
27
+ .gem-c-success-summary__body {
28
+ @include core-19;
29
+ }
30
+
16
31
  .gem-c-success-alert:focus {
17
32
  outline: $gem-focus-width solid $gem-focus-colour;
18
33
  }
@@ -0,0 +1,14 @@
1
+ <div class="gem-c-copy-to-clipboard" data-module="copy-to-clipboard">
2
+ <%= render "govuk_publishing_components/components/input", {
3
+ label: {
4
+ text: label,
5
+ },
6
+ name: SecureRandom.hex,
7
+ value: copyable_content
8
+ } %>
9
+
10
+ <%= render "govuk_publishing_components/components/button", {
11
+ text: button_text,
12
+ secondary_quiet: true,
13
+ } %>
14
+ </div>
@@ -1,6 +1,11 @@
1
1
  <%
2
2
  gtm_auth ||= nil
3
3
  gtm_preview ||= nil
4
+
5
+ gtm_attributes = %w(gtm_cookies_win=x)
6
+ gtm_attributes << "gtm_auth=" + gtm_auth if gtm_auth
7
+ gtm_attributes << "gtm_preview=" + gtm_preview if gtm_preview
8
+ gtm_attributes = gtm_attributes.join('&')
4
9
  %>
5
10
  <script>
6
11
  var doNotTrack = ( navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes' || navigator.msDoNotTrack === '1' || window.doNotTrack === '1' )
@@ -8,7 +13,7 @@ if (!doNotTrack) {
8
13
  (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
9
14
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
10
15
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
11
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl+'<%= "&gtm_auth="+gtm_auth if gtm_auth %><%= "&gtm_preview="+gtm_preview if gtm_preview %>&gtm_cookies_win=x';f.parentNode.insertBefore(j,f);
16
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl+'&<%= raw gtm_attributes %>';f.parentNode.insertBefore(j,f);
12
17
  })(window,document,'script','dataLayer','<%= gtm_id %>');
13
18
  }
14
19
  </script>
@@ -12,7 +12,7 @@
12
12
  form_group_css_classes << "govuk-form-group--error" if error_message
13
13
 
14
14
  # check if any item is set as being conditional
15
- has_conditional = items.any? { |item| item["conditional"] }
15
+ has_conditional = items.any? { |item| item.is_a?(Hash) && item[:conditional] }
16
16
  %>
17
17
  <%= content_tag :div, class: form_group_css_classes do %>
18
18
 
@@ -1,8 +1,15 @@
1
+ <% description = yield %>
2
+
1
3
  <div
2
4
  class="gem-c-success-alert"
3
5
  data-module="success-alert"
4
6
  role="alert"
5
7
  tabindex="-1"
6
8
  >
7
- <p class="gem-c-success-alert__message"><%= message %></p>
9
+ <% if description.present? %>
10
+ <h2 class="gem-c-success-summary__title"><%= message %></h2>
11
+ <p class="gem-c-success-summary__body"><%= description %></p>
12
+ <% else %>
13
+ <p class="gem-c-success-alert__message"><%= message %></p>
14
+ <% end %>
8
15
  </div>
@@ -0,0 +1,10 @@
1
+ name: Copy to clipboard
2
+ description: Content that a user is intended to copy, like a URL
3
+ examples:
4
+ default:
5
+ data:
6
+ label: Copy and send this link to someone and they’ll be able to preview your draft on GOV.UK.
7
+ copyable_content: http://www.example.org
8
+ button_text: Copy link
9
+ accessibility_criteria: |
10
+ - should be usable with keyboard
@@ -9,6 +9,10 @@ examples:
9
9
  default:
10
10
  data:
11
11
  message: Message to alert the user to a successful action goes here
12
+ with_message_and_block:
13
+ data:
14
+ message: Message to alert the user to a successful action goes here
15
+ block: A further description
12
16
  long_example:
13
17
  data:
14
18
  message: |
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '9.16.1'.freeze
2
+ VERSION = '9.17'.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.16.1
4
+ version: '9.17'
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-03 00:00:00.000000000 Z
11
+ date: 2018-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -323,6 +323,7 @@ files:
323
323
  - app/assets/javascripts/component_guide/visual-regression.js
324
324
  - app/assets/javascripts/govuk_publishing_components/admin_scripts.js
325
325
  - app/assets/javascripts/govuk_publishing_components/all_components.js
326
+ - app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js
326
327
  - app/assets/javascripts/govuk_publishing_components/components/error-summary.js
327
328
  - app/assets/javascripts/govuk_publishing_components/components/feedback.js
328
329
  - app/assets/javascripts/govuk_publishing_components/components/radio.js
@@ -341,6 +342,7 @@ files:
341
342
  - app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss
342
343
  - app/assets/stylesheets/govuk_publishing_components/components/_button.scss
343
344
  - app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss
345
+ - app/assets/stylesheets/govuk_publishing_components/components/_copy-to-clipboard.scss
344
346
  - app/assets/stylesheets/govuk_publishing_components/components/_details.scss
345
347
  - app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss
346
348
  - app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss
@@ -443,6 +445,7 @@ files:
443
445
  - app/views/govuk_publishing_components/components/_contents_list.html.erb
444
446
  - app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb
445
447
  - app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb
448
+ - app/views/govuk_publishing_components/components/_copy_to_clipboard.html.erb
446
449
  - app/views/govuk_publishing_components/components/_details.html.erb
447
450
  - app/views/govuk_publishing_components/components/_document_list.html.erb
448
451
  - app/views/govuk_publishing_components/components/_error_message.html.erb
@@ -495,6 +498,7 @@ files:
495
498
  - app/views/govuk_publishing_components/components/docs/contents_list.yml
496
499
  - app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml
497
500
  - app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml
501
+ - app/views/govuk_publishing_components/components/docs/copy_to_clipboard.yml
498
502
  - app/views/govuk_publishing_components/components/docs/details.yml
499
503
  - app/views/govuk_publishing_components/components/docs/document_list.yml
500
504
  - app/views/govuk_publishing_components/components/docs/error_message.yml