govuk_publishing_components 24.6.1 → 24.7.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: b8b508d510a7aa8f9311afcb0cbb99c28c02b8128e231fbddea0ceac450bda59
4
- data.tar.gz: 2fc60e40d72fdb1fd6dfb635782a982e5105c4df41d8a40e71ff2985b669eaed
3
+ metadata.gz: 2a7574209e732b2fdc01f77d8655487f1e22717a095577726c8fb3ab73cb5147
4
+ data.tar.gz: af0f5bb6c5b9639b8879e700cf89b22cc479d3ed44346cc3884d4d5c8261baab
5
5
  SHA512:
6
- metadata.gz: 2a43864b134f08d16145c1f39ade8bb21de88cfbe9e2f9bb92af0780e2cce92da0381495a61a9d95e40f80d66a6a739ba75ad00b18c975df2f2ccd8232749d2c
7
- data.tar.gz: a379f9f22980a8dbddd8e0af9752055ad8f93fd45a144a1a339d153c5670d26e6bbbda904acd13b91c56e0e797a8e9ed5b82cd190dd9926810d2c41d12ba4691
6
+ metadata.gz: '09bbd9e420b9fc045fd8e9d8088bd15a586fb2281d5b639f33ed2d1f5138abf08e899fc06bab4f5f726f308792859e39d156e2355e3e2c486a40548854b32797'
7
+ data.tar.gz: 6b9fe00e353b48620e520b8507636a79668d02ccd8c1f5f3ac43ee296fd87287c6bd7c1229e13f203d3a18c966a33141c61a40881a2f92ec3abe2a0b5459d10c
@@ -1,7 +1,8 @@
1
1
  /* eslint-env jquery */
2
2
  // = require govuk/components/details/details.js
3
3
  window.GOVUK = window.GOVUK || {}
4
- window.GOVUK.Modules = window.GOVUK.Modules || {};
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Details = window.GOVUKFrontend;
5
6
 
6
7
  (function (Modules) {
7
8
  function GovukDetails () { }
@@ -40,7 +40,9 @@
40
40
  module = new GOVUK.Modules[moduleName]()
41
41
  module.start(element)
42
42
  element.data('module-started', true)
43
- } else if ( // GOV.UK Frontend Modules
43
+ }
44
+
45
+ if ( // GOV.UK Frontend Modules
44
46
  typeof GOVUK.Modules[frontendModuleName] === 'function' &&
45
47
  GOVUK.Modules[frontendModuleName].prototype.init &&
46
48
  !started
@@ -148,7 +148,7 @@ $gem-guide-border-width: 1px;
148
148
 
149
149
  .component-guide-preview--simple {
150
150
  border: 0;
151
- padding: 0;
151
+ padding: govuk-spacing(2);
152
152
 
153
153
  &:before {
154
154
  display: none;
@@ -1,4 +1,13 @@
1
1
  .gem-c-layout-for-public {
2
- margin: 0;
3
2
  font-family: $govuk-font-family;
4
3
  }
4
+
5
+ .gem-c-layout-for-public__blue-bar {
6
+ background: $govuk-brand-colour;
7
+ height: govuk-spacing(2);
8
+ }
9
+
10
+ .js-enabled .gem-c-layout-for-public__global-banner-wrapper {
11
+ margin-top: - govuk-spacing(2);
12
+ position: relative;
13
+ }
@@ -78,12 +78,14 @@
78
78
  }
79
79
  }
80
80
 
81
- .gem-c-layout-header__search.govuk-grid-column-one-third-from-desktop,
82
- .gem-c-layout-header__logo.govuk-grid-column-one-third-from-desktop,
83
- .gem-c-layout-header__search.govuk-grid-column-one-third,
84
- .gem-c-layout-header__logo.govuk-grid-column-two-thirds {
85
- padding-right: 0;
86
- padding-left: 0;
81
+ @include govuk-compatibility(govuk_template) {
82
+ .gem-c-layout-header__search.govuk-grid-column-one-third-from-desktop,
83
+ .gem-c-layout-header__logo.govuk-grid-column-one-third-from-desktop,
84
+ .gem-c-layout-header__search.govuk-grid-column-one-third,
85
+ .gem-c-layout-header__logo.govuk-grid-column-two-thirds {
86
+ padding-right: 0;
87
+ padding-left: 0;
88
+ }
87
89
  }
88
90
 
89
91
  .gem-c-layout-header__logo,
@@ -104,7 +106,6 @@
104
106
 
105
107
  .gem-c-header__content.govuk-header__content {
106
108
  width: auto;
107
- padding-left: 0;
108
109
 
109
110
  @include govuk-media-query($from: desktop) {
110
111
  float: right;
@@ -9,7 +9,6 @@ $large-input-size: 50px;
9
9
  .gem-c-search__label {
10
10
  @include govuk-font($size: 19, $line-height: $input-size);
11
11
  display: block;
12
- background: govuk-colour("white");
13
12
  color: $govuk-text-colour;
14
13
 
15
14
  h1 {
@@ -25,6 +24,7 @@ $large-input-size: 50px;
25
24
  padding-left: govuk-spacing(3);
26
25
  z-index: 1;
27
26
  color: $govuk-secondary-text-colour;
27
+ background: govuk-colour("white");
28
28
  }
29
29
 
30
30
  // match label colour with the label component colour
@@ -144,6 +144,10 @@ $large-input-size: 50px;
144
144
  }
145
145
 
146
146
  .gem-c-search--on-govuk-blue {
147
+ .gem-c-search__label {
148
+ color: govuk-colour("white");
149
+ }
150
+
147
151
  .gem-c-search__input {
148
152
  border-width: 0;
149
153
 
@@ -191,9 +195,19 @@ $large-input-size: 50px;
191
195
  }
192
196
 
193
197
  .gem-c-search--no-border {
198
+ .gem-c-search__label {
199
+ color: govuk-colour("white");
200
+ }
201
+
194
202
  .gem-c-search__input[type="search"] {
195
203
  border: 0;
196
204
  }
205
+
206
+ .js-enabled & {
207
+ .gem-c-search__label {
208
+ color: $govuk-secondary-text-colour;
209
+ }
210
+ }
197
211
  }
198
212
 
199
213
  .gem-c-search--large {
@@ -1,10 +1,33 @@
1
1
  <%
2
- title ||= "GOV.UK - The best place to find government services and information"
3
- html_lang ||= "en"
2
+ emergency_banner ||= nil
4
3
  full_width ||= false
4
+ global_bar ||= nil
5
+ html_lang ||= "en"
6
+ layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
7
+ navigation_items ||= []
5
8
  omit_header ||= false
6
9
  show_search = local_assigns.include?(:show_search) ? local_assigns[:show_search] : true
7
- layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
10
+ title ||= "GOV.UK - The best place to find government services and information"
11
+
12
+ # This is a hack - but it's the only way I can find to not have two blue bars on
13
+ # constrained width layouts.
14
+ #
15
+ # The full width layout hides the blue bar underneath the blar header bar - so
16
+ # full width pages won't see the blue bar unless it's added by another component
17
+ # - and for most pages that component is the global banner.
18
+ #
19
+ # The constrained width layout doesn't hide the blue bar - so having the global
20
+ # banner on a constrained width layout means there are two blue bars.
21
+ #
22
+ # The global banner is shown with JavaScript, so users without JavaScript won't
23
+ # see it. So the constrained width blue bar can't be turned off as then it'll be
24
+ # off for everyone.
25
+ #
26
+ # This booleon adds a CSS class that shifts the banners up by the blue bar's
27
+ # height, making the two blue bars overlap and appear as one. The class is added
28
+ # when a) there's content for the emergency or global banner *and* b) when using
29
+ # the contrained width layout.
30
+ blue_bar_dedupe = !full_width && global_bar.present?
8
31
  -%>
9
32
  <!DOCTYPE html>
10
33
  <!--[if lt IE 9]><html class="lte-ie8" lang="<%= html_lang %>"><![endif]-->
@@ -48,13 +71,31 @@
48
71
  <% unless omit_header %>
49
72
  <%= render "govuk_publishing_components/components/layout_header", {
50
73
  search: show_search,
51
- # layout-header will always have border-bottom, unless the layout is full width
52
- remove_bottom_border: full_width,
74
+ navigation_items: navigation_items,
75
+
76
+ # The (blue) bottom border needs to be underneath the emergency banner -
77
+ # so it has been turned off and added in manually.
78
+ remove_bottom_border: true,
53
79
  } %>
54
80
  <% end %>
55
- <div class="<%= "govuk-width-container" unless full_width %>" id="content">
81
+
82
+ <%= raw(emergency_banner) %>
83
+
84
+ <% unless full_width %>
85
+ <div class="gem-c-layout-for-public__blue-bar govuk-width-container"></div>
86
+ <% end %>
87
+
88
+ <% if global_bar.present? %>
89
+ <%= content_tag("div", {
90
+ class: blue_bar_dedupe ? "gem-c-layout-for-public__global-banner-wrapper" : nil,
91
+ }) do %>
92
+ <%= raw(global_bar) %>
93
+ <% end %>
94
+ <% end %>
95
+
96
+ <div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
56
97
  <%= yield :before_content %>
57
- <main class="govuk-main-wrapper">
98
+ <main class="govuk-main-wrapper" id="content">
58
99
  <%= yield %>
59
100
  </main>
60
101
  </div>
@@ -1,16 +1,15 @@
1
1
  <%
2
- product_name ||= nil
3
2
  environment ||= nil
4
3
  full_width ||= false
5
- search ||= false
6
- search_left ||= false
7
- navigation_items ||= []
8
4
  navigation_aria_label ||= "Top level"
5
+ navigation_items ||= []
6
+ product_name ||= nil
9
7
  remove_bottom_border ||= false
8
+ search ||= false
10
9
  search_left ||= false
11
10
  width_class = full_width ? "govuk-header__container--full-width" : "govuk-width-container"
12
11
 
13
- header_classes = %w(gem-c-layout-header govuk-header)
12
+ header_classes = %w[gem-c-layout-header govuk-header]
14
13
  header_classes << "gem-c-layout-header--#{environment}" if environment
15
14
  header_classes << "gem-c-layout-header--no-bottom-border" if remove_bottom_border
16
15
  header_classes << "gem-c-layout-header--search-left" if search_left
@@ -28,18 +27,22 @@
28
27
  <div class="govuk-grid-column-full govuk-grid-column-one-third-from-desktop gem-c-layout-header__search">
29
28
  <%= render "govuk_publishing_components/components/layout_header/search" %>
30
29
  </div>
31
- <div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
32
- <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
33
- </div>
30
+ <% if navigation_items.any? %>
31
+ <div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
32
+ <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
33
+ </div>
34
+ <% end %>
34
35
  </div>
35
36
  <% else %>
36
- <div class="govuk-grid-row govuk-!-margin-left-0 govuk-!-margin-right-0">
37
+ <div class="govuk-grid-row">
37
38
  <div class="gem-c-layout-header__logo govuk-grid-column-two-thirds">
38
39
  <%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
39
40
  </div>
40
- <div class="govuk-header__content gem-c-header__content">
41
- <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
42
- </div>
41
+ <% if navigation_items.any? %>
42
+ <div class="govuk-header__content gem-c-header__content govuk-grid-column-full">
43
+ <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items, navigation_aria_label: navigation_aria_label %>
44
+ </div>
45
+ <% end %>
43
46
  <% if search %>
44
47
  <div class="govuk-grid-column-one-third gem-c-layout-header__search">
45
48
  <%= render "govuk_publishing_components/components/layout_header/search" %>
@@ -155,6 +155,7 @@ examples:
155
155
  content_item:
156
156
  title: "Transport news story"
157
157
  content_id: "3c402d90-fe77-49b9-a8aa-1800d4fc2b3d"
158
+ locale: "en"
158
159
  links:
159
160
  ordered_related_items:
160
161
  - title: Find an apprenticeship
@@ -180,6 +181,7 @@ examples:
180
181
  content_item:
181
182
  title: "30 creative teams awarded up to £100,000 each for Festival UK* 2022 R&D project"
182
183
  content_id: "c3752802-f091-43a9-ba90-33568fccf391"
184
+ locale: "en"
183
185
  links:
184
186
  ordered_related_items:
185
187
  - title: Find an apprenticeship
@@ -205,6 +207,7 @@ examples:
205
207
  content_item:
206
208
  title: "Local transport news story"
207
209
  content_id: "5c82db20-7631-11e4-a3cb-005056011aef"
210
+ locale: "en"
208
211
  links:
209
212
  ordered_related_items:
210
213
  - title: Find an apprenticeship
@@ -27,3 +27,29 @@ examples:
27
27
  description: This allows the header to be omitted which is currently used when rendering CSV previews from Whitehall
28
28
  data:
29
29
  omit_header: true
30
+ navigation:
31
+ description: Passes the navigation through to the [header component](/component-guide/layout_header/).
32
+ data:
33
+ show_search: false
34
+ navigation_items:
35
+ - text: Navigation item 1
36
+ href: "item-1"
37
+ active: true
38
+ - text: Navigation item 2
39
+ href: "item-2"
40
+ - text: Hidden on desktop
41
+ href: "item-3"
42
+ show_only_in_collapsed_menu: true
43
+ with_global_banner:
44
+ description: This allows the HTML for the global banner to be added to the page. This is only the slot for the global banner - the markup for the banner needs to be passed in.
45
+ data:
46
+ global_bar: <div class="govuk-!-padding-top-5 govuk-!-padding-bottom-3">This is the global bar slot</div>
47
+ with_emergency_banner:
48
+ description: This allows the HTML for the emergency banner to be added to the page in the correct place. This is only the slot for the emergency banner - the markup for the banner needs to be passed in.
49
+ data:
50
+ emergency_banner: <div class="govuk-!-padding-top-3 govuk-!-padding-bottom-3">This is the emergency banner slot</div>
51
+ with_global_and_emergency_banner:
52
+ description: Both global banner and emergency banner should be usable together.
53
+ data:
54
+ emergency_banner: <div class="govuk-!-padding-top-3 govuk-!-padding-bottom-3">This is the emergency banner slot</div>
55
+ global_bar: <div class="govuk-!-padding-top-5 govuk-!-padding-bottom-3">This is the global bar slot</div>
@@ -1,7 +1,14 @@
1
1
  <% navigation_aria_label ||= "Top level" %>
2
2
 
3
3
  <% if navigation_items.any? %>
4
- <button role="button" class="govuk-header__menu-button gem-c-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="Show or hide Top Level Navigation">Menu</button>
4
+ <button
5
+ aria-controls="navigation"
6
+ aria-label="Show or hide Top Level Navigation"
7
+ class="govuk-header__menu-button govuk-js-header-toggle gem-c-header__menu-button"
8
+ type="button"
9
+ >
10
+ Menu
11
+ </button>
5
12
  <%= tag.nav class: "gem-c-header__nav", aria: { label: navigation_aria_label } do %>
6
13
  <ul id="navigation" class="govuk-header__navigation govuk-header__navigation--end">
7
14
  <% navigation_items.each_with_index do |item, index| %>
@@ -249,6 +249,10 @@ module GovukPublishingComponents
249
249
  false
250
250
  end
251
251
 
252
+ def brexit_cta_lang_allow_list?
253
+ %w[en cy].include?(content_item["locale"])
254
+ end
255
+
252
256
  def parent_taxon_include?(taxon, taxon_list)
253
257
  if taxon.present?
254
258
  if taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| taxon_list.include?(taxon_item["content_id"]) }
@@ -294,6 +298,7 @@ module GovukPublishingComponents
294
298
 
295
299
  def show_brexit_cta?
296
300
  brexit_cta_taxon_allow_list? &&
301
+ brexit_cta_lang_allow_list? &&
297
302
  step_by_step_count.zero? &&
298
303
  !brexit_cta_exception?
299
304
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "24.6.1".freeze
2
+ VERSION = "24.7.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: 24.6.1
4
+ version: 24.7.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-03-16 00:00:00.000000000 Z
11
+ date: 2021-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 3.6.0
173
+ version: 3.7.0
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 3.6.0
180
+ version: 3.7.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: jasmine_selenium_runner
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -226,14 +226,14 @@ dependencies:
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '4.0'
229
+ version: '5.0'
230
230
  type: :development
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '4.0'
236
+ version: '5.0'
237
237
  - !ruby/object:Gem::Dependency
238
238
  name: rubocop-govuk
239
239
  requirement: !ruby/object:Gem::Requirement