govuk_publishing_components 35.20.0 → 35.21.0

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: d1878b4cfefb05ba090334ac9990ead5cd73b519b0dd5086fa15d48715f7fc13
4
- data.tar.gz: 3916e46d02628289d1667218a570c67b7b809c584da24064412cc948be37fd23
3
+ metadata.gz: 3bc95850fa0d38a7b0783eed1d3e5b1fd846c9b11c8ae5562d8fa8f7111696f4
4
+ data.tar.gz: edafc5b87bd54a90cce6cfe616589eddb820eb6dc3d0d4d0e8f17953ad51a74f
5
5
  SHA512:
6
- metadata.gz: 764549f50e7ea206131c5cbbbe6ac12e693ed6a8e08c4e27ab2575eac6adf0788a725cda4790b388d58bb3f81884f98e6ff7902b57b906730db6b550cd60acee
7
- data.tar.gz: 1d3a83a6d8fb0e602e5b3fdcb54713f79d83e7266b4aa1fe873c41f941489fcac11edac78e03d7ebf655d35aee37c5c4a7cd0c9fe690ec0305b5f4a68567138b
6
+ metadata.gz: 576b4d036af878138116870dcf1045cf91cdb9ba31a9f68b1b8571fac840f7728d177f9d3293c83e921a3f93a5a3110b19e681568367706ca89280dc995abe8d
7
+ data.tar.gz: bf87713f8b29033d63800bd4851bbca0778968a4318432b828a907a60e83a85da966307394ef77c43b3bb715ee14a23ebe81b9984303bf11a1fe5e1b2f5550f1
@@ -30,7 +30,16 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
30
30
  firstScript.parentNode.insertBefore(newScript, firstScript)
31
31
  },
32
32
 
33
+ getUserAgent: function () {
34
+ return navigator.userAgent
35
+ },
36
+
33
37
  sendData: function (data) {
38
+ // Prevent any GA4 data being sent during Smokey tests
39
+ if (this.getUserAgent() === 'Smokey Test / Ruby') {
40
+ return
41
+ }
42
+
34
43
  data.govuk_gem_version = this.getGemVersion()
35
44
  // set this in the console as a debugging aid
36
45
  if (window.GOVUK.analyticsGa4.showDebug) {
@@ -46,7 +46,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
46
46
  var formData = this.getInputValues(formInputs)
47
47
  data.text = data.text || this.combineGivenAnswers(formData) || this.useFallbackValue
48
48
 
49
- if (data.action === 'search') {
49
+ if (data.action === 'search' && data.text) {
50
50
  data.text = data.text.toLowerCase()
51
51
  data.text = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(data.text)
52
52
  }
@@ -8,7 +8,7 @@ $search-width-or-height: $black-bar-height;
8
8
  $pseudo-underline-height: 3px;
9
9
  $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
10
10
 
11
- $large-navbar-height: 86px;
11
+ $large-navbar-height: 72px;
12
12
 
13
13
  $pale-blue-colour: #d2e2f1;
14
14
 
@@ -630,6 +630,12 @@ $after-button-padding-left: govuk-spacing(4);
630
630
  color: govuk-colour("white");
631
631
  }
632
632
 
633
+ &:focus-visible {
634
+ &.gem-c-layout-super-navigation-header__search-toggle-button--blue-background {
635
+ border-bottom: $pseudo-underline-height solid govuk-colour("black");
636
+ }
637
+ }
638
+
633
639
  @include govuk-media-query($from: "desktop") {
634
640
  border: 0;
635
641
  margin: 0;
@@ -654,15 +660,21 @@ $after-button-padding-left: govuk-spacing(4);
654
660
 
655
661
  // stylelint-disable max-nesting-depth
656
662
  @include focus-not-focus-visible {
657
- border-bottom: none;
663
+ border-bottom: $pseudo-underline-height solid $govuk-brand-colour;
664
+
665
+ &:hover {
666
+ border-bottom: $pseudo-underline-height solid govuk-colour("white");
667
+ }
658
668
  }
659
669
  // stylelint-enable max-nesting-depth
660
670
  }
661
671
 
662
672
  &:focus-visible {
663
673
  &.gem-c-layout-super-navigation-header__search-toggle-button--blue-background {
674
+ color: govuk-colour("black");
675
+
664
676
  &:hover {
665
- border-bottom: $pseudo-underline-height solid $govuk-focus-colour;
677
+ border-bottom: $pseudo-underline-height solid govuk-colour("black");
666
678
  color: govuk-colour("black");
667
679
  }
668
680
  }
@@ -679,9 +691,14 @@ $after-button-padding-left: govuk-spacing(4);
679
691
  &.gem-c-layout-super-navigation-header__open-button {
680
692
  &.gem-c-layout-super-navigation-header__search-toggle-button--blue-background {
681
693
  &:hover {
682
- border-bottom: $pseudo-underline-height solid govuk-colour("white");
694
+ border-bottom: $pseudo-underline-height solid govuk-colour("light-grey");
683
695
  color: govuk-colour("white");
684
696
  }
697
+
698
+ &:focus-visible {
699
+ border-bottom: $pseudo-underline-height solid govuk-colour("black");
700
+ color: govuk-colour("black");
701
+ }
685
702
  }
686
703
 
687
704
  @include focus-and-focus-visible {
@@ -704,6 +721,10 @@ $after-button-padding-left: govuk-spacing(4);
704
721
  border-bottom-color: govuk-colour("light-grey");
705
722
  color: govuk-colour("light-grey");
706
723
  outline: 1px solid govuk-colour("light-grey"); // overlap the border of the nav menu so it won't appear when menu open
724
+
725
+ &:hover {
726
+ border-bottom: $pseudo-underline-height solid govuk-colour("light-grey");
727
+ }
707
728
  }
708
729
  }
709
730
  }
@@ -726,7 +747,7 @@ $after-button-padding-left: govuk-spacing(4);
726
747
  }
727
748
 
728
749
  .gem-c-layout-super-navigation-header__search-container {
729
- padding-bottom: govuk-spacing(3);
750
+ padding-bottom: govuk-spacing(7);
730
751
  }
731
752
 
732
753
  // Dropdown menu.
@@ -740,7 +761,23 @@ $after-button-padding-left: govuk-spacing(4);
740
761
  padding-top: govuk-spacing(6);
741
762
 
742
763
  @include govuk-media-query($from: "desktop") {
743
- padding-top: govuk-spacing(5);
764
+ padding-top: govuk-spacing(8);
765
+ }
766
+ }
767
+
768
+ .gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar {
769
+ @include govuk-media-query($until: "desktop") {
770
+ .gem-c-layout-super-navigation-header__search-items {
771
+ margin: 0 24px;
772
+ }
773
+ }
774
+ }
775
+
776
+ @include govuk-media-query($until: "tablet") {
777
+ // padding to make it the same as the padding for the redesign of the homepage
778
+ .gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar .gem-c-layout-super-navigation-header__column--services-and-information,
779
+ .gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar .gem-c-layout-super-navigation-header__column--government-activity {
780
+ padding: 0 24px;
744
781
  }
745
782
  }
746
783
 
@@ -814,6 +851,11 @@ $after-button-padding-left: govuk-spacing(4);
814
851
  }
815
852
  }
816
853
 
854
+ .gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar .gem-c-layout-super-navigation-header__navigation-second-item-link {
855
+ font-size: 19px;
856
+ font-size: govuk-px-to-rem(19px);
857
+ }
858
+
817
859
  .gem-c-layout-super-navigation-header__navigation-second-item-link--with-description {
818
860
  font-size: 16px;
819
861
  font-size: govuk-px-to-rem(16px);
@@ -825,16 +867,31 @@ $after-button-padding-left: govuk-spacing(4);
825
867
  }
826
868
  }
827
869
 
870
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button--large-navbar {
871
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
872
+ padding-left: 26px;
873
+ padding-right: 26px;
874
+ }
875
+ }
876
+
877
+ .gem-c-layout-super-navigation-header__search-toggle-button--large-navbar {
878
+ padding-left: 24px;
879
+ padding-right: 24px;
880
+ width: 68px;
881
+ }
882
+
828
883
  .gem-c-layout-super-navigation-header__navigation-second-item-description {
829
- @include govuk-typography-common;
830
- font-size: 16px;
831
- font-size: govuk-px-to-rem(16px);
832
- font-weight: normal;
833
- margin: govuk-spacing(1) 0 0 0;
884
+ margin-top: govuk-spacing(1);
885
+ }
886
+
887
+ .gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar .gem-c-layout-super-navigation-header__navigation-second-item-description {
888
+ font-size: 19px;
889
+ font-size: govuk-px-to-rem(19px);
890
+ margin-top: govuk-spacing(2);
834
891
  }
835
892
 
836
893
  .gem-c-layout-super-navigation-header__search-form {
837
- padding: govuk-spacing(2) 0 govuk-spacing(6) 0;
894
+ padding: 0 0 govuk-spacing(8) 0;
838
895
  }
839
896
 
840
897
  // Popular links.
@@ -854,6 +911,11 @@ $after-button-padding-left: govuk-spacing(4);
854
911
  }
855
912
  }
856
913
 
914
+ .gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar .gem-c-layout-super-navigation-header__popular-link {
915
+ font-size: 19px;
916
+ font-size: govuk-px-to-rem(19px);
917
+ }
918
+
857
919
  .gem-c-layout-super-navigation-header__width-container {
858
920
  @include govuk-media-query($until: "desktop") {
859
921
  margin: 0;
@@ -894,12 +956,12 @@ $after-button-padding-left: govuk-spacing(4);
894
956
  }
895
957
 
896
958
  .gem-c-layout-super-navigation-header__logotype-crown--large-navbar {
897
- height: 36px;
898
- width: 49px;
959
+ height: 32px;
960
+ width: 44px;
899
961
  }
900
962
 
901
963
  .gem-c-header__link--large-navbar:focus {
902
- box-shadow: 0 -4px 0 18px $govuk-focus-colour;
964
+ box-shadow: 0 -6px 0 12px $govuk-focus-colour;
903
965
  border-bottom: $govuk-focus-width solid govuk-colour("black");
904
966
  padding-bottom: 10px;
905
967
  }
@@ -909,17 +971,14 @@ $after-button-padding-left: govuk-spacing(4);
909
971
  }
910
972
 
911
973
  .gem-c-layout-super-navigation-header__header-logo--large-navbar {
912
- height: 35px;
913
- padding-bottom: govuk-spacing(5);
914
- padding-top: govuk-spacing(5);
974
+ height: 32px;
975
+ padding-bottom: govuk-spacing(4);
976
+ padding-top: govuk-spacing(4);
915
977
  }
916
978
 
917
979
  .gem-c-layout-super-navigation-header__search-toggle-button--large-navbar {
918
980
  height: $large-navbar-height;
919
- }
920
-
921
- // to stop the search icon moving on hover
922
- .gem-c-layout-super-navigation-header__search-toggle-button--large-navbar:hover {
981
+ // to stop the search icon moving on hover
923
982
  padding-bottom: 12px;
924
983
  }
925
984
 
@@ -931,3 +990,19 @@ $after-button-padding-left: govuk-spacing(4);
931
990
  height: $large-navbar-height;
932
991
  }
933
992
  }
993
+
994
+ @include govuk-media-query($until: tablet) {
995
+ .gem-c-layout-super-navigation-header__popular-links-heading--large-navbar {
996
+ font-size: 24px;
997
+ font-size: govuk-px-to-rem(24px);
998
+ }
999
+
1000
+ // can't disable responsive styling because using override classes
1001
+ // from govuk-frontend which are all responsive so have to supply
1002
+ // custom class to the label of the search component to turn off
1003
+ // the responsive font size
1004
+ .gem-c-layout-super-navigation-header__search-label--large-navbar {
1005
+ font-size: 24px;
1006
+ font-size: govuk-px-to-rem(24px);
1007
+ }
1008
+ }
@@ -25,11 +25,14 @@
25
25
  .gem-c-metadata--inverse {
26
26
  background-color: govuk-colour("blue");
27
27
  color: govuk-colour("white");
28
- padding: govuk-spacing(2);
29
28
 
30
29
  a {
31
30
  @include govuk-link-style-inverse;
32
31
  }
32
+ }
33
+
34
+ .gem-c-metadata--inverse-padded {
35
+ padding: govuk-spacing(2);
33
36
 
34
37
  .gem-c-metadata__list {
35
38
  margin: govuk-spacing(2);
@@ -65,7 +65,11 @@
65
65
  button_container_classes = %w(gem-c-layout-super-navigation-header__button-container)
66
66
  button_container_classes << "gem-c-layout-super-navigation-header__button-container--large-navbar" if large_navbar
67
67
 
68
+ dropdown_menu_classes = %w(gem-c-layout-super-navigation-header__navigation-dropdown-menu)
69
+ dropdown_menu_classes << "gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar" if large_navbar
68
70
 
71
+ popular_links_heading_classes = %w(govuk-heading-m)
72
+ popular_links_heading_classes << "gem-c-layout-super-navigation-header__popular-links-heading--large-navbar" if large_navbar
69
73
  %>
70
74
  <%= content_tag("header",
71
75
  {
@@ -107,6 +111,11 @@
107
111
  label: logo_link_title,
108
112
  }
109
113
  } do %>
114
+ <% if hide_logo_text %>
115
+ <span class="govuk-visually-hidden">
116
+ <%= logo_text %>
117
+ </span>
118
+ <% end %>
110
119
  <span class="govuk-header__logotype">
111
120
  <!--[if gt IE 8]><!-->
112
121
  <%= content_tag(:svg, {
@@ -270,10 +279,11 @@
270
279
  <% end %>
271
280
  </div>
272
281
 
273
- <div
274
- id="super-navigation-menu-<%= unique_id %>" hidden
275
- class="gem-c-layout-super-navigation-header__navigation-dropdown-menu"
276
- >
282
+ <%= content_tag(:div, {
283
+ id: "super-navigation-menu-#{unique_id}",
284
+ hidden: "",
285
+ class: dropdown_menu_classes,
286
+ }) do %>
277
287
  <div class="govuk-width-container">
278
288
  <div class="govuk-grid-row gem-c-layout-super-navigation-header__navigation-items">
279
289
 
@@ -330,9 +340,13 @@
330
340
  <% end %>
331
341
  </div>
332
342
  </div>
333
- </div>
343
+ <% end %>
334
344
 
335
- <div id="super-search-menu" hidden class="gem-c-layout-super-navigation-header__navigation-dropdown-menu">
345
+ <%= content_tag(:div, {
346
+ id: "super-search-menu",
347
+ hidden: "",
348
+ class: dropdown_menu_classes,
349
+ }) do %>
336
350
  <div class="govuk-width-container gem-c-layout-super-navigation-header__search-container gem-c-layout-super-navigation-header__search-items">
337
351
  <h3 class="govuk-visually-hidden">
338
352
  <%= navigation_search_subheading %>
@@ -345,6 +359,7 @@
345
359
  data-module="ga4-form-tracker"
346
360
  data-ga4-form='{ "event_name": "search", "type": "header menu bar", "section": "Search GOV.UK", "action": "search", "url": "/search/all" }'
347
361
  data-ga4-form-include-text
362
+ data-ga4-form-no-answer-undefined
348
363
  action="/search"
349
364
  method="get"
350
365
  role="search"
@@ -354,7 +369,9 @@
354
369
  inline_label: false,
355
370
  label_size: "m",
356
371
  label_text: search_text,
372
+ label_custom_class: "gem-c-layout-super-navigation-header__search-label--large-navbar",
357
373
  size: "large",
374
+ margin_bottom: 0,
358
375
  data_attributes: {
359
376
  track_category: "headerClicked",
360
377
  track_action: "searchSubmitted",
@@ -368,7 +385,11 @@
368
385
  </div>
369
386
  <div class="govuk-grid-row">
370
387
  <div class="govuk-grid-column-full">
371
- <h3 class="govuk-heading-m"><%= popular_links_heading %></h3>
388
+ <%= content_tag(:h3, {
389
+ class: popular_links_heading_classes
390
+ }) do %>
391
+ <%= popular_links_heading %>
392
+ <% end %>
372
393
  <ul class="govuk-list">
373
394
  <% index_total = popular_links.length %>
374
395
  <% popular_links.each_with_index do | popular_link, index | %>
@@ -401,7 +422,7 @@
401
422
  </div>
402
423
  </div>
403
424
  </div>
404
- </div>
425
+ <% end %>
405
426
  </nav>
406
427
  </div>
407
428
  <% end %>
@@ -9,6 +9,7 @@
9
9
 
10
10
  other ||= nil
11
11
  inverse ||= false
12
+ inverse_compress ||= false
12
13
 
13
14
  direction_class = ""
14
15
  direction_class = " direction-#{direction}" if local_assigns.include?(:direction)
@@ -16,7 +17,13 @@
16
17
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
17
18
  classes = %w(gem-c-metadata)
18
19
  classes << "direction-#{direction}" if local_assigns.include?(:direction)
19
- classes << "gem-c-metadata--inverse" if inverse
20
+
21
+ if inverse && inverse_compress
22
+ classes << "gem-c-metadata--inverse"
23
+ elsif inverse
24
+ classes << "gem-c-metadata--inverse gem-c-metadata--inverse-padded"
25
+ end
26
+
20
27
  classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
21
28
 
22
29
  ga4_tracking ||= false
@@ -11,6 +11,7 @@
11
11
  label_margin_bottom ||= nil
12
12
  label_size ||= nil
13
13
  label_text ||= t("components.search_box.label")
14
+ label_custom_class ||= nil
14
15
  name ||= "q"
15
16
  homepage ||= false
16
17
  no_border ||= false
@@ -42,6 +43,7 @@
42
43
  label_classes << "gem-c-search__label"
43
44
  end
44
45
  label_classes << "govuk-!-margin-bottom-#{label_margin_bottom}" if [*1..9].include?(label_margin_bottom) and local_assigns.include?(:inline_label)
46
+ label_classes << label_custom_class if label_custom_class
45
47
 
46
48
  tag_label = capture do
47
49
  tag.label(for: id, class: label_classes) do
@@ -355,6 +355,26 @@ examples:
355
355
  see_updates_link: true
356
356
  other:
357
357
  Applies to: England, Scotland, and Wales (see detailed guidance for <a href="http://www.dardni.gov.uk/news-dard-pa022-a-13-new-procedure-for" rel="external">Northern Ireland</a>)
358
+ on_a_dark_background_without_padding:
359
+ description: By default the inverse option includes extra spacing around the component. This option removes this padding. Note that both the `inverse` and `inverse_compress` options must be supplied.
360
+ data:
361
+ inverse: true
362
+ inverse_compress: true
363
+ from: [
364
+ "<a href='/government/organisations/ministry-of-defence'>Ministry of Defence</a>",
365
+ "<a href='/government/organisations/cabinet-office'>Cabinet Office</a>",
366
+ "<a href=\"/government/organisations/department-for-business-energy-and-industrial-strategy\">Department for Business, Energy &amp; Industrial Strategy</a>",
367
+ "<a href=\"/government/organisations/foreign-commonwealth-office\">Foreign &amp; Commonwealth Office</a>",
368
+ "<a href=\"/government/people/william-hague\">The Rt Hon William Hague</a>",
369
+ "<a href=\"/government/organisations/department-for-environment-food-rural-affairs\">Department for Environment, Food &amp; Rural Affairs</a>",
370
+ "<a href=\"/government/organisations/department-for-work-pensions\">Department for work and pensions</a>",
371
+ "<a href=\"/government/organisations/foreign-commonwealth-office\">Foreign and Commonwealth Office</a>"
372
+ ]
373
+ first_published: 14 June 2014
374
+ last_updated: 10 September 2015
375
+ see_updates_link: true
376
+ other:
377
+ Applies to: England, Scotland, and Wales (see detailed guidance for <a href="http://www.dardni.gov.uk/news-dard-pa022-a-13-new-procedure-for" rel="external">Northern Ireland</a>)
358
378
  with_custom_margin_bottom:
359
379
  description: |
360
380
  The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to the `margin-bottom` values defined in the [responsive-bottom-margin mixin](https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/stylesheets/govuk_publishing_components/components/mixins/_margins.scss#L1)
@@ -108,3 +108,8 @@ examples:
108
108
  data:
109
109
  label_margin_bottom: 9
110
110
  inline_label: false
111
+ with_custom_label_class:
112
+ description: |
113
+ Allows adding a custom class to the label of the component.
114
+ data:
115
+ label_custom_class: "govuk-heading-xl"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.20.0".freeze
2
+ VERSION = "35.21.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: 35.20.0
4
+ version: 35.21.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: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config