govuk_publishing_components 27.9.0 → 27.10.1

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: 716757ceb3c2638a8c67e577bd15a1b62f9b65127ba98252084695f65ae961e9
4
- data.tar.gz: 50c813732192c2f8a95a65f29cee6ad2ee9fceaa43f766f46d27c5b132db2fbc
3
+ metadata.gz: 5dee5bb8329667345e4d430b7a49b863b5e68ebfb9398388ee7920b6beb4a3aa
4
+ data.tar.gz: 2cec1ec99cea9a101a6066f3744d0b2faf37b2e21b3a560ef823f5fb0ee75398
5
5
  SHA512:
6
- metadata.gz: 1c7293c79a3baf87072f3994cb5b8eaee52838bf94b539681bc8cf3719e4e2df1a0fe22c3683c1da9df0d0abb88cad4c57a7aa75e267274db3f2bad90b3606a3
7
- data.tar.gz: 4bcca70d40ad1f482bcc1b1bc7497ec43e1561262125f9009f6d5b119104c1684fe47f527a67ee56f49452e0861c60a6a8db083f8ad66333dde9f5b57c2d4847
6
+ metadata.gz: 776095b867336f69a760f40f8e0a3f05de2f85e2c7f8dd078ad9cf1a45d5f1962c32d69dff75963e61c1b1481c0f9a7a010668ce7e73ca63e981bb9053b3f17b
7
+ data.tar.gz: 8b49fa796edac5d3fe46fc76db93687baacb45074af825c94d6f81fdf70ead9273116dce5630ccbac424e8619b6c878dc82512d32ebd24392f796dcf79c592c1
@@ -124,25 +124,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
124
124
 
125
125
  this.hiddenButtons = this.$module.querySelectorAll('button[hidden]')
126
126
 
127
- this.lastWindowSize = undefined
127
+ this.lastWindowSize = null
128
128
  }
129
129
 
130
130
  SuperNavigationMegaMenu.prototype.windowSize = windowSize
131
131
 
132
- // Resizes the space needed for the dropdown menu so that it doesn't overlap
133
- // with the page content. As this is an event that needs to be added and
134
- // removed it can't be be bound to `this` because that changes the fingerprint
135
- // of the function, and makes it unable to be removed with
136
- // `removeEventListener`.
137
- SuperNavigationMegaMenu.prototype.resizeHandler = function () {
138
- var $module = document.querySelector('[data-module="super-navigation-mega-menu"]')
139
- var $openButton = $module.querySelector('[aria-expanded="true"][data-toggle-desktop-group="top"]')
140
- var $openMenu = $openButton ? $module.querySelector('#' + $openButton.getAttribute('aria-controls')) : null
141
- var margin = $openMenu && windowSize() === 'desktop' ? $openMenu.offsetHeight : 0
142
-
143
- $module.style.marginBottom = margin + 'px'
144
- }
145
-
146
132
  SuperNavigationMegaMenu.prototype.updateStates = function () {
147
133
  if (this.windowSize() === 'mobile' && this.lastWindowSize !== 'mobile') {
148
134
  this.$navigationToggle.removeAttribute('hidden')
@@ -161,8 +147,21 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
161
147
  if (this.windowSize() === 'desktop' && this.lastWindowSize !== 'desktop') {
162
148
  this.$navigationToggle.setAttribute('hidden', 'hidden')
163
149
  this.$navigationMenu.removeAttribute('hidden')
150
+ }
164
151
 
165
- this.resizeHandler()
152
+ // The dropdown menu height is only needed when in desktop mode as this is
153
+ // when the dropdown menu is using `absolute` positioning. This requires
154
+ // JavaScript to work out the height and make space for the dropdown menu.
155
+ if (windowSize() === 'desktop') {
156
+ // Check whether any of the dropdown menus are open.
157
+ var $openButton = this.$module.querySelector('[aria-expanded="true"][data-toggle-desktop-group="top"]')
158
+ // Gets the open dropdown menu
159
+ var $openMenu = $openButton ? this.$module.querySelector('#' + $openButton.getAttribute('aria-controls')) : null
160
+ // If there is an open dropdown menu, get the height of the dropdown menu.
161
+ var margin = $openMenu ? $openMenu.offsetHeight : 0
162
+
163
+ // Make space for the dropdown menu.
164
+ this.$module.style.marginBottom = margin + 'px'
166
165
  }
167
166
 
168
167
  this.lastWindowSize = this.windowSize()
@@ -231,30 +230,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
231
230
 
232
231
  this.lastWindowSize = this.windowSize()
233
232
 
234
- // The menu needs to be updated when the window is resized - specifically,
235
- // the top level navigation toggle needs to be shown or hidden.
236
- // Using `matchMedia` to listen for both resize events means that this
237
- // will only fire when the media query is matched so is more efficient. The
238
- // fallback is the `window.resize` event with a check to make sure that it
239
- // only does things when moving from mobile to desktop view.
240
- var setupResizeListener = function () {
241
- window.addEventListener('resize', this.updateStates.bind(this), { passive: true })
242
- }.bind(this)
243
-
244
- if (typeof window.matchMedia === 'function') {
245
- // Internet Explorer 11 supports `matchMedia`, but doesn't support
246
- // the `change` event[1] - so we try it, and then fail back to using
247
- // `window.resize`.
248
- // [1]: https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/onchange
249
- try {
250
- window.matchMedia('screen and (min-width:' + SETTINGS.breakpoint.desktop + 'px)')
251
- .addEventListener('change', this.updateStates.bind(this))
252
- } catch (error) {
253
- setupResizeListener()
254
- }
255
- } else {
256
- setupResizeListener()
257
- }
233
+ // The menu needs to be updated when the window is resized to make sure that
234
+ // the space needed for the dropdown menu is correct.
235
+ window.addEventListener('resize', this.updateStates.bind(this), { passive: true })
236
+
237
+ this.$module.classList.add('js-module-initialised')
258
238
  }
259
239
 
260
240
  Modules.SuperNavigationMegaMenu = SuperNavigationMegaMenu
@@ -314,7 +314,7 @@ $search-icon-size: 20px;
314
314
  }
315
315
 
316
316
  .gem-c-layout-super-navigation-header__navigation-items {
317
- .js-enabled & {
317
+ .js-module-initialised & {
318
318
  padding: 0 0 govuk-spacing(9) 0;
319
319
 
320
320
  @include govuk-media-query($from: "desktop") {
@@ -385,7 +385,7 @@ $search-icon-size: 20px;
385
385
  color: $govuk-focus-text-colour;
386
386
  }
387
387
 
388
- .js-enabled & {
388
+ .js-module-initialised & {
389
389
  @include govuk-media-query($until: "desktop") {
390
390
  padding: govuk-spacing(6) govuk-spacing(3) govuk-spacing(6) govuk-spacing(9);
391
391
  }
@@ -443,7 +443,7 @@ $search-icon-size: 20px;
443
443
  padding-bottom: govuk-spacing(4);
444
444
  padding-top: govuk-spacing(4);
445
445
 
446
- .js-enabled & {
446
+ .js-module-initialised & {
447
447
  display: block;
448
448
  }
449
449
  }
@@ -787,7 +787,7 @@ $search-icon-size: 20px;
787
787
  @include govuk-media-query($from: "desktop") {
788
788
  margin: 0;
789
789
 
790
- .js-enabled & {
790
+ .js-module-initialised & {
791
791
  left: 0;
792
792
  position: absolute;
793
793
  right: 0;
@@ -8,6 +8,7 @@
8
8
  navigation_items ||= []
9
9
  omit_feedback_form ||= false
10
10
  omit_footer_navigation ||= false
11
+ omit_footer_border ||= false
11
12
  omit_header ||= false
12
13
  product_name ||= nil
13
14
  show_explore_header ||= false
@@ -143,7 +144,7 @@
143
144
 
144
145
  <% unless local_assigns[:hide_footer_links] %>
145
146
  <%= render "govuk_publishing_components/components/layout_footer", {
146
- with_border: true,
147
+ with_border: !omit_footer_border,
147
148
  navigation: omit_footer_navigation ? nil : layout_helper.footer_navigation,
148
149
  meta: layout_helper.footer_meta,
149
150
  } %>
@@ -1,15 +1,7 @@
1
1
  <div class="govuk-width-container">
2
- <% message = capture do %>
3
- <%= t("components.layout_for_public.account_layout.feedback.banners.phase_intro") %>
4
- <a class="govuk-link" href=<%= GovukPersonalisation::Urls.feedback %>>
5
- <%= t("components.layout_for_public.account_layout.feedback.banners.phase_link") %>
6
- </a>
7
- <%= t("components.layout_for_public.account_layout.feedback.banners.phase_outro") %>
8
- <% end %>
9
-
10
2
  <%= render "govuk_publishing_components/components/phase_banner", {
11
3
  phase: "beta",
12
- message: message
4
+ message: sanitize(t("components.layout_for_public.account_layout.feedback.banners.phase_banner_html"))
13
5
  } unless omit_account_phase_banner %>
14
6
 
15
7
  <div class="govuk-grid-row govuk-main-wrapper">
@@ -94,9 +94,7 @@ en:
94
94
  account_layout:
95
95
  feedback:
96
96
  banners:
97
- phase_intro: We’re trialling GOV.UK accounts - your
98
- phase_link: feedback
99
- phase_outro: will help us improve them.
97
+ phase_banner_html: This is a new service – your <a class="govuk-link" href="https://signin.account.gov.uk/contact-us?supportType=PUBLIC">feedback</a> will help us to improve it.
100
98
  navigation:
101
99
  destroy_user_session: Sign out
102
100
  menu_bar:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "27.9.0".freeze
2
+ VERSION = "27.10.1".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: 27.9.0
4
+ version: 27.10.1
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: 2021-10-27 00:00:00.000000000 Z
11
+ date: 2021-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config