govuk_publishing_components 27.8.2 → 27.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: 3763a55d9466b65e17b6d352fcbc6a646aebe57cb22dfca0918a8732244af04b
4
- data.tar.gz: 1cd543455e2a9881bb70efff661206cb6869ff7608f782429d767c8cf6287893
3
+ metadata.gz: 844ac45406cf595eb0990bf7c663be451dfc921056759ff3ae7cc0ae77329d01
4
+ data.tar.gz: ba2fc52bde58e4b37038954135d7078c8f6a6be6ea7f58694ab924471e494c28
5
5
  SHA512:
6
- metadata.gz: 0e50da185727b17d9440a957019e0231de4947251bfe3a06273f19e4a0d4fa60bc1b67c9a937877c6dd09f3ac494bc80fb287c767d6541bb4399b1ef194828e7
7
- data.tar.gz: 59f7ef7156937d87460beebe6c798c9307ef7472a84fa44eaaa9795e7d41adfb6510833ee16af03b54911c13a834b2514a0b026ad2a3fa2e62aa08dd0ef9be2e
6
+ metadata.gz: 2cdc7d815f0cf3bec9e5ec0405f5853b6641c1bc91db899fe43976056f31fd32263f5998d6dc3dedc636d15d6f32cf67ef3bd88b6c45a603e7ec4f454a6407d0
7
+ data.tar.gz: 9fab281887ec4a020e763cdeee459af9105c59f1b9d7760e99eaf092551ba0ce30f866913a2a3ab290b7b35f9dc1d517fe94556b0a242637b5773388608d7aa6
@@ -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
@@ -52,15 +52,3 @@ $current-indicator-width: 4px;
52
52
  color: $govuk-link-colour;
53
53
  }
54
54
  }
55
-
56
- .gem-c-layout-for-public-account-feedback-footer {
57
- margin-bottom: govuk-spacing(4);
58
- padding: govuk-spacing(3);
59
- background: govuk-colour("light-grey");
60
-
61
- @include govuk-media-query($from: tablet) {
62
- padding: govuk-spacing(6);
63
- margin-top: govuk-spacing(2);
64
- margin-bottom: govuk-spacing(8);
65
- }
66
- }
@@ -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
@@ -17,7 +18,6 @@
17
18
 
18
19
  show_account_layout ||= false
19
20
  account_nav_location ||= nil
20
- omit_account_feedback_footer ||= false
21
21
  omit_account_navigation ||= false
22
22
  omit_account_phase_banner ||= false
23
23
 
@@ -136,9 +136,7 @@
136
136
  </div>
137
137
  <% end %>
138
138
 
139
- <% if show_account_layout && !omit_account_feedback_footer %>
140
- <%= render "govuk_publishing_components/components/layout_for_public/account-feedback-footer" %>
141
- <% elsif !omit_feedback_form %>
139
+ <% unless omit_feedback_form %>
142
140
  <div class="govuk-width-container">
143
141
  <%= render "govuk_publishing_components/components/feedback" %>
144
142
  </div>
@@ -146,7 +144,7 @@
146
144
 
147
145
  <% unless local_assigns[:hide_footer_links] %>
148
146
  <%= render "govuk_publishing_components/components/layout_footer", {
149
- with_border: true,
147
+ with_border: !omit_footer_border,
150
148
  navigation: omit_footer_navigation ? nil : layout_helper.footer_navigation,
151
149
  meta: layout_helper.footer_meta,
152
150
  } %>
@@ -68,14 +68,6 @@ examples:
68
68
  block: |
69
69
  <h2 class="govuk-heading-l">This is a title</h2>
70
70
  <p class="govuk-body">This is some body text with <a href="https://example.com">a link</a>.
71
- with_account_layout_but_without_account_feedback_footer:
72
- description: The account layout renders with an account-specific feedback banner by default. This flag allows this banner to be omitted.
73
- data:
74
- show_account_layout: true
75
- omit_account_feedback_footer: true
76
- block: |
77
- <h2 class="govuk-heading-l">This is a title</h2>
78
- <p class="govuk-body">This is some body text with <a href="https://example.com">a link</a>.</p>
79
71
  with_current_account_navigation:
80
72
  description: "The account layout renders with an account-specific nav to help users navigate different areas of their account. This flag is here to allow control over which option in the nav is highlighted as `current`. Valid options are currently `your-account`, `manage`, and `security`."
81
73
  data:
@@ -8,7 +8,7 @@
8
8
  <% end %>
9
9
 
10
10
  <%= render "govuk_publishing_components/components/phase_banner", {
11
- phase: "alpha",
11
+ phase: "beta",
12
12
  message: message
13
13
  } unless omit_account_phase_banner %>
14
14
 
@@ -19,14 +19,5 @@
19
19
  data: { module: "explicit-cross-domain-links" },
20
20
  ) %>
21
21
  </li>
22
- <li class="gem-c-layout-for-public-account-menu__item <%= "gem-c-layout-for-public-account-menu__item--current" if page_is == "security" %>">
23
- <%= link_to(
24
- t("components.layout_for_public.account_layout.navigation.menu_bar.security.link_text"),
25
- GovukPersonalisation::Urls.security,
26
- class: 'gem-c-layout-for-public-account-menu__link govuk-link govuk-link--no-visited-state',
27
- 'aria-current': page_is == "security" ? "page" : nil,
28
- data: { module: "explicit-cross-domain-links" },
29
- ) %>
30
- </li>
31
22
  </ul>
32
23
  </nav>
@@ -53,7 +53,7 @@ en:
53
53
  two_words: " and "
54
54
  type:
55
55
  consultation: Consultation for %{nation}
56
- detailed_guide: Guidance for %{nation}
56
+ detailed_guide: Guidance for %{nation}
57
57
  guidance: Guidance for %{nation}
58
58
  publication: Publication for %{nation}
59
59
  england: England
@@ -94,13 +94,9 @@ en:
94
94
  account_layout:
95
95
  feedback:
96
96
  banners:
97
- footer_intro: We’re trialling GOV.UK accounts.
98
- footer_link: Give feedback
99
- footer_outro: on your experience so we can make them better.
100
- phase_intro: We’re trialling GOV.UK accounts - your
97
+ phase_intro: This is a new service – your
101
98
  phase_link: feedback
102
- phase_outro: will help us improve them.
103
- title: Help improve GOV.UK accounts
99
+ phase_outro: will help us to improve it.
104
100
  navigation:
105
101
  destroy_user_session: Sign out
106
102
  menu_bar:
@@ -108,8 +104,6 @@ en:
108
104
  link_text: Your account
109
105
  manage:
110
106
  link_text: Manage your account
111
- security:
112
- link_text: Security and privacy
113
107
  user_root_path: Account
114
108
  layout_header:
115
109
  hide_button: Hide search
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "27.8.2".freeze
2
+ VERSION = "27.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: 27.8.2
4
+ version: 27.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: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -836,7 +836,6 @@ files:
836
836
  - app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb
837
837
  - app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb
838
838
  - app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb
839
- - app/views/govuk_publishing_components/components/layout_for_public/_account-feedback-footer.html.erb
840
839
  - app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb
841
840
  - app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb
842
841
  - app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb
@@ -1,18 +0,0 @@
1
- <%= tag.div(class: "govuk-width-container") do %>
2
- <%= tag.div(class: "gem-c-layout-for-public-account-feedback-footer") do %>
3
- <%= render "govuk_publishing_components/components/heading", {
4
- text: t("components.layout_for_public.account_layout.feedback.banners.title"),
5
- heading_level: 2,
6
- font_size: "m",
7
- margin_bottom: 4,
8
- } %>
9
-
10
- <p class="govuk-body govuk-!-margin-bottom-0">
11
- <%= t("components.layout_for_public.account_layout.feedback.banners.footer_intro") %>
12
- <a href="<%= GovukPersonalisation::Urls.feedback %>" class="govuk-link">
13
- <%= t("components.layout_for_public.account_layout.feedback.banners.footer_link") %>
14
- </a>
15
- <%= t("components.layout_for_public.account_layout.feedback.banners.footer_outro") %>
16
- </p>
17
- <% end %>
18
- <% end %>