govuk_publishing_components 23.7.7 → 23.10.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: 4bcf906c61bd12c5c7a7eaa0f3a948c0e17cf23b3590e4640ea3b91fd8b20494
4
- data.tar.gz: 367dd5afad155e02d182cb8b4b48dc6740a24b7888111b947c4cc486d963bfad
3
+ metadata.gz: 2ecb9d7058d12997da1cbd82df01e25e04059e2b2de149ccbcb5bc786a11d9db
4
+ data.tar.gz: 5e24b83c766c52629370320fc7a3338fdce35d5da4997c5cd0432d0f8d0426fc
5
5
  SHA512:
6
- metadata.gz: 1b5fe1817e673d9d5a2bffcecccf1434d34f1b13643df275fccca45a2f478b4a56f9e27b486713faa6fa5bb48c21a4999b293d5b6aabec468a899a28345bcfef
7
- data.tar.gz: 8086257659e01ac460d9fdf0cde17fc20378bc24bfcb35bfa00cea04247c2ebacc3237d72f4fe1a2e027c1433fb93c2f65be07fc0fbefcfd7d09c9bd499c9b8e
6
+ metadata.gz: 3f547a29c744182fae736f081810fe329417df81059f67f2999b0b8ea3631aafd446f9ef1d1c784d4ceb56e701ce7d2242473a4ff1ac2d8b265bd80c419c97ff
7
+ data.tar.gz: eba1c8c046f5e3ac865479c84d0ddf513394e4261d2ae8b4e83882ce32338f4fd69605f3df9bcb5307822aab1b4889d8b9889b6e4425a5d8f606551902aa0c71
@@ -14,3 +14,4 @@
14
14
  //= require ./analytics/ecommerce
15
15
  //= require ./analytics/init
16
16
  //= require ./analytics/scroll-tracker
17
+ //= require ./analytics/explicit-cross-domain-links
@@ -0,0 +1,34 @@
1
+ ;(function (global) {
2
+ 'use strict'
3
+
4
+ var GOVUK = global.GOVUK || {}
5
+ GOVUK.Modules = GOVUK.Modules || {}
6
+
7
+ GOVUK.Modules.ExplicitCrossDomainLinks = function () {
8
+ this.start = function ($module) {
9
+ var element = $module[0]
10
+
11
+ if (!global.ga) { return }
12
+
13
+ global.ga(function () {
14
+ var trackers = global.ga.getAll()
15
+
16
+ if (!trackers.length) { return }
17
+
18
+ var linker = new global.gaplugins.Linker(trackers[0])
19
+
20
+ var attrAction = element.getAttribute('action')
21
+ if (attrAction) {
22
+ element.setAttribute('action', linker.decorate(attrAction))
23
+ }
24
+
25
+ var attrHref = element.getAttribute('href')
26
+ if (attrHref) {
27
+ element.href = linker.decorate(attrHref)
28
+ }
29
+ })
30
+ }
31
+ }
32
+
33
+ global.GOVUK = GOVUK
34
+ })(window)
@@ -0,0 +1,64 @@
1
+ window.GOVUK = window.GOVUK || {}
2
+ window.GOVUK.Modules = window.GOVUK.Modules || {};
3
+
4
+ (function (Modules) {
5
+ function ShowPassword () { }
6
+
7
+ ShowPassword.prototype.start = function ($module) {
8
+ this.$module = $module[0]
9
+ this.input = this.$module.querySelector('.gem-c-input')
10
+ this.$module.togglePassword = this.togglePassword.bind(this)
11
+ this.$module.revertToPasswordOnFormSubmit = this.revertToPasswordOnFormSubmit.bind(this)
12
+ this.input.classList.add('gem-c-input--with-password')
13
+
14
+ this.showPasswordText = this.$module.getAttribute('data-show')
15
+ this.hidePasswordText = this.$module.getAttribute('data-hide')
16
+ this.shownPassword = this.$module.getAttribute('data-announce-show')
17
+ this.hiddenPassword = this.$module.getAttribute('data-announce-hide')
18
+
19
+ // wrap the input in a new div
20
+ this.wrapper = document.createElement('div')
21
+ this.wrapper.classList.add('gem-c-show-password__input-wrapper')
22
+ this.input.parentNode.insertBefore(this.wrapper, this.input)
23
+ this.wrapper.appendChild(this.input)
24
+
25
+ // create and append the button
26
+ this.showHide = document.createElement('button')
27
+ this.showHide.className = 'gem-c-show-password__toggle'
28
+ this.showHide.setAttribute('aria-controls', this.input.getAttribute('id'))
29
+ this.showHide.setAttribute('type', 'button')
30
+ this.showHide.innerHTML = this.showPasswordText
31
+ this.wrapper.insertBefore(this.showHide, this.input.nextSibling)
32
+
33
+ // create and append the status text for screen readers
34
+ this.statusText = document.createElement('span')
35
+ this.statusText.classList.add('govuk-visually-hidden')
36
+ this.statusText.innerHTML = this.hiddenPassword
37
+ this.statusText.setAttribute('aria-live', 'polite')
38
+ this.wrapper.insertBefore(this.statusText, this.showHide.nextSibling)
39
+
40
+ this.showHide.addEventListener('click', this.$module.togglePassword)
41
+
42
+ this.parentForm = this.input.form
43
+ var disableFormSubmitCheck = this.$module.getAttribute('data-disable-form-submit-check')
44
+
45
+ if (this.parentForm && !disableFormSubmitCheck) {
46
+ this.parentForm.addEventListener('submit', this.$module.revertToPasswordOnFormSubmit)
47
+ }
48
+ }
49
+
50
+ ShowPassword.prototype.togglePassword = function (event) {
51
+ event.preventDefault()
52
+ this.showHide.innerHTML = this.showHide.innerHTML === this.showPasswordText ? this.hidePasswordText : this.showPasswordText
53
+ this.statusText.innerHTML = this.statusText.innerHTML === this.shownPassword ? this.hiddenPassword : this.shownPassword
54
+ this.input.setAttribute('type', this.input.getAttribute('type') === 'text' ? 'password' : 'text')
55
+ }
56
+
57
+ ShowPassword.prototype.revertToPasswordOnFormSubmit = function (event) {
58
+ this.showHide.innerHTML = this.showPasswordText
59
+ this.statusText.innerHTML = this.hiddenPassword
60
+ this.input.setAttribute('type', 'password')
61
+ }
62
+
63
+ Modules.ShowPassword = ShowPassword
64
+ })(window.GOVUK.Modules)
@@ -60,6 +60,7 @@
60
60
  @import "components/search";
61
61
  @import "components/select";
62
62
  @import "components/share-links";
63
+ @import "components/show-password";
63
64
  @import "components/skip-link";
64
65
  @import "components/step-by-step-nav-header";
65
66
  @import "components/step-by-step-nav-related";
@@ -36,10 +36,10 @@ $large-input-size: 50px;
36
36
 
37
37
  .gem-c-search__input[type="search"] { // overly specific to prevent some overrides from outside
38
38
  @include govuk-font($size: 19, $line-height: (28 / 19));
39
- padding: 6px;
40
39
  margin: 0;
41
40
  width: 100%;
42
- height: em(34, 16);
41
+ height: em(40, 16);
42
+ padding: em(6, 16);
43
43
  border: $govuk-border-width-form-element solid $govuk-input-border-colour;
44
44
  background: govuk-colour("white");
45
45
  border-radius: 0; //otherwise iphones apply an automatic border radius
@@ -47,6 +47,10 @@ $large-input-size: 50px;
47
47
  -webkit-appearance: none;
48
48
  -moz-appearance: none;
49
49
  appearance: none;
50
+ @include govuk-media-query($from: tablet) {
51
+ height: em(40, 19);
52
+ padding: em(6, 19);
53
+ }
50
54
 
51
55
  // the .focus class is added by JS and ensures that the input remains above the label once clicked/filled in
52
56
  &:focus,
@@ -0,0 +1,63 @@
1
+ .gem-c-show-password__input-wrapper {
2
+ display: table; // IE fallback
3
+ display: flex;
4
+ width: 100%;
5
+ flex-direction: column;
6
+
7
+ @include govuk-media-query($from: mobile) {
8
+ flex-direction: row;
9
+ }
10
+
11
+ .gem-c-input--with-password {
12
+ display: table-cell;
13
+
14
+ &:focus {
15
+ z-index: 1;
16
+ }
17
+ }
18
+ }
19
+
20
+ .gem-c-show-password__toggle {
21
+ @include govuk-font(19);
22
+ z-index: 0;
23
+ display: table-cell; // IE fallback
24
+ padding: govuk-spacing(1) govuk-spacing(3);
25
+ min-width: 5em; // stops the button width jumping when the text changes
26
+ color: $govuk-link-colour;
27
+ text-decoration: underline;
28
+ background: govuk-colour("white");
29
+ border: solid 2px $govuk-input-border-colour;
30
+ white-space: nowrap;
31
+ cursor: pointer;
32
+
33
+ @include govuk-media-query($until: mobile) {
34
+ padding: govuk-spacing(1);
35
+ width: 100%;
36
+ margin-top: -2px;
37
+ white-space: normal;
38
+ }
39
+
40
+ @include govuk-media-query($from: mobile) {
41
+ margin-left: -2px;
42
+ margin-top: 0;
43
+ margin-bottom: 0;
44
+ }
45
+
46
+ &:hover {
47
+ color: $govuk-link-hover-colour;
48
+ }
49
+
50
+ &:focus {
51
+ z-index: 1;
52
+ background: $govuk-focus-colour;
53
+ color: $govuk-focus-text-colour;
54
+ outline: 0;
55
+ }
56
+
57
+ &:active {
58
+ z-index: 1;
59
+ background: govuk-colour("white");
60
+ border-color: $govuk-focus-colour;
61
+ color: $govuk-link-active-colour;
62
+ }
63
+ }
@@ -4,7 +4,7 @@
4
4
  <div class="gem-c-contextual-sidebar">
5
5
  <% if navigation.show_brexit_cta? && navigation.step_by_step_count.zero? %>
6
6
  <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
7
- <% elsif navigation.step_by_step_count.zero? %>
7
+ <% elsif navigation.step_by_step_count.zero? && !navigation.transition_countdown_exception? %>
8
8
  <%= render 'govuk_publishing_components/components/transition_countdown', {
9
9
  title: t("components.related_navigation.transition.title"),
10
10
  url: t("components.related_navigation.transition.link_path"),
@@ -0,0 +1,40 @@
1
+ <%
2
+ disable_form_submit_check ||= false
3
+ label ||= nil
4
+ value ||= nil
5
+ id ||= nil
6
+ name ||= nil
7
+ autocomplete = "off" unless ['new-password', 'current-password'].include?(autocomplete)
8
+ describedby ||= nil
9
+ hint ||= nil
10
+ error_message ||= nil
11
+ error_items ||= nil
12
+
13
+ if !label
14
+ raise ArgumentError, "This component requires a label"
15
+ end
16
+ %>
17
+ <% if label %>
18
+ <%= tag.div class: "gem-c-show-password",
19
+ data: {
20
+ module: "show-password",
21
+ disable_form_submit_check: disable_form_submit_check,
22
+ show: t('components.input.show'),
23
+ hide: t('components.input.hide'),
24
+ announce_show: t('components.input.announce_show'),
25
+ announce_hide: t('components.input.announce_hide')
26
+ } do %>
27
+ <%= render "govuk_publishing_components/components/input", {
28
+ label: label,
29
+ value: value,
30
+ id: id,
31
+ name: name,
32
+ describedby: describedby,
33
+ hint: hint,
34
+ error_message: error_message,
35
+ error_items: error_items,
36
+ type: "password",
37
+ autocomplete: autocomplete,
38
+ } %>
39
+ <% end %>
40
+ <% end %>
@@ -52,6 +52,10 @@ examples:
52
52
  data:
53
53
  text: "Secondary quiet button"
54
54
  secondary_quiet: true
55
+ secondary_solid_button:
56
+ data:
57
+ text: "Secondary solid button"
58
+ secondary_solid: true
55
59
  destructive_button:
56
60
  data:
57
61
  text: "Destructive button"
@@ -144,3 +144,23 @@ examples:
144
144
  - text: Find out what you’ll get
145
145
  href: "/settled-status-eu-citizens-families/what-settled-and-presettled-status-means"
146
146
  optional: false
147
+ transition_countdown_exception:
148
+ data:
149
+ content_item:
150
+ title: "30 creative teams awarded up to £100,000 each for Festival UK* 2022 R&D project"
151
+ content_id: "c3752802-f091-43a9-ba90-33568fccf391"
152
+ links:
153
+ ordered_related_items:
154
+ - title: Find an apprenticeship
155
+ base_path: /apply-apprenticeship
156
+ - title: Training and study at work
157
+ base_path: /training-study-work-your-rights
158
+ - title: Careers helpline for teenagers
159
+ base_path: /careers-helpline-for-teenagers
160
+ document_collections:
161
+ - title: Recruit an apprentice (formerly apprenticeship vacancies)
162
+ base_path: /government/collections/apprenticeship-vacancies
163
+ document_type: document_collection
164
+ - title: The future of jobs and skills
165
+ base_path: /government/collections/the-future-of-jobs-and-skills
166
+ document_type: document_collection
@@ -70,7 +70,7 @@ examples:
70
70
  description: Don't indent the extra links. Used for links to people pages.
71
71
  data:
72
72
  href: "/government/people/"
73
- image_src: "http://placekitten.com/215/140"
73
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
74
74
  image_alt: "some meaningful alt text please"
75
75
  context:
76
76
  text: "The Rt Hon"
@@ -85,7 +85,7 @@ examples:
85
85
  extra_links_with_no_main_link:
86
86
  description: If extra links are included, the main link is not needed. Note that in this configuration the image is not a link as no link has been supplied.
87
87
  data:
88
- image_src: "http://placekitten.com/215/140"
88
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
89
89
  image_alt: "some meaningful alt text please"
90
90
  heading_text: "John Whiskers MP"
91
91
  extra_links: [
@@ -151,7 +151,7 @@ examples:
151
151
  data:
152
152
  large: true
153
153
  href: "/still-not-a-page"
154
- image_src: "https://assets.publishing.service.gov.uk/frontend/homepage/uk-leaves-the-eu-d84d2981a9953d8b1261c9d25016223b0a8af3c096fa2d5e03510d73a78e3c60.jpg"
154
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
155
155
  image_alt: "some meaningful alt text please"
156
156
  context:
157
157
  date: 2017-06-14 11:30:00
@@ -208,7 +208,7 @@ examples:
208
208
  with_lang:
209
209
  description: |
210
210
  Pass through an appropriate `lang` to set a HTML lang attribute for the component.
211
-
211
+
212
212
  The `lang` attribute **must** be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is `en` or `eng`, Korean is `ko` or `kor` - but if in doubt please check.
213
213
  data:
214
214
  href: "/not-a-page"
@@ -0,0 +1,79 @@
1
+ name: Show password input
2
+ description: A password input field that allows the password to be shown.
3
+ body: |
4
+ Adds a password reveal button to an input that toggles its type from password to text, revealing the password. Does not appear if JavaScript is disabled.
5
+
6
+ Uses a visually hidden bit of text to inform screen reader users of the state of the input rather than announcing the content of the password input when toggled.
7
+ accessibility_criteria: |
8
+ The component must:
9
+
10
+ * indicate to the user that the password has been shown or hidden
11
+
12
+ Inputs in the component must:
13
+
14
+ * accept focus
15
+ * be focusable with a keyboard
16
+ * be usable with a keyboard
17
+ * be usable with touch
18
+ * indicate when they have focus
19
+ * be recognisable as form input elements
20
+ * have correctly associated labels
21
+ * be of the appropriate type for their use, e.g. password inputs should be of type 'password'
22
+
23
+ Buttons in the component must:
24
+
25
+ - accept focus
26
+ - be focusable with a keyboard
27
+ - indicate when it has focus
28
+ - activate when focused and space is pressed
29
+ - activate when focused and enter is pressed
30
+ govuk_frontend_components:
31
+ - text-input
32
+ examples:
33
+ default:
34
+ data:
35
+ label:
36
+ text: Please enter your password
37
+ value: this is my password
38
+ disable_form_submit_check:
39
+ description: The component sets the `autocomplete` attribute on the input to "off" so that browsers don't remember the password. This isn't reliable, so the component reverts the input type back to a password when its parent form is submitted. If this is causing conflicts with other JavaScript on your form, you can set `disable-form-submit-check` to `true` to disable this functionality and implement it yourself.
40
+ data:
41
+ label:
42
+ text: Please enter your password
43
+ value: this is my password
44
+ disable_form_submit_check: true
45
+ set_autocomplete_attribute:
46
+ description: By default, autocomplete is set to `off`. This can be set to `new-password` or `current-password` to help browsers differentiate between new and current passwords.
47
+ data:
48
+ label:
49
+ text: Please enter your password
50
+ autocomplete: "current-password"
51
+ value: this is my password
52
+ with_attributes:
53
+ description: The component accepts many but not all of the options that can be passed to a regular input, including `id`, `name` and `describedby` (not shown).
54
+ data:
55
+ label:
56
+ text: Please enter your password
57
+ value: this is my password
58
+ id: custom_id
59
+ name: custom_name
60
+ with_hint:
61
+ data:
62
+ label:
63
+ text: Please enter your password
64
+ value: this is my password
65
+ hint: Your password must be at least twelve thousand characters
66
+ with_error:
67
+ data:
68
+ label:
69
+ text: Please enter your password
70
+ value: this is my password
71
+ error_message: No it isn't
72
+ with_error_items:
73
+ data:
74
+ label:
75
+ text: Please enter your password
76
+ value: this is my password
77
+ error_items:
78
+ - text: Look I keep telling you
79
+ - text: This isn't your password
@@ -54,6 +54,11 @@ en:
54
54
  what_wrong: "What went wrong?"
55
55
  send_me_survey: "Send me the survey"
56
56
  send: "Send"
57
+ input:
58
+ show: Show
59
+ hide: Hide
60
+ announce_show: Your password is shown
61
+ announce_hide: Your password is hidden
57
62
  organisation_schema:
58
63
  all_content_search_description: "Find all content from %{organisation}"
59
64
  radio:
@@ -17,6 +17,7 @@ module GovukPublishingComponents
17
17
  :start,
18
18
  :secondary,
19
19
  :secondary_quiet,
20
+ :secondary_solid,
20
21
  :destructive,
21
22
  :name,
22
23
  :value,
@@ -41,6 +42,7 @@ module GovukPublishingComponents
41
42
  @start = local_assigns[:start]
42
43
  @secondary = local_assigns[:secondary]
43
44
  @secondary_quiet = local_assigns[:secondary_quiet]
45
+ @secondary_solid = local_assigns[:secondary_solid]
44
46
  @destructive = local_assigns[:destructive]
45
47
  @name = local_assigns[:name]
46
48
  @value = local_assigns[:value]
@@ -77,6 +79,7 @@ module GovukPublishingComponents
77
79
  css_classes << "govuk-button--start" if start
78
80
  css_classes << "gem-c-button--secondary" if secondary
79
81
  css_classes << "gem-c-button--secondary-quiet" if secondary_quiet
82
+ css_classes << "govuk-button--secondary" if secondary_solid
80
83
  css_classes << "govuk-button--warning" if destructive
81
84
  css_classes << "gem-c-button--bottom-margin" if margin_bottom && !info_text
82
85
  css_classes << "gem-c-button--inline" if inline_layout
@@ -113,6 +113,10 @@ module GovukPublishingComponents
113
113
  tagged_to_brexit? && (page_content_id != brexit_start_page_content_id)
114
114
  end
115
115
 
116
+ def transition_countdown_exception?
117
+ content_item["content_id"] == "c3752802-f091-43a9-ba90-33568fccf391"
118
+ end
119
+
116
120
  def step_by_step_count
117
121
  step_nav_helper.step_navs.count
118
122
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.7.7".freeze
2
+ VERSION = "23.10.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: 23.7.7
4
+ version: 23.10.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-12-03 00:00:00.000000000 Z
11
+ date: 2020-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -404,6 +404,7 @@ files:
404
404
  - app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js
405
405
  - app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js
406
406
  - app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js
407
+ - app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js
407
408
  - app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js
408
409
  - app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js
409
410
  - app/assets/javascripts/govuk_publishing_components/analytics/init.js
@@ -428,6 +429,7 @@ files:
428
429
  - app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js
429
430
  - app/assets/javascripts/govuk_publishing_components/components/print-link.js
430
431
  - app/assets/javascripts/govuk_publishing_components/components/radio.js
432
+ - app/assets/javascripts/govuk_publishing_components/components/show-password.js
431
433
  - app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
432
434
  - app/assets/javascripts/govuk_publishing_components/components/tabs.js
433
435
  - app/assets/javascripts/govuk_publishing_components/dependencies.js
@@ -510,6 +512,7 @@ files:
510
512
  - app/assets/stylesheets/govuk_publishing_components/components/_search.scss
511
513
  - app/assets/stylesheets/govuk_publishing_components/components/_select.scss
512
514
  - app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss
515
+ - app/assets/stylesheets/govuk_publishing_components/components/_show-password.scss
513
516
  - app/assets/stylesheets/govuk_publishing_components/components/_skip-link.scss
514
517
  - app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-header.scss
515
518
  - app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss
@@ -662,6 +665,7 @@ files:
662
665
  - app/views/govuk_publishing_components/components/_search.html.erb
663
666
  - app/views/govuk_publishing_components/components/_select.html.erb
664
667
  - app/views/govuk_publishing_components/components/_share_links.html.erb
668
+ - app/views/govuk_publishing_components/components/_show_password.html.erb
665
669
  - app/views/govuk_publishing_components/components/_skip_link.html.erb
666
670
  - app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb
667
671
  - app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb
@@ -741,6 +745,7 @@ files:
741
745
  - app/views/govuk_publishing_components/components/docs/search.yml
742
746
  - app/views/govuk_publishing_components/components/docs/select.yml
743
747
  - app/views/govuk_publishing_components/components/docs/share_links.yml
748
+ - app/views/govuk_publishing_components/components/docs/show_password.yml
744
749
  - app/views/govuk_publishing_components/components/docs/skip_link.yml
745
750
  - app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml
746
751
  - app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml