govuk_publishing_components 27.10.5 → 27.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +136 -55
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +30 -0
  5. data/app/models/govuk_publishing_components/shared_accessibility_criteria.rb +17 -0
  6. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +29 -41
  7. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +23 -0
  8. data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +32 -0
  9. data/app/views/govuk_publishing_components/components/search/_search_icon.html.erb +5 -5
  10. data/config/locales/en.yml +7 -3
  11. data/lib/govuk_publishing_components/version.rb +1 -1
  12. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +2 -2
  13. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +3 -3
  14. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +3 -4
  15. data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +9 -0
  16. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +6 -6
  17. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +14 -0
  18. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +8 -8
  19. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +1 -1
  20. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +5 -5
  21. data/node_modules/govuk-frontend/govuk/components/details/_index.scss +2 -1
  22. data/node_modules/govuk-frontend/govuk/components/details/macro-options.json +2 -2
  23. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +3 -3
  24. data/node_modules/govuk-frontend/govuk/components/fieldset/macro-options.json +1 -1
  25. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +1 -0
  26. data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +4 -4
  27. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +3 -0
  28. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +2 -2
  29. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +6 -6
  30. data/node_modules/govuk-frontend/govuk/components/hint/macro-options.json +1 -1
  31. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +7 -7
  32. data/node_modules/govuk-frontend/govuk/components/inset-text/macro-options.json +1 -1
  33. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
  34. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +13 -1
  35. data/node_modules/govuk-frontend/govuk/components/panel/macro-options.json +1 -1
  36. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +14 -0
  37. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +8 -8
  38. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +3 -3
  39. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +2 -2
  40. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +7 -7
  41. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +4 -4
  42. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +5 -5
  43. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +2 -2
  44. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +22 -4
  45. data/node_modules/govuk-frontend/govuk/overrides/_all.scss +1 -0
  46. data/node_modules/govuk-frontend/govuk/overrides/_text-align.scss +20 -0
  47. data/node_modules/govuk-frontend/package.json +1 -1
  48. metadata +6 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cf2ebcbfd20fc146d07f7edcacf06c2c0dec708408c27217ff04e9475bbedc1
4
- data.tar.gz: b03ddc5f4e26590d295a75aaca6f97f18659e3ceeec6a7714d9fe093ea617eb9
3
+ metadata.gz: 4cdfb123c38b321591389c84e2e9b397c5667f9782bc657efaaa59468d535f6a
4
+ data.tar.gz: 8d71ce616148c775034f93537252b16b40b134918ed34ff46bfb971963f93ca4
5
5
  SHA512:
6
- metadata.gz: 94559c60b8dd1124dd1096ec430a87f6c601efcb6a9f02af1ba85f705d1dd22971d2626f1b46627152a2c4e75b832c9a88ca664eac84a3534297688ab9ff2469
7
- data.tar.gz: 534dc11dadc43079d31f952ce41a51615209367cbd48850f1f02b7f1af12402d06aca99c586fcdeb5464645cc226a8713f13b850eb9409677ac931b733cb60fc
6
+ metadata.gz: 16d792dd3e4cdf1350cf32bd1b5090e7dfe097ae3bbad51637b820745fb84d0ddb9ef9b0aa697c100f721ff9845c519cd335b1c459a10ba392c883eaaaca7cb0
7
+ data.tar.gz: 02a880a029f8991916315ed45ca24e87bdc59db3c426966b005f8ab043f21fbcb9a7c00fcc9686a4e12a6fe6502168f4d022fdc0c32f5cbebcc1a2e5c54d7e71
@@ -68,6 +68,7 @@ $govuk-new-link-styles: true;
68
68
  @import "components/select";
69
69
  @import "components/share-links";
70
70
  @import "components/show-password";
71
+ @import "components/single-page-notification-button";
71
72
  @import "components/skip-link";
72
73
  @import "components/step-by-step-nav-header";
73
74
  @import "components/step-by-step-nav-related";
@@ -46,6 +46,10 @@
46
46
  grid-template-columns: fractions($columns);
47
47
  -ms-grid-rows: fractions($rows);
48
48
  grid-template-rows: fractions($rows);
49
+ }
50
+
51
+ @mixin columns-children($items, $columns, $selector: "*") {
52
+ $rows: ceil($items / $columns);
49
53
 
50
54
  // Internet Explorer 10-11 require each element to be placed in the grid -
51
55
  // the `grid-auto-flow` property isn't supported. This means that both the
@@ -556,38 +560,39 @@ $chevron-indent-spacing: 7px;
556
560
 
557
561
  // Styles for top level navigation toggle button.
558
562
  .gem-c-layout-super-navigation-header__navigation-top-toggle-button {
559
- @include govuk-font($size: 19, $weight: "bold", $line-height: 20px);
563
+ @include govuk-link-common;
564
+ @include govuk-link-style-no-visited-state;
565
+ @include govuk-link-style-no-underline;
566
+
567
+ font-size: 16px;
568
+ @if $govuk-typography-use-rem {
569
+ font-size: govuk-px-to-rem(16px);
570
+ }
571
+ font-weight: 700;
560
572
  background: govuk-colour("black");
561
573
  border: 0;
562
- border-left: 1px solid govuk-colour("white");
563
- border-right: 1px solid govuk-colour("white");
564
574
  box-sizing: border-box;
565
575
  color: govuk-colour("white");
566
576
  cursor: pointer;
567
577
  height: govuk-spacing(9);
568
- margin-right: -1px;
569
- padding: govuk-spacing(4);
578
+ padding: 0;
570
579
  position: absolute;
571
- right: (govuk-spacing(9) - govuk-spacing(3));
580
+ right: ((govuk-spacing(9) - govuk-spacing(3)) - 1px); // width of the search button (60px) - 15px - 1px to create an overlap between buttons and stop the border appearing to hang off the buttons when they're focused/open
572
581
  top: 0;
573
-
574
- @include govuk-media-query($from: 360px) {
575
- right: govuk-spacing(9);
576
-
577
- &:before {
578
- @include chevron(govuk-colour("white"));
579
- }
580
- }
582
+ z-index: 10;
581
583
 
582
584
  @include focus-and-focus-visible {
583
585
  @include govuk-focused-text;
584
- border-color: $govuk-focus-colour;
585
586
  box-shadow: none;
586
- z-index: 10;
587
587
 
588
- @include govuk-media-query($from: 360px) {
589
- &:before {
590
- @include chevron(govuk-colour("black"), true);
588
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
589
+ border-color: $govuk-focus-colour;
590
+ color: govuk-colour("black");
591
+
592
+ @include govuk-media-query($from: 360px) {
593
+ &:before {
594
+ @include chevron(govuk-colour("black"), true);
595
+ }
591
596
  }
592
597
  }
593
598
  }
@@ -596,42 +601,70 @@ $chevron-indent-spacing: 7px;
596
601
  // See https://www.tpgi.com/focus-visible-and-backwards-compatibility/
597
602
  @include focus-not-focus-visible {
598
603
  background: none;
599
- border-color: govuk-colour("white");
600
604
  box-shadow: none;
601
- color: govuk-colour("white");
602
605
 
603
- @include govuk-media-query($from: 360px) {
604
- &:before {
605
- @include chevron(govuk-colour("white"), true);
606
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
607
+ border-color: govuk-colour("white");
608
+ color: govuk-colour("white");
609
+
610
+ @include govuk-media-query($from: 360px) {
611
+ &:before {
612
+ @include chevron(govuk-colour("white"), true);
613
+ }
606
614
  }
607
615
  }
608
616
  }
609
617
 
610
618
  // Open button modifier
611
619
  &.gem-c-layout-super-navigation-header__open-button {
620
+ // stylelint-disable max-nesting-depth
612
621
  @include focus-and-focus-visible {
613
622
  @include govuk-focused-text;
614
- border-color: $govuk-focus-colour;
615
623
  box-shadow: none;
616
- color: $govuk-focus-colour;
617
624
 
618
- @include govuk-media-query($from: 360px) {
619
- &:before {
620
- @include chevron($govuk-focus-colour, true);
625
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
626
+ color: govuk-colour("black");
627
+ border-color: $govuk-focus-colour;
628
+
629
+ @include govuk-media-query($from: 360px) {
630
+ &:before {
631
+ @include chevron(govuk-colour("black"), true);
632
+ transform: translateY(0) rotate(225deg);
633
+ }
621
634
  }
622
635
  }
623
636
  }
624
637
 
625
638
  @include focus-not-focus-visible {
626
639
  background: govuk-colour("light-grey");
627
- color: govuk-colour("light-grey");
628
640
 
629
- @include govuk-media-query($from: 360px) {
630
- &:before {
631
- @include chevron(govuk-colour("light-grey"));
641
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
642
+ color: govuk-colour("black");
643
+ border-color: govuk-colour("light-grey");
644
+
645
+ @include govuk-media-query($from: 360px) {
646
+ &:before {
647
+ @include chevron(govuk-colour("black"));
648
+ transform: translateY(0) rotate(225deg);
649
+ }
632
650
  }
633
651
  }
634
652
  }
653
+ // stylelint-enable max-nesting-depth
654
+ }
655
+ }
656
+
657
+ .gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner {
658
+ display: inline-block;
659
+ border-left: 1px solid govuk-colour("white");
660
+ border-right: 1px solid govuk-colour("white");
661
+ margin: govuk-spacing(2) 0;
662
+ padding: govuk-spacing(2) govuk-spacing(4);
663
+
664
+ @include govuk-media-query($from: 360px) {
665
+ &:before {
666
+ @include chevron(govuk-colour("white"));
667
+ }
635
668
  }
636
669
  }
637
670
 
@@ -640,7 +673,6 @@ $chevron-indent-spacing: 7px;
640
673
  @include govuk-font($size: 19, $weight: "bold", $line-height: 20px);
641
674
  background: govuk-colour("black");
642
675
  border: 0;
643
- border-left: 1px solid govuk-colour("white");
644
676
  color: govuk-colour("white");
645
677
  cursor: pointer;
646
678
  height: govuk-spacing(9);
@@ -654,6 +686,7 @@ $chevron-indent-spacing: 7px;
654
686
  @include govuk-focused-text;
655
687
  border-color: $govuk-focus-colour;
656
688
  box-shadow: none;
689
+ z-index: 11;
657
690
  }
658
691
 
659
692
  &:focus:not(:focus-visible) {
@@ -663,14 +696,12 @@ $chevron-indent-spacing: 7px;
663
696
  color: govuk-colour("white");
664
697
  }
665
698
 
666
- @include govuk-media-query($from: 360px) {
699
+ @include govuk-media-query($from: "desktop") {
667
700
  right: 0;
668
- }
669
701
 
670
- @include govuk-media-query($from: "desktop") {
671
702
  @include focus-not-focus-visible {
672
703
  background: $govuk-brand-colour;
673
- border-bottom: 1px solid govuk-colour("black");
704
+ border-bottom: 1px solid govuk-colour("dark-blue");
674
705
  border-left: none;
675
706
  position: relative;
676
707
  }
@@ -776,9 +807,7 @@ $chevron-indent-spacing: 7px;
776
807
 
777
808
  & > li {
778
809
  box-sizing: border-box;
779
- margin-bottom: 0;
780
- padding-left: govuk-spacing(3);
781
- padding-right: govuk-spacing(3);
810
+ margin: 0 govuk-spacing(3) govuk-spacing(2) govuk-spacing(3);
782
811
  }
783
812
  }
784
813
  }
@@ -786,13 +815,62 @@ $chevron-indent-spacing: 7px;
786
815
  .gem-c-layout-super-navigation-header__navigation-second-items--topics {
787
816
  @include govuk-media-query($from: "desktop") {
788
817
  @include columns(18, 2, "li");
818
+ @include columns-children(18, 2, "li");
789
819
  }
790
820
  }
791
821
 
792
822
  .gem-c-layout-super-navigation-header__navigation-second-items--government-activity {
823
+ & > li:first-child {
824
+ margin-bottom: govuk-spacing(7);
825
+ }
826
+
793
827
  @include govuk-media-query($from: "desktop") {
794
- @include columns(5, 2, "li");
795
- padding-bottom: govuk-spacing(3);
828
+ @include columns(7, 2, "li");
829
+ padding-bottom: 0;
830
+
831
+ & > li,
832
+ & > li:first-child {
833
+ margin-bottom: govuk-spacing(4);
834
+ }
835
+
836
+ @supports (display: grid) {
837
+ & > li:first-child {
838
+ grid-column: span 2;
839
+ }
840
+ }
841
+
842
+ & > li:first-child {
843
+ border-bottom: 1px solid $govuk-border-colour;
844
+ padding-bottom: 0;
845
+ -ms-grid-column-span: 2;
846
+ -ms-grid-column: 1;
847
+ -ms-grid-row: 1;
848
+ }
849
+
850
+ & > li:nth-child(2) {
851
+ -ms-grid-column: 1;
852
+ -ms-grid-row: 2;
853
+ }
854
+
855
+ & > li:nth-child(3) {
856
+ -ms-grid-column: 1;
857
+ -ms-grid-row: 3;
858
+ }
859
+
860
+ & > li:nth-child(4) {
861
+ -ms-grid-column: 1;
862
+ -ms-grid-row: 4;
863
+ }
864
+
865
+ & > li:nth-child(5) {
866
+ -ms-grid-column: 2;
867
+ -ms-grid-row: 2;
868
+ }
869
+
870
+ & > li:nth-child(6) {
871
+ -ms-grid-column: 2;
872
+ -ms-grid-row: 3;
873
+ }
796
874
  }
797
875
  }
798
876
 
@@ -804,6 +882,10 @@ $chevron-indent-spacing: 7px;
804
882
  @include govuk-media-query($from: "desktop") {
805
883
  font-weight: bold;
806
884
  padding: 0;
885
+
886
+ &:after {
887
+ content: none;
888
+ }
807
889
  }
808
890
  }
809
891
 
@@ -814,19 +896,21 @@ $chevron-indent-spacing: 7px;
814
896
  }
815
897
 
816
898
  // Dropdown menu footer links.
817
- .gem-c-layout-super-navigation-header__navigation-second-footer {
818
- border-top: 1px solid govuk-colour("mid-grey");
899
+ .gem-c-layout-super-navigation-header__navigation-second-footer-break {
900
+ @include govuk-media-query($until: "desktop") {
901
+ display: none;
902
+ }
819
903
  }
820
904
 
821
905
  .gem-c-layout-super-navigation-header__navigation-second-footer-list {
822
906
  list-style: none;
823
- padding-bottom: govuk-spacing(8);
824
- padding-top: govuk-spacing(4);
825
-
826
- @include govuk-grid-column($width: "two-thirds", $float: right, $at: "desktop");
907
+ padding: 0 0 govuk-spacing(8) 0;
827
908
 
828
909
  @include govuk-media-query($from: "desktop") {
829
- padding: govuk-spacing(7) 0 govuk-spacing(8) 0;
910
+ margin: 0 (0 - govuk-spacing(3)) 0 (0 - govuk-spacing(3));
911
+ padding: govuk-spacing(8) 0 govuk-spacing(9) 0;
912
+ @include columns(2, 2, "li");
913
+ @include columns-children(2, 2, "li");
830
914
  }
831
915
  }
832
916
 
@@ -835,15 +919,12 @@ $chevron-indent-spacing: 7px;
835
919
  position: relative;
836
920
 
837
921
  @include govuk-media-query($from: "desktop") {
838
- box-sizing: border-box;
839
- float: left;
840
- padding: 0 govuk-spacing(3);
841
- width: 50%;
922
+ padding: 0 govuk-spacing(3) 0 govuk-spacing(3);
842
923
  }
843
924
  }
844
925
 
845
926
  .gem-c-layout-super-navigation-header__navigation-second-footer-link {
846
- @include govuk-font($size: 19, $weight: bold);
927
+ @include govuk-font($size: 19, $weight: normal);
847
928
  display: inline-block;
848
929
  margin: govuk-spacing(1) 0;
849
930
 
@@ -0,0 +1,30 @@
1
+ .gem-c-single-page-notification-button__submit {
2
+ padding: govuk-spacing(2);
3
+ margin: govuk-spacing(0);
4
+ border: 1px solid $govuk-border-colour;
5
+ color: $govuk-link-colour;
6
+ cursor: pointer;
7
+ background: none;
8
+
9
+ &:focus {
10
+ @include govuk-focused-text;
11
+ background-color: $govuk-focus-colour;
12
+ border-color: transparent;
13
+ box-shadow: 0 $govuk-focus-width $govuk-text-colour;
14
+ }
15
+
16
+ &:hover {
17
+ background-color: govuk-colour("light-grey");
18
+ color: $govuk-link-hover-colour;
19
+
20
+ &:focus {
21
+ color: $govuk-text-colour;
22
+ }
23
+ }
24
+ }
25
+
26
+ .gem-c-single-page-notification-button__icon {
27
+ color: govuk-colour("black");
28
+ vertical-align: top;
29
+ margin-right: govuk-spacing(1);
30
+ }
@@ -4,6 +4,23 @@ module GovukPublishingComponents
4
4
  "
5
5
  Links in the component must:
6
6
 
7
+ - accept focus
8
+ - be focusable with a keyboard
9
+ - be usable with a keyboard
10
+ - indicate when they have focus
11
+ - change in appearance when touched (in the touch-down state)
12
+ - change in appearance when hovered
13
+ - be usable with touch
14
+ - be usable with [voice commands](https://www.w3.org/WAI/perspectives/voice.html)
15
+ - have visible text
16
+ - have meaningful text
17
+ "
18
+ end
19
+
20
+ def self.button
21
+ "
22
+ Buttons in the component must:
23
+
7
24
  - accept focus
8
25
  - be focusable with a keyboard
9
26
  - be usable with a keyboard
@@ -80,13 +80,8 @@
80
80
  id="super-navigation-menu-toggle"
81
81
  type="button"
82
82
  >
83
- Menu
84
- <span
85
- aria-hidden="true"
86
- class="gem-c-layout-super-navigation-header__navigation-top-toggle-close-icon"
87
- focusable="false"
88
- >
89
- &times;
83
+ <span class="gem-c-layout-super-navigation-header__navigation-top-toggle-button-inner">
84
+ Menu
90
85
  </span>
91
86
  </button>
92
87
  <ul id="super-navigation-menu" class="gem-c-layout-super-navigation-header__navigation-items">
@@ -147,8 +142,8 @@
147
142
  </p>
148
143
  <% end %>
149
144
  </div>
150
- <% if link[:menu_contents].present? %>
151
- <div class="govuk-grid-column-two-thirds-from-desktop">
145
+ <div class="govuk-grid-column-two-thirds-from-desktop">
146
+ <% if link[:menu_contents].present? %>
152
147
  <ul class="govuk-list gem-c-layout-super-navigation-header__navigation-second-items gem-c-layout-super-navigation-header__navigation-second-items--<%= link[:label].parameterize %>">
153
148
  <% link[:menu_contents].each do | item | %>
154
149
  <%
@@ -172,39 +167,32 @@
172
167
  </li>
173
168
  <% end %>
174
169
  </ul>
175
- </div>
176
- <% end %>
177
- </div>
178
- <% if link[:footer_links].present? %>
179
- <div class="govuk-grid-row">
180
- <div class="govuk-grid-column-full">
181
- <div class="gem-c-layout-super-navigation-header__navigation-second-footer">
182
- <div class="govuk-grid-row">
183
- <ul class="gem-c-layout-super-navigation-header__navigation-second-footer-list">
184
- <% link[:footer_links].each do | item | %>
185
- <li class="gem-c-layout-super-navigation-header__navigation-second-footer-item">
186
- <%= link_to item[:label], item[:href], {
187
- class: [
188
- "govuk-link",
189
- "gem-c-layout-super-navigation-header__navigation-second-footer-link",
190
- ],
191
- data: {
192
- module: "gem-track-click",
193
- track_action: "#{tracking_label}Link",
194
- track_category: "headerClicked",
195
- track_label: item[:href],
196
- track_dimension: item[:label],
197
- track_dimension_index: "29",
198
- }
199
- } %>
200
- </li>
201
- <% end %>
202
- </ul>
203
- </div>
204
- </div>
205
- </div>
170
+ <% end %>
171
+ <% if link[:footer_links].present? %>
172
+ <hr class="gem-c-layout-super-navigation-header__navigation-second-footer-break govuk-section-break govuk-section-break--visible">
173
+ <ul class="gem-c-layout-super-navigation-header__navigation-second-footer-list">
174
+ <% link[:footer_links].each do | item | %>
175
+ <li class="gem-c-layout-super-navigation-header__navigation-second-footer-item">
176
+ <%= link_to item[:label], item[:href], {
177
+ class: [
178
+ "govuk-link",
179
+ "gem-c-layout-super-navigation-header__navigation-second-footer-link",
180
+ ],
181
+ data: {
182
+ module: "gem-track-click",
183
+ track_action: "#{tracking_label}Link",
184
+ track_category: "headerClicked",
185
+ track_label: item[:href],
186
+ track_dimension: item[:label],
187
+ track_dimension_index: "29",
188
+ }
189
+ } %>
190
+ </li>
191
+ <% end %>
192
+ </ul>
193
+ <% end %>
206
194
  </div>
207
- <% end %>
195
+ </div>
208
196
  </div>
209
197
  </div>
210
198
  <% end %>
@@ -0,0 +1,23 @@
1
+ <%
2
+ page ||= ''
3
+ data_attributes ||= {}
4
+ base_path ||= nil
5
+ local_assigns[:margin_bottom] ||= 3
6
+ already_subscribed ||= false
7
+ text ||= already_subscribed ? t('components.single_page_notification_button.unsubscribe_text') : t('components.single_page_notification_button.subscribe_text')
8
+
9
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
10
+ wrapper_classes = %w(gem-c-single-page-notification-button govuk-!-display-none-print)
11
+ wrapper_classes << shared_helper.get_margin_bottom
12
+ classes = "govuk-body-s gem-c-single-page-notification-button__submit"
13
+ %>
14
+ <% button_text = capture do %>
15
+ <svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z"/></svg><%= text %>
16
+ <% end %>
17
+ <%= tag.form class: wrapper_classes, action: "/email/subscriptions/single-page/new", method: "POST", data: data_attributes do %>
18
+ <input type="hidden" name="base_path" value="<%= base_path %>">
19
+ <%= content_tag(:button, button_text, {
20
+ class: classes,
21
+ type: "submit",
22
+ }) %>
23
+ <% end if base_path.presence %>
@@ -0,0 +1,32 @@
1
+ name: Single page notification button
2
+ description: A button that subscribes the user to email notifications to a page
3
+ body: |
4
+ By default, the component displays with the "Get emails about this page" state. The component does not render without the `base_path` parameter.
5
+
6
+ The `base_path` is necessary for [checking if an email subscription is active on page load](https://github.com/alphagov/account-api/blob/main/docs/api.md#get-apipersonalisationcheck-email-subscriptiontopic_slug) and the creation/deletion of an email notification subscription.
7
+
8
+ When the button is clicked, the `base_path` is submitted to an endpoint which proceeds to check the user's authentication status and whether they are already subscribed to the page or not. Depending on these factors, they will be routed accordingly.
9
+ accessibility_criteria: |
10
+ - The bell icon must be presentational and ignored by screen readers.
11
+ examples:
12
+ default:
13
+ description: By default this component prompts the user to subscribe to email notifications to this page.
14
+ data:
15
+ base_path: '/current-page-path'
16
+ already_subscribed:
17
+ description: If the user has already subscribed to email notifications about the current page, display the "Stop getting emails about this page" state.
18
+ data:
19
+ base_path: '/current-page-path'
20
+ already_subscribed: true
21
+ with_data_attributes:
22
+ description: The component accepts data attributes (for example, for analytics)
23
+ data:
24
+ base_path: '/current-page-path'
25
+ data_attributes:
26
+ category: fancyButtons
27
+ with_margin_bottom:
28
+ description: |
29
+ 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 having a margin bottom of 15px.
30
+ data:
31
+ base_path: '/current-page-path'
32
+ margin_bottom: 5
@@ -13,15 +13,15 @@
13
13
  focusable="false"
14
14
  >
15
15
  <circle
16
- cx="10.0161"
17
- cy="10.0161"
16
+ cx="12.0161"
17
+ cy="11.0161"
18
18
  r="8.51613"
19
19
  stroke="currentColor"
20
20
  stroke-width="3" />
21
21
  <line
22
- x1="15.8668"
23
- y1="16.3587"
24
- x2="25.4475"
22
+ x1="17.8668"
23
+ y1="17.3587"
24
+ x2="26.4475"
25
25
  y2="25.9393"
26
26
  stroke="currentColor"
27
27
  stroke-width="3" />
@@ -157,13 +157,14 @@ en:
157
157
  href: "/browse/visas-immigration"
158
158
  - label: Working, jobs and pensions
159
159
  href: "/browse/working"
160
- - label: Departments
161
- href: "/government/organisations"
162
160
  - label: Government activity
163
161
  href: "/search/news-and-communications"
164
- description: Find out what the government is doing
162
+ description: Search for a department and find out what the government is doing
165
163
  menu_contents: # If adding or removing items, remember to update the
166
164
  # `columns` in the layout-super-navigation-header SCSS.
165
+ - label: Departments
166
+ href: "/government/organisations"
167
+ description: Departments, agencies and public bodies
167
168
  - label: News
168
169
  href: "/search/news-and-communications"
169
170
  description: News stories, speeches, letters and notices
@@ -257,6 +258,9 @@ en:
257
258
  hide_password: Hide password
258
259
  show: Show
259
260
  show_password: Show password
261
+ single_page_notification_button:
262
+ subscribe_text: Get emails about this page
263
+ unsubscribe_text: Stop getting emails about this page
260
264
  skip_link:
261
265
  text: Skip to main content
262
266
  step_by_step_nav:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "27.10.5".freeze
2
+ VERSION = "27.11.0".freeze
3
3
  end
@@ -3,13 +3,13 @@
3
3
  "name": "id",
4
4
  "type": "string",
5
5
  "required": true,
6
- "description": "Must be **unique** across the domain of your service (as the expanded state of individual instances of the component persists across page loads using [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)). Used as an `id` in the HTML for the accordion as a whole, and also as a prefix for the `id`s of the section contents and the buttons that open them, so that those `id`s can be the target of `aria-labelledby` and `aria-control` attributes."
6
+ "description": "Must be unique across the domain of your service (as the expanded state of individual instances of the component persists across page loads using [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage)). Used as an `id` in the HTML for the accordion as a whole, and also as a prefix for the `id`s of the section contents and the buttons that open them, so that those `id`s can be the target of `aria-labelledby` and `aria-control` attributes."
7
7
  },
8
8
  {
9
9
  "name": "headingLevel",
10
10
  "type": "integer",
11
11
  "required": false,
12
- "description": "Heading level, from 1 to 6. Default is `2`."
12
+ "description": "Heading level, from `1` to `6`. Default is `2`."
13
13
  },
14
14
  {
15
15
  "name": "classes",
@@ -3,19 +3,19 @@
3
3
  "name": "text",
4
4
  "type": "string",
5
5
  "required": false,
6
- "description": "Text to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to \"Back\"."
6
+ "description": "Text to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to 'Back'."
7
7
  },
8
8
  {
9
9
  "name": "html",
10
10
  "type": "string",
11
11
  "required": false,
12
- "description": "HTML to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to \"Back\"."
12
+ "description": "HTML to use within the back link component. If `html` is provided, the `text` argument will be ignored. Defaults to 'Back'."
13
13
  },
14
14
  {
15
15
  "name": "href",
16
16
  "type": "string",
17
17
  "required": true,
18
- "description": "The value of the link href attribute."
18
+ "description": "The value of the link's `href` attribute."
19
19
  },
20
20
  {
21
21
  "name": "classes",
@@ -158,10 +158,6 @@
158
158
  cursor: default;
159
159
  }
160
160
 
161
- &:focus {
162
- outline: none;
163
- }
164
-
165
161
  &:active {
166
162
  top: 0;
167
163
  box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
@@ -270,6 +266,9 @@
270
266
  -webkit-align-self: center;
271
267
  -ms-flex-item-align: center;
272
268
  align-self: center;
269
+ // Work around SVGs not inheriting color from parent in forced color mode
270
+ // (https://github.com/w3c/csswg-drafts/issues/6310)
271
+ forced-color-adjust: auto;
273
272
  }
274
273
 
275
274
  @if $govuk-use-legacy-font {