govuk_publishing_components 21.56.2 → 21.57.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4c762079459f5284a3c2d8077bb92136586f9a3fb1bd41f38b5a37b8c557b04
4
- data.tar.gz: 9a458d78da7c878aa9f1863e485b4b59bce139f5d4295d76df88a5da2144ede0
3
+ metadata.gz: b8a8a82f77b41de6046e22f895906a472e9b90c3e51eb79383a12e5eb3d25c12
4
+ data.tar.gz: df29df24347079ca630904cdd8b41c30a950c42b648f11989952d68f9d0f84db
5
5
  SHA512:
6
- metadata.gz: '0879f5adc27997f08246bc8b8fc17a3538c1892fb90cfea51354aa2414d8b353fc5bc74287cb76299ecaf2f09c1f59f6306f7b7bff6362b4f22c21392ed79aaa'
7
- data.tar.gz: 1cc60f11f0acfb2132922599454a1888663e4b5c864c092a77f84e44bea82559322812c6154d830db7163d3dc6aff8f1e1165e4576b4d96ce028ba7cf56cf69e
6
+ metadata.gz: 76bd5c827d4b33f2abb411af2fc2baf4028e0555bd6b53997accebc7830811fb01871da0218095ac1ec7c1992dc25282ce14088c0075262f5088bd70e5a2d990
7
+ data.tar.gz: 456965f640926944af2eb05a47927c00d612c2eaefd651a3f149bb6f374b1247d1581dce682ede9b6c552c34071dc24ecf54cc73ea9d7c1da96ac81165a22250
@@ -0,0 +1,14 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (Modules) {
5
+ 'use strict'
6
+
7
+ Modules.PrintLink = function () {
8
+ this.start = function (element) {
9
+ element[0].addEventListener('click', function () {
10
+ window.print()
11
+ })
12
+ }
13
+ }
14
+ })(window.GOVUK.Modules)
@@ -53,6 +53,7 @@
53
53
  @import "components/panel";
54
54
  @import "components/phase-banner";
55
55
  @import "components/previous-and-next-navigation";
56
+ @import "components/print-link";
56
57
  @import "components/radio";
57
58
  @import "components/related-navigation";
58
59
  @import "components/search";
@@ -118,6 +118,16 @@
118
118
  }
119
119
 
120
120
  .gem-c-action-link--dark-icon {
121
+ &:before {
122
+ // sass-lint:disable no-duplicate-properties
123
+ background: image-url("govuk_publishing_components/action-link-arrow--dark.png");
124
+ background: image-url("govuk_publishing_components/action-link-arrow--dark.svg"), linear-gradient(transparent, transparent);
125
+ // sass-lint:enable no-duplicate-properties
126
+ }
127
+ }
128
+
129
+ .gem-c-action-link--dark-icon,
130
+ .gem-c-action-link--small-icon {
121
131
  max-width: none;
122
132
 
123
133
  @include govuk-media-query($until: tablet) {
@@ -125,12 +135,8 @@
125
135
  }
126
136
 
127
137
  &:before {
128
- width: 30px;
129
138
  height: 30px;
130
- // sass-lint:disable no-duplicate-properties
131
- background: image-url("govuk_publishing_components/action-link-arrow--dark.png");
132
- background: image-url("govuk_publishing_components/action-link-arrow--dark.svg"), linear-gradient(transparent, transparent);
133
- // sass-lint:enable no-duplicate-properties
139
+ width: 30px;
134
140
  background-repeat: no-repeat;
135
141
  background-size: 25px auto;
136
142
  background-position: 0 2px;
@@ -12,6 +12,10 @@ $govuk-cookie-banner-background: govuk-colour("light-grey", "grey-4");
12
12
  background-color: $govuk-cookie-banner-background;
13
13
  }
14
14
 
15
+ .gem-c-cookie-banner--services {
16
+ display: none;
17
+ }
18
+
15
19
  .gem-c-cookie-banner__message {
16
20
  display: inline-block;
17
21
  padding-bottom: govuk-spacing(2);
@@ -0,0 +1,52 @@
1
+ .gem-c-print-link {
2
+ display: none;
3
+ margin-bottom: 2em;
4
+ margin-top: 2em;
5
+ }
6
+
7
+ .gem-c-print-link.gem-c-print-link--show-without-js {
8
+ display: block;
9
+ }
10
+
11
+ .js-enabled {
12
+ .gem-c-print-link {
13
+ display: block;
14
+ }
15
+ }
16
+
17
+ .gem-c-print-link__link {
18
+ background: image-url("govuk_publishing_components/icon-print.png") no-repeat 10px 50%;
19
+
20
+ margin-left: -10px;
21
+ padding: .5em .5em .5em 38px;
22
+
23
+ @include govuk-device-pixel-ratio($ratio: 2) {
24
+ background-image: image-url("govuk_publishing_components/icon-print-2x.png");
25
+ background-size: 16px 18px;
26
+ }
27
+
28
+ &:focus {
29
+ @include govuk-focused-text;
30
+ }
31
+ }
32
+
33
+ .gem-c-print-link__button {
34
+ @extend %govuk-body-s;
35
+ background: image-url("govuk_publishing_components/icon-print.png") no-repeat 10px 50%;
36
+ border: 0;
37
+ color: $govuk-link-colour;
38
+ cursor: pointer;
39
+ margin: 0;
40
+ margin-left: -10px;
41
+ padding: .5em .5em .5em 38px;
42
+ text-decoration: underline;
43
+
44
+ @include govuk-device-pixel-ratio($ratio: 2) {
45
+ background-image: image-url("govuk_publishing_components/icon-print-2x.png");
46
+ background-size: 16px 18px;
47
+ }
48
+
49
+ &:focus {
50
+ @include govuk-focused-text;
51
+ }
52
+ }
@@ -7,8 +7,12 @@
7
7
  .help-notice,
8
8
  .call-to-action {
9
9
  margin: govuk-spacing(3) 0;
10
- padding: 0 govuk-spacing(3);
10
+ }
11
+
12
+ .call-to-action {
13
+ background: none;
11
14
  border: 1pt solid $govuk-border-colour;
15
+ padding: govuk-spacing(3);
12
16
  }
13
17
 
14
18
  .help-notice p {
@@ -11,6 +11,7 @@
11
11
  light_text ||= false
12
12
  simple ||= false
13
13
  dark_icon ||= false
14
+ small_icon ||= false
14
15
  nhs_icon ||= false
15
16
  data ||= nil
16
17
  classes ||= nil
@@ -18,6 +19,7 @@
18
19
  css_classes = %w(gem-c-action-link)
19
20
  css_classes << "gem-c-action-link--light-text" if light_text
20
21
  css_classes << "gem-c-action-link--dark-icon" if dark_icon
22
+ css_classes << "gem-c-action-link--small-icon" if small_icon
21
23
  css_classes << "gem-c-action-link--nhs" if nhs_icon
22
24
  css_classes << "gem-c-action-link--simple" if simple
23
25
  css_classes << "gem-c-action-link--with-subtext" if subtext
@@ -5,9 +5,11 @@
5
5
  cookie_preferences_href ||= "/help/cookies"
6
6
  confirmation_message ||= raw("You’ve accepted all cookies. You can <a class='govuk-link' href='#{cookie_preferences_href}' data-module='track-click' data-track-category='cookieBanner' data-track-action='Cookie banner settings clicked from confirmation'>change your cookie settings</a> at any time.")
7
7
  services_cookies ||= nil
8
+ css_classes = %w(gem-c-cookie-banner govuk-clearfix)
9
+ css_classes << "gem-c-cookie-banner--services" if services_cookies
8
10
  %>
9
11
 
10
- <div id="<%= id %>" class="gem-c-cookie-banner govuk-clearfix" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet>
12
+ <div id="<%= id %>" class="<%= css_classes.join(' ') %>" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet>
11
13
  <div class="gem-c-cookie-banner__wrapper govuk-width-container">
12
14
  <div class="govuk-grid-row">
13
15
  <div class="govuk-grid-column-two-thirds">
@@ -0,0 +1,27 @@
1
+ <%
2
+ text ||= t('components.print_link.text')
3
+ href ||= nil
4
+ data_attributes ||= {}
5
+
6
+ require_js ||= href.nil?
7
+ data_attributes[:module] = 'print-link' if require_js
8
+ %>
9
+
10
+ <% if require_js %>
11
+ <div class="gem-c-print-link" >
12
+ <%= content_tag(:button, text, {
13
+ class: %w(gem-c-print-link__button govuk-link),
14
+ data: data_attributes
15
+ }) %>
16
+ </div>
17
+ <% else %>
18
+ <div class="gem-c-print-link gem-c-print-link--show-without-js">
19
+ <%= link_to(
20
+ text,
21
+ href,
22
+ class: %w(gem-c-print-link__link govuk-link),
23
+ rel: "alternate",
24
+ data: data_attributes
25
+ ) %>
26
+ </div>
27
+ <% end %>
@@ -75,6 +75,11 @@ examples:
75
75
  text: Getting financial help and keeping your business safe
76
76
  href: "/financial-help"
77
77
  simple: true
78
+ with_small_icon:
79
+ data:
80
+ text: Coronavirus (COVID-19)
81
+ href: "/my-test-page"
82
+ small_icon: true
78
83
  with_dark_icon:
79
84
  data:
80
85
  text: Coronavirus (COVID-19)
@@ -0,0 +1,24 @@
1
+ name: Print link
2
+ description: A link with a print icon to help users print the current page
3
+ body: |
4
+ This component renders two different outputs depending on whether a `href` is specified. By default, when no `href` is given, the component renders as a button and triggers a print action via JavaScript. In this case the component is hidden in environments where JavaScript is disabled and can be used as a progressive enhancement. When a `href` is specified the component renders as an anchor tag and navigates to that `href` without JavaScript, suitable for applications which have paths that trigger a print event on load.
5
+ accessibility_criteria: |
6
+ - The print icon must be presentational and ignored by screen readers.
7
+ shared_accessibility_criteria:
8
+ - link
9
+ examples:
10
+ default:
11
+ description: This component calls `print()` via the browser's DOM API. By default it relies on JavaScript and is not shown in environments where JavaScript is disabled. The \"link\" here is actually a button tag because this is not a navigation event.
12
+ with_different_text:
13
+ data:
14
+ text: "Print this manual"
15
+ with_different_href:
16
+ description: You can specify a alternative `href` URL that will override the default behaviour. When a `href` is specified the print link will render as an anchor tag and be displayed even when JavaScript is disabled.
17
+ data:
18
+ href: "/print"
19
+ with_data_attributes:
20
+ data:
21
+ data_attributes:
22
+ track-category: "printButton"
23
+ track-action: "clicked"
24
+ track-label: "Print this page"
@@ -58,6 +58,8 @@ en:
58
58
  policies: "Policies"
59
59
  statistical_data_sets: "Statistical data sets"
60
60
  topical_events: "Topical events"
61
+ print_link:
62
+ text: "Print this page"
61
63
  skip_link:
62
64
  text: "Skip to main content"
63
65
  step_by_step_nav:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "21.56.2".freeze
2
+ VERSION = "21.57.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.56.2
4
+ version: 21.57.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: 2020-06-23 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters
@@ -437,6 +437,7 @@ files:
437
437
  - app/assets/javascripts/govuk_publishing_components/components/header.js
438
438
  - app/assets/javascripts/govuk_publishing_components/components/initial-focus.js
439
439
  - app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js
440
+ - app/assets/javascripts/govuk_publishing_components/components/print-link.js
440
441
  - app/assets/javascripts/govuk_publishing_components/components/radio.js
441
442
  - app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
442
443
  - app/assets/javascripts/govuk_publishing_components/components/tabs.js
@@ -504,6 +505,7 @@ files:
504
505
  - app/assets/stylesheets/govuk_publishing_components/components/_panel.scss
505
506
  - app/assets/stylesheets/govuk_publishing_components/components/_phase-banner.scss
506
507
  - app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss
508
+ - app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss
507
509
  - app/assets/stylesheets/govuk_publishing_components/components/_radio.scss
508
510
  - app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss
509
511
  - app/assets/stylesheets/govuk_publishing_components/components/_search.scss
@@ -647,6 +649,7 @@ files:
647
649
  - app/views/govuk_publishing_components/components/_panel.html.erb
648
650
  - app/views/govuk_publishing_components/components/_phase_banner.html.erb
649
651
  - app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb
652
+ - app/views/govuk_publishing_components/components/_print_link.html.erb
650
653
  - app/views/govuk_publishing_components/components/_radio.html.erb
651
654
  - app/views/govuk_publishing_components/components/_related_navigation.html.erb
652
655
  - app/views/govuk_publishing_components/components/_search.html.erb
@@ -722,6 +725,7 @@ files:
722
725
  - app/views/govuk_publishing_components/components/docs/panel.yml
723
726
  - app/views/govuk_publishing_components/components/docs/phase_banner.yml
724
727
  - app/views/govuk_publishing_components/components/docs/previous_and_next_navigation.yml
728
+ - app/views/govuk_publishing_components/components/docs/print_link.yml
725
729
  - app/views/govuk_publishing_components/components/docs/radio.yml
726
730
  - app/views/govuk_publishing_components/components/docs/related_navigation.yml
727
731
  - app/views/govuk_publishing_components/components/docs/search.yml