govuk_tech_docs 2.2.2 → 2.4.2

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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.nvmrc +1 -1
  4. data/.travis.yml +2 -0
  5. data/CHANGELOG.md +24 -0
  6. data/example/config/tech-docs.yml +1 -0
  7. data/example/source/single-page-nav.html.md +13 -0
  8. data/govuk_tech_docs.gemspec +2 -1
  9. data/lib/assets/javascripts/_modules/collapsible-navigation.js +7 -7
  10. data/lib/assets/javascripts/_modules/in-page-navigation.js +2 -4
  11. data/lib/assets/stylesheets/_govuk_tech_docs.scss +9 -10
  12. data/lib/assets/stylesheets/modules/_search.scss +4 -25
  13. data/lib/assets/stylesheets/modules/_technical-documentation.scss +1 -1
  14. data/lib/assets/stylesheets/modules/_toc.scss +11 -11
  15. data/lib/govuk_tech_docs/table_of_contents/heading.rb +5 -1
  16. data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +2 -2
  17. data/lib/govuk_tech_docs/table_of_contents/helpers.rb +22 -11
  18. data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +1 -1
  19. data/lib/govuk_tech_docs/version.rb +1 -1
  20. data/lib/source/layouts/_header.erb +1 -2
  21. data/lib/source/layouts/layout.erb +3 -1
  22. data/node_modules/govuk-frontend/govuk/_base.scss +3 -0
  23. data/node_modules/govuk-frontend/govuk/all.js +306 -94
  24. data/node_modules/govuk-frontend/govuk/all.scss +1 -3
  25. data/node_modules/govuk-frontend/govuk/components/_all.scss +33 -29
  26. data/node_modules/govuk-frontend/govuk/components/accordion/_accordion.scss +2 -208
  27. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +197 -0
  28. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +1 -1
  29. data/node_modules/govuk-frontend/govuk/components/back-link/_back-link.scss +2 -65
  30. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +99 -0
  31. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_breadcrumbs.scss +2 -118
  32. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +138 -0
  33. data/node_modules/govuk-frontend/govuk/components/button/_button.scss +2 -284
  34. data/node_modules/govuk-frontend/govuk/components/button/_index.scss +288 -0
  35. data/node_modules/govuk-frontend/govuk/components/character-count/_character-count.scss +2 -31
  36. data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +25 -0
  37. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +17 -9
  38. data/node_modules/govuk-frontend/govuk/components/checkboxes/_checkboxes.scss +2 -308
  39. data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +320 -0
  40. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +129 -24
  41. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_cookie-banner.scss +2 -0
  42. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +51 -0
  43. data/node_modules/govuk-frontend/govuk/components/date-input/_date-input.scss +2 -30
  44. data/node_modules/govuk-frontend/govuk/components/date-input/_index.scss +26 -0
  45. data/node_modules/govuk-frontend/govuk/components/details/_details.scss +2 -88
  46. data/node_modules/govuk-frontend/govuk/components/details/_index.scss +87 -0
  47. data/node_modules/govuk-frontend/govuk/components/error-message/_error-message.scss +2 -15
  48. data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +11 -0
  49. data/node_modules/govuk-frontend/govuk/components/error-summary/_error-summary.scss +2 -59
  50. data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +43 -0
  51. data/node_modules/govuk-frontend/govuk/components/fieldset/_fieldset.scss +2 -68
  52. data/node_modules/govuk-frontend/govuk/components/fieldset/_index.scss +64 -0
  53. data/node_modules/govuk-frontend/govuk/components/file-upload/_file-upload.scss +2 -81
  54. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +49 -0
  55. data/node_modules/govuk-frontend/govuk/components/footer/_footer.scss +2 -244
  56. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +241 -0
  57. data/node_modules/govuk-frontend/govuk/components/header/_header.scss +2 -318
  58. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +331 -0
  59. data/node_modules/govuk-frontend/govuk/components/header/header.js +665 -316
  60. data/node_modules/govuk-frontend/govuk/components/hint/_hint.scss +2 -50
  61. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +44 -0
  62. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +191 -0
  63. data/node_modules/govuk-frontend/govuk/components/input/_input.scss +2 -103
  64. data/node_modules/govuk-frontend/govuk/components/inset-text/_index.scss +24 -0
  65. data/node_modules/govuk-frontend/govuk/components/inset-text/_inset-text.scss +2 -28
  66. data/node_modules/govuk-frontend/govuk/components/label/_index.scss +41 -0
  67. data/node_modules/govuk-frontend/govuk/components/label/_label.scss +2 -45
  68. data/node_modules/govuk-frontend/govuk/components/notification-banner/_index.scss +89 -0
  69. data/node_modules/govuk-frontend/govuk/components/notification-banner/_notification-banner.scss +2 -0
  70. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +61 -0
  71. data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +44 -0
  72. data/node_modules/govuk-frontend/govuk/components/panel/_panel.scss +2 -44
  73. data/node_modules/govuk-frontend/govuk/components/phase-banner/_index.scss +27 -0
  74. data/node_modules/govuk-frontend/govuk/components/phase-banner/_phase-banner.scss +2 -31
  75. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +342 -0
  76. data/node_modules/govuk-frontend/govuk/components/radios/_radios.scss +2 -346
  77. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +76 -28
  78. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +49 -0
  79. data/node_modules/govuk-frontend/govuk/components/select/_select.scss +2 -57
  80. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +36 -0
  81. data/node_modules/govuk-frontend/govuk/components/skip-link/_skip-link.scss +2 -37
  82. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +145 -0
  83. data/node_modules/govuk-frontend/govuk/components/summary-list/_summary-list.scss +2 -157
  84. data/node_modules/govuk-frontend/govuk/components/table/_index.scss +71 -0
  85. data/node_modules/govuk-frontend/govuk/components/table/_table.scss +2 -54
  86. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +130 -0
  87. data/node_modules/govuk-frontend/govuk/components/tabs/_tabs.scss +2 -142
  88. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +86 -0
  89. data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +2 -91
  90. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +47 -0
  91. data/node_modules/govuk-frontend/govuk/components/textarea/_textarea.scss +2 -55
  92. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +66 -0
  93. data/node_modules/govuk-frontend/govuk/components/warning-text/_warning-text.scss +2 -60
  94. data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +5 -3
  95. data/node_modules/govuk-frontend/govuk/core/_links.scss +13 -3
  96. data/node_modules/govuk-frontend/govuk/core/_lists.scss +17 -3
  97. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +5 -3
  98. data/node_modules/govuk-frontend/govuk/core/_template.scss +5 -4
  99. data/node_modules/govuk-frontend/govuk/core/_typography.scss +5 -3
  100. data/node_modules/govuk-frontend/govuk/helpers/_clearfix.scss +1 -1
  101. data/node_modules/govuk-frontend/govuk/helpers/_colour.scss +1 -1
  102. data/node_modules/govuk-frontend/govuk/helpers/_device-pixels.scss +3 -3
  103. data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
  104. data/node_modules/govuk-frontend/govuk/helpers/_font-faces.scss +9 -11
  105. data/node_modules/govuk-frontend/govuk/helpers/_grid.scss +2 -1
  106. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +246 -33
  107. data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +2 -6
  108. data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
  109. data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +3 -2
  110. data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +8 -7
  111. data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +1 -1
  112. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  113. data/node_modules/govuk-frontend/govuk/objects/_button-group.scss +101 -0
  114. data/node_modules/govuk-frontend/govuk/objects/_form-group.scss +1 -4
  115. data/node_modules/govuk-frontend/govuk/objects/_grid.scss +3 -6
  116. data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +5 -4
  117. data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +6 -4
  118. data/node_modules/govuk-frontend/govuk/overrides/_display.scss +6 -4
  119. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +5 -3
  120. data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +5 -3
  121. data/node_modules/govuk-frontend/govuk/overrides/_width.scss +6 -3
  122. data/node_modules/govuk-frontend/govuk/settings/_all.scss +2 -0
  123. data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +11 -5
  124. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
  125. data/node_modules/govuk-frontend/govuk/settings/_colours-palette.scss +42 -35
  126. data/node_modules/govuk-frontend/govuk/settings/_compatibility.scss +0 -1
  127. data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +1 -1
  128. data/node_modules/govuk-frontend/govuk/settings/_links.scss +62 -0
  129. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +4 -5
  130. data/node_modules/govuk-frontend/govuk/settings/_typography-font-families.scss +2 -2
  131. data/node_modules/govuk-frontend/govuk/settings/_typography-font.scss +14 -5
  132. data/node_modules/govuk-frontend/govuk/settings/_typography-responsive.scss +6 -2
  133. data/node_modules/govuk-frontend/govuk/tools/_compatibility.scss +1 -1
  134. data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -4
  135. data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +1 -1
  136. data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -4
  137. data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +1 -1
  138. data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
  139. data/node_modules/govuk-frontend/govuk/utilities/_visually-hidden.scss +0 -1
  140. data/node_modules/govuk-frontend/govuk/vendor/_sass-mq.scss +0 -4
  141. data/package-lock.json +358 -288
  142. data/package.json +2 -2
  143. metadata +56 -4
@@ -0,0 +1,41 @@
1
+ @include govuk-exports("govuk/component/label") {
2
+ .govuk-label {
3
+ @include govuk-font($size: 19);
4
+ @include govuk-text-colour;
5
+
6
+ display: block;
7
+
8
+ margin-bottom: govuk-spacing(1);
9
+ }
10
+
11
+ // Modifiers that make labels look more like their equivalent headings
12
+
13
+ .govuk-label--xl {
14
+ @include govuk-font($size: 48, $weight: bold);
15
+ margin-bottom: govuk-spacing(3);
16
+ }
17
+
18
+ .govuk-label--l {
19
+ @include govuk-font($size: 36, $weight: bold);
20
+ margin-bottom: govuk-spacing(3);
21
+ }
22
+
23
+ .govuk-label--m {
24
+ @include govuk-font($size: 24, $weight: bold);
25
+ margin-bottom: govuk-spacing(2);
26
+ }
27
+
28
+ .govuk-label--s {
29
+ @include govuk-font($size: 19, $weight: bold);
30
+ }
31
+
32
+ // When the label is nested inside a heading, override the heading so that it
33
+ // does not have a margin. Effectively we want to be able to treat the heading
34
+ // as if it is not there.
35
+ //
36
+ // This breaks BEM conventions because it exists as a parent of the 'block',
37
+ // so we can't really consider an element.
38
+ .govuk-label-wrapper {
39
+ margin: 0;
40
+ }
41
+ }
@@ -1,45 +1,2 @@
1
- @import "../../settings/all";
2
- @import "../../tools/all";
3
- @import "../../helpers/all";
4
-
5
- @include govuk-exports("govuk/component/label") {
6
- .govuk-label {
7
- @include govuk-font($size: 19);
8
- @include govuk-text-colour;
9
-
10
- display: block;
11
-
12
- margin-bottom: govuk-spacing(1);
13
- }
14
-
15
- // Modifiers that make labels look more like their equivalent headings
16
-
17
- .govuk-label--xl {
18
- @include govuk-font($size: 48, $weight: bold);
19
- margin-bottom: govuk-spacing(3);
20
- }
21
-
22
- .govuk-label--l {
23
- @include govuk-font($size: 36, $weight: bold);
24
- margin-bottom: govuk-spacing(3);
25
- }
26
-
27
- .govuk-label--m {
28
- @include govuk-font($size: 24, $weight: bold);
29
- margin-bottom: govuk-spacing(2);
30
- }
31
-
32
- .govuk-label--s {
33
- @include govuk-font($size: 19, $weight: bold);
34
- }
35
-
36
- // When the label is nested inside a heading, override the heading so that it
37
- // does not have a margin. Effectively we want to be able to treat the heading
38
- // as if it is not there.
39
- //
40
- // This breaks BEM conventions because it exists as a parent of the 'block',
41
- // so we can't really consider an element.
42
- .govuk-label-wrapper {
43
- margin: 0;
44
- }
45
- }
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,89 @@
1
+ @include govuk-exports("govuk/component/notification-banner") {
2
+ .govuk-notification-banner {
3
+ @include govuk-font($size: 19);
4
+ @include govuk-responsive-margin(8, "bottom");
5
+
6
+ border: $govuk-border-width solid $govuk-brand-colour;
7
+
8
+ background-color: $govuk-brand-colour;
9
+
10
+ &:focus {
11
+ outline: $govuk-focus-width solid $govuk-focus-colour;
12
+ }
13
+ }
14
+
15
+ .govuk-notification-banner__header {
16
+ padding: 2px govuk-spacing(3) govuk-spacing(1);
17
+
18
+ // Ensures the notification header appears separate to the notification body text in high contrast mode
19
+ border-bottom: 1px solid transparent;
20
+
21
+ @include govuk-media-query($from: tablet) {
22
+ padding: 2px govuk-spacing(4) govuk-spacing(1);
23
+ }
24
+ }
25
+
26
+ .govuk-notification-banner__title {
27
+ @include govuk-font($size: 19, $weight: bold);
28
+
29
+ margin: 0;
30
+
31
+ padding: 0;
32
+
33
+ color: govuk-colour("white");
34
+ }
35
+
36
+ .govuk-notification-banner__content {
37
+ $padding-tablet: govuk-spacing(4);
38
+ @include govuk-text-colour;
39
+ padding: govuk-spacing(3);
40
+
41
+ background-color: $govuk-body-background-colour;
42
+
43
+ @include govuk-media-query($from: tablet) {
44
+ padding: $padding-tablet;
45
+ }
46
+
47
+ // Wrap content at the same place that a 2/3 grid column ends, to maintain
48
+ // shorter line-lengths when the notification banner is full width
49
+ > * {
50
+ // When elements have their own padding (like lists), include the padding
51
+ // in the max-width calculation
52
+ box-sizing: border-box;
53
+
54
+ // Calculate the internal width of a two-thirds column...
55
+ $two-col-width: ($govuk-page-width * 2 / 3) - ($govuk-gutter * 1 / 3);
56
+
57
+ // ...and then factor in the left border and padding
58
+ $banner-exterior: ($padding-tablet + $govuk-border-width);
59
+ max-width: $two-col-width - $banner-exterior;
60
+ }
61
+
62
+ > :last-child {
63
+ margin-bottom: 0;
64
+ }
65
+ }
66
+
67
+ .govuk-notification-banner__heading {
68
+ @include govuk-font($size: 24, $weight: bold);
69
+
70
+ margin: 0 0 govuk-spacing(3) 0;
71
+
72
+ padding: 0;
73
+ }
74
+
75
+ .govuk-notification-banner__link {
76
+ @include govuk-link-common;
77
+ @include govuk-link-style-no-visited-state;
78
+ }
79
+
80
+ .govuk-notification-banner--success {
81
+ border-color: $govuk-success-colour;
82
+
83
+ background-color: $govuk-success-colour;
84
+
85
+ .govuk-notification-banner__link {
86
+ @include govuk-link-style-success;
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,2 @@
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,61 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
4
+ (global.GOVUKFrontend = factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ function NotificationBanner ($module) {
8
+ this.$module = $module;
9
+ }
10
+
11
+ /**
12
+ * Initialise the component
13
+ */
14
+ NotificationBanner.prototype.init = function () {
15
+ var $module = this.$module;
16
+ // Check for module
17
+ if (!$module) {
18
+ return
19
+ }
20
+
21
+ this.setFocus();
22
+ };
23
+
24
+ /**
25
+ * Focus the element
26
+ *
27
+ * If `role="alert"` is set, focus the element to help some assistive technologies
28
+ * prioritise announcing it.
29
+ *
30
+ * You can turn off the auto-focus functionality by setting `data-disable-auto-focus="true"` in the
31
+ * component HTML. You might wish to do this based on user research findings, or to avoid a clash
32
+ * with another element which should be focused when the page loads.
33
+ */
34
+ NotificationBanner.prototype.setFocus = function () {
35
+ var $module = this.$module;
36
+
37
+ if ($module.getAttribute('data-disable-auto-focus') === 'true') {
38
+ return
39
+ }
40
+
41
+ if ($module.getAttribute('role') !== 'alert') {
42
+ return
43
+ }
44
+
45
+ // Set tabindex to -1 to make the element focusable with JavaScript.
46
+ // Remove the tabindex on blur as the component doesn't need to be focusable after the page has
47
+ // loaded.
48
+ if (!$module.getAttribute('tabindex')) {
49
+ $module.setAttribute('tabindex', '-1');
50
+
51
+ $module.addEventListener('blur', function () {
52
+ $module.removeAttribute('tabindex');
53
+ });
54
+ }
55
+
56
+ $module.focus();
57
+ };
58
+
59
+ return NotificationBanner;
60
+
61
+ })));
@@ -0,0 +1,44 @@
1
+ @include govuk-exports("govuk/component/panel") {
2
+ .govuk-panel {
3
+ @include govuk-font($size: 19);
4
+
5
+ box-sizing: border-box;
6
+
7
+ margin-bottom: govuk-spacing(3);
8
+ padding: govuk-spacing(7) - $govuk-border-width;
9
+
10
+ border: $govuk-border-width solid transparent;
11
+
12
+ text-align: center;
13
+
14
+ @include govuk-media-query($until: tablet) {
15
+ padding: govuk-spacing(6) - $govuk-border-width;
16
+ }
17
+ }
18
+
19
+ .govuk-panel--confirmation {
20
+ color: govuk-colour("white");
21
+ background: govuk-colour("green", $legacy: "turquoise");
22
+
23
+ @include govuk-media-query($media-type: print) {
24
+ border-color: currentColor;
25
+ color: $govuk-print-text-colour;
26
+ background: none;
27
+ }
28
+ }
29
+
30
+ .govuk-panel__title {
31
+ margin-top: 0;
32
+ margin-bottom: govuk-spacing(6);
33
+
34
+ @include govuk-font($size: 48, $weight: bold);
35
+ }
36
+
37
+ .govuk-panel__title:last-child {
38
+ margin-bottom: 0;
39
+ }
40
+
41
+ .govuk-panel__body {
42
+ @include govuk-font($size: 36);
43
+ }
44
+ }
@@ -1,44 +1,2 @@
1
- @import "../../settings/all";
2
- @import "../../tools/all";
3
- @import "../../helpers/all";
4
-
5
- @include govuk-exports("govuk/component/panel") {
6
-
7
- .govuk-panel {
8
- @include govuk-font($size: 19);
9
-
10
- box-sizing: border-box;
11
-
12
- margin-bottom: govuk-spacing(3);
13
- padding: govuk-spacing(7) - $govuk-border-width;
14
-
15
- border: $govuk-border-width solid transparent;
16
-
17
- text-align: center;
18
-
19
- @include govuk-media-query($until: tablet) {
20
- padding: govuk-spacing(6) - $govuk-border-width;
21
- }
22
- }
23
-
24
- .govuk-panel--confirmation {
25
- color: govuk-colour("white");
26
- background: govuk-colour("green", $legacy: "turquoise");
27
- }
28
-
29
- .govuk-panel__title {
30
- margin-top: 0;
31
- margin-bottom: govuk-spacing(6);
32
-
33
- @include govuk-font($size: 48, $weight: bold);
34
- }
35
-
36
- .govuk-panel__title:last-child {
37
- margin-bottom: 0;
38
- }
39
-
40
- .govuk-panel__body {
41
- @include govuk-font($size: 36);
42
- }
43
-
44
- }
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,27 @@
1
+ @import "../tag/index";
2
+
3
+ @include govuk-exports("govuk/component/phase-banner") {
4
+ .govuk-phase-banner {
5
+ padding-top: govuk-spacing(2);
6
+ padding-bottom: govuk-spacing(2);
7
+
8
+ border-bottom: 1px solid $govuk-border-colour;
9
+ }
10
+
11
+ .govuk-phase-banner__content {
12
+ @include govuk-font($size: 16);
13
+ @include govuk-text-colour;
14
+
15
+ display: table;
16
+ margin: 0;
17
+ }
18
+
19
+ .govuk-phase-banner__content__tag {
20
+ margin-right: govuk-spacing(2);
21
+ }
22
+
23
+ .govuk-phase-banner__text {
24
+ display: table-cell;
25
+ vertical-align: middle;
26
+ }
27
+ }
@@ -1,31 +1,2 @@
1
- @import "../../settings/all";
2
- @import "../../tools/all";
3
- @import "../../helpers/all";
4
-
5
- @import "../tag/tag";
6
-
7
- @include govuk-exports("govuk/component/phase-banner") {
8
- .govuk-phase-banner {
9
- padding-top: govuk-spacing(2);
10
- padding-bottom: govuk-spacing(2);
11
-
12
- border-bottom: 1px solid $govuk-border-colour;
13
- }
14
-
15
- .govuk-phase-banner__content {
16
- @include govuk-font($size: 16);
17
- @include govuk-text-colour;
18
-
19
- display: table;
20
- margin: 0;
21
- }
22
-
23
- .govuk-phase-banner__content__tag {
24
- margin-right: govuk-spacing(2);
25
- }
26
-
27
- .govuk-phase-banner__text {
28
- display: table-cell;
29
- vertical-align: baseline;
30
- }
31
- }
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,342 @@
1
+ @import "../error-message/index";
2
+ @import "../fieldset/index";
3
+ @import "../hint/index";
4
+ @import "../label/index";
5
+
6
+ @include govuk-exports("govuk/component/radios") {
7
+
8
+ $govuk-touch-target-size: 44px;
9
+ $govuk-radios-size: 40px;
10
+ $govuk-small-radios-size: 24px;
11
+ $govuk-radios-label-padding-left-right: govuk-spacing(3);
12
+ // When the default focus width is used on a curved edge it looks visually smaller.
13
+ // So for the circular radios we bump the default to make it look visually consistent.
14
+ $govuk-radios-focus-width: $govuk-focus-width + 1px;
15
+
16
+ .govuk-radios__item {
17
+ @include govuk-font($size: 19);
18
+
19
+ display: block;
20
+ position: relative;
21
+
22
+ min-height: $govuk-radios-size;
23
+
24
+ margin-bottom: govuk-spacing(2);
25
+ padding-left: $govuk-radios-size;
26
+
27
+ clear: left;
28
+ }
29
+
30
+ .govuk-radios__item:last-child,
31
+ .govuk-radios__item:last-of-type {
32
+ margin-bottom: 0;
33
+ }
34
+
35
+ .govuk-radios__input {
36
+ $input-offset: ($govuk-touch-target-size - $govuk-radios-size) / 2;
37
+
38
+ cursor: pointer;
39
+
40
+ // IE8 doesn’t support pseudo-elements, so we don’t want to hide native
41
+ // elements there.
42
+ @include govuk-not-ie8 {
43
+ position: absolute;
44
+
45
+ z-index: 1;
46
+ top: $input-offset * -1;
47
+ left: $input-offset * -1;
48
+
49
+ width: $govuk-touch-target-size;
50
+ height: $govuk-touch-target-size;
51
+ margin: 0;
52
+
53
+ opacity: 0;
54
+ }
55
+
56
+ @include govuk-if-ie8 {
57
+ margin-top: 10px;
58
+ margin-right: $govuk-radios-size / -2;
59
+ margin-left: $govuk-radios-size / -2;
60
+ float: left;
61
+
62
+ // add focus outline to input
63
+ &:focus {
64
+ outline: $govuk-focus-width solid $govuk-focus-colour;
65
+ }
66
+ }
67
+ }
68
+
69
+ .govuk-radios__label {
70
+ display: inline-block;
71
+ margin-bottom: 0;
72
+ padding: 8px $govuk-radios-label-padding-left-right govuk-spacing(1);
73
+ cursor: pointer;
74
+ // remove 300ms pause on mobile
75
+ -ms-touch-action: manipulation;
76
+ touch-action: manipulation;
77
+ }
78
+
79
+ // ( ) Radio ring
80
+ .govuk-radios__label:before {
81
+ content: "";
82
+ box-sizing: border-box;
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+
87
+ width: $govuk-radios-size;
88
+ height: $govuk-radios-size;
89
+
90
+ border: $govuk-border-width-form-element solid currentColor;
91
+ border-radius: 50%;
92
+ background: transparent;
93
+ }
94
+
95
+ // • Radio button
96
+ //
97
+ // We create the 'button' entirely out of 'border' so that they remain
98
+ // 'filled' even when colours are overridden in the browser.
99
+ .govuk-radios__label:after {
100
+ content: "";
101
+
102
+ position: absolute;
103
+ top: govuk-spacing(2);
104
+ left: govuk-spacing(2);
105
+
106
+ width: 0;
107
+ height: 0;
108
+
109
+ border: govuk-spacing(2) solid currentColor;
110
+ border-radius: 50%;
111
+ opacity: 0;
112
+ background: currentColor;
113
+ }
114
+
115
+ .govuk-radios__hint {
116
+ display: block;
117
+ padding-right: $govuk-radios-label-padding-left-right;
118
+ padding-left: $govuk-radios-label-padding-left-right;
119
+ }
120
+
121
+ // Focused state
122
+ .govuk-radios__input:focus + .govuk-radios__label:before {
123
+ border-width: 4px;
124
+ box-shadow: 0 0 0 $govuk-radios-focus-width $govuk-focus-colour;
125
+ }
126
+
127
+ // Selected state
128
+ .govuk-radios__input:checked + .govuk-radios__label:after {
129
+ opacity: 1;
130
+ }
131
+
132
+ // Disabled state
133
+ .govuk-radios__input:disabled,
134
+ .govuk-radios__input:disabled + .govuk-radios__label {
135
+ cursor: default;
136
+ }
137
+
138
+ .govuk-radios__input:disabled + .govuk-radios__label {
139
+ opacity: .5;
140
+ }
141
+
142
+ // =========================================================
143
+ // Inline radios
144
+ // =========================================================
145
+
146
+ .govuk-radios--inline {
147
+ @include govuk-media-query ($from: tablet) {
148
+ @include govuk-clearfix;
149
+
150
+ .govuk-radios__item {
151
+ margin-right: govuk-spacing(4);
152
+ float: left;
153
+ clear: none;
154
+ }
155
+ }
156
+
157
+ // Prevent inline modifier being used with conditional reveals
158
+ &.govuk-radios--conditional {
159
+ .govuk-radios__item {
160
+ margin-right: 0;
161
+ float: none;
162
+ }
163
+ }
164
+ }
165
+
166
+ // =========================================================
167
+ // Dividers ('or')
168
+ // =========================================================
169
+
170
+ .govuk-radios__divider {
171
+ $govuk-divider-size: $govuk-radios-size !default;
172
+ @include govuk-font($size: 19);
173
+ @include govuk-text-colour;
174
+ width: $govuk-divider-size;
175
+ margin-bottom: govuk-spacing(2);
176
+ text-align: center;
177
+ }
178
+
179
+ // =========================================================
180
+ // Conditional reveals
181
+ // =========================================================
182
+
183
+ // The narrow border is used in the conditional reveals because the border has
184
+ // to be an even number in order to be centred under the 40px checkbox or radio.
185
+ $conditional-border-width: $govuk-border-width-narrow;
186
+ // Calculate the amount of padding needed to keep the border centered against the radios.
187
+ $conditional-border-padding: ($govuk-radios-size / 2) - ($conditional-border-width / 2);
188
+ // Move the border centered with the radios
189
+ $conditional-margin-left: $conditional-border-padding;
190
+ // Move the contents of the conditional inline with the label
191
+ $conditional-padding-left: $conditional-border-padding + $govuk-radios-label-padding-left-right;
192
+
193
+ .govuk-radios__conditional {
194
+ @include govuk-responsive-margin(4, "bottom");
195
+ margin-left: $conditional-margin-left;
196
+ padding-left: $conditional-padding-left;
197
+ border-left: $conditional-border-width solid $govuk-border-colour;
198
+
199
+ .js-enabled &--hidden {
200
+ display: none;
201
+ }
202
+
203
+ & > :last-child {
204
+ margin-bottom: 0;
205
+ }
206
+ }
207
+
208
+ // =========================================================
209
+ // Small checkboxes
210
+ // =========================================================
211
+
212
+ .govuk-radios--small {
213
+
214
+ $input-offset: ($govuk-touch-target-size - $govuk-small-radios-size) / 2;
215
+ $label-offset: $govuk-touch-target-size - $input-offset;
216
+
217
+ .govuk-radios__item {
218
+ @include govuk-clearfix;
219
+ min-height: 0;
220
+ margin-bottom: 0;
221
+ padding-left: $label-offset;
222
+ float: left;
223
+ }
224
+
225
+ // Shift the touch target into the left margin so that the visible edge of
226
+ // the control is aligned
227
+ //
228
+ // ┆Which colour is your favourite?
229
+ // ┌┆───┐
230
+ // │┆() │ Purple
231
+ // └┆▲──┘
232
+ // ▲┆└─ Radio pseudo element, aligned with margin
233
+ // └─── Touch target (invisible input), shifted into the margin
234
+ .govuk-radios__input {
235
+ @include govuk-not-ie8 {
236
+ left: $input-offset * -1;
237
+ }
238
+
239
+ @include govuk-if-ie8 {
240
+ margin-left: $govuk-small-radios-size * -1;
241
+ }
242
+ }
243
+
244
+ // Adjust the size and position of the label.
245
+ //
246
+ // Unlike larger radios, we also have to float the label in order to
247
+ // 'shrink' it, preventing the hover state from kicking in across the full
248
+ // width of the parent element.
249
+ .govuk-radios__label {
250
+ margin-top: -2px;
251
+ padding: 13px govuk-spacing(3) 13px 1px;
252
+ float: left;
253
+
254
+ @include govuk-media-query($from: tablet) {
255
+ padding: 11px govuk-spacing(3) 10px 1px;
256
+ }
257
+ }
258
+
259
+ // ( ) Radio ring
260
+ //
261
+ // Reduce the size of the control [1], vertically centering it within the
262
+ // touch target [2]
263
+ .govuk-radios__label:before {
264
+ top: $input-offset - $govuk-border-width-form-element; // 2
265
+ width: $govuk-small-radios-size; // 1
266
+ height: $govuk-small-radios-size; // 1
267
+ }
268
+
269
+ // • Radio button
270
+ //
271
+ // Reduce the size of the 'button' and center it within the ring
272
+ .govuk-radios__label:after {
273
+ top: 15px;
274
+ left: 7px;
275
+ border-width: 5px;
276
+ }
277
+
278
+ // Fix position of hint with small radios
279
+ //
280
+ // Do not use hints with small radios – because they're within the input
281
+ // wrapper they trigger the hover state, but clicking them doesn't actually
282
+ // activate the control.
283
+ //
284
+ // (If you do use them, they won't look completely broken... but seriously,
285
+ // don't use them)
286
+ .govuk-radios__hint {
287
+ padding: 0;
288
+ clear: both;
289
+ pointer-events: none;
290
+ }
291
+
292
+ // Align conditional reveals with small radios
293
+ .govuk-radios__conditional {
294
+ $margin-left: ($govuk-small-radios-size / 2) - ($conditional-border-width / 2);
295
+ margin-left: $margin-left;
296
+ padding-left: $label-offset - ($margin-left + $conditional-border-width);
297
+ clear: both;
298
+ }
299
+
300
+ .govuk-radios__divider {
301
+ width: $govuk-small-radios-size;
302
+ margin-bottom: govuk-spacing(1);
303
+ }
304
+
305
+ // Hover state for small radios.
306
+ //
307
+ // We use a hover state for small radios because the touch target size
308
+ // is so much larger than their visible size, and so we need to provide
309
+ // feedback to the user as to which radio they will select when their
310
+ // cursor is outside of the visible area.
311
+ .govuk-radios__item:hover .govuk-radios__input:not(:disabled) + .govuk-radios__label:before {
312
+ box-shadow: 0 0 0 $govuk-hover-width $govuk-hover-colour;
313
+ }
314
+
315
+ // Because we've overridden the border-shadow provided by the focus state,
316
+ // we need to redefine that too.
317
+ //
318
+ // We use two box shadows, one that restores the original focus state [1]
319
+ // and another that then applies the hover state [2].
320
+ .govuk-radios__item:hover .govuk-radios__input:focus + .govuk-radios__label:before {
321
+ box-shadow:
322
+ 0 0 0 $govuk-radios-focus-width $govuk-focus-colour, // 1
323
+ 0 0 0 $govuk-hover-width $govuk-hover-colour; // 2
324
+ }
325
+
326
+ // For devices that explicitly don't support hover, don't provide a hover
327
+ // state (e.g. on touch devices like iOS).
328
+ //
329
+ // We can't use `@media (hover: hover)` because we wouldn't get the hover
330
+ // state in browsers that don't support `@media (hover)` (like Internet
331
+ // Explorer) – so we have to 'undo' the hover state instead.
332
+ @media (hover: none), (pointer: coarse) {
333
+ .govuk-radios__item:hover .govuk-radios__input:not(:disabled) + .govuk-radios__label:before {
334
+ box-shadow: initial;
335
+ }
336
+
337
+ .govuk-radios__item:hover .govuk-radios__input:focus + .govuk-radios__label:before {
338
+ box-shadow: 0 0 0 $govuk-radios-focus-width $govuk-focus-colour;
339
+ }
340
+ }
341
+ }
342
+ }