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
@@ -1,5 +1,5 @@
1
1
  ////
2
- /// @group helpers
2
+ /// @group helpers/layout
3
3
  ////
4
4
 
5
5
  /// Clear floated content within a container using a pseudo element
@@ -52,7 +52,7 @@
52
52
  /// colour will be returned which meets contrast requirements . If you want to
53
53
  /// use the non-websafe version you can set this to `false` but your should
54
54
  /// ensure that you still meets contrast requirements for accessibility - for
55
- /// example, don't use the non-websafe version for text.
55
+ /// example, do not use the non-websafe version for text.
56
56
  ///
57
57
  /// @return {Colour} Representation of colour for organisation
58
58
  /// @throw if `$organisation` is not a known organisation
@@ -28,10 +28,10 @@
28
28
  /// @access public
29
29
 
30
30
  @mixin govuk-device-pixel-ratio($ratio: 2) {
31
+ // stylelint-disable indentation
31
32
  @media only screen and (-webkit-min-device-pixel-ratio: $ratio),
32
- only screen and ( min-device-pixel-ratio: $ratio),
33
- only screen and ( min-resolution: #{($ratio*96)}dpi),
34
- only screen and ( min-resolution: #{$ratio}dppx) {
33
+ only screen and (min-resolution: #{($ratio * 96)}dpi),
34
+ only screen and (min-resolution: #{$ratio}dppx) {
35
35
  @content;
36
36
  }
37
37
  }
@@ -1,5 +1,5 @@
1
1
  ////
2
- /// @group helpers
2
+ /// @group helpers/accessibility
3
3
  ////
4
4
 
5
5
  /// Focused text
@@ -2,9 +2,6 @@
2
2
  /// @group helpers
3
3
  ////
4
4
 
5
- // Disables linting for this file only
6
- // sass-lint:disable no-css-comments, no-duplicate-properties, property-sort-order, indentation
7
-
8
5
  @import "../tools/exports";
9
6
 
10
7
  /// Font Face - GDS Transport
@@ -18,23 +15,24 @@
18
15
  @include govuk-not-ie8 { // In IE8, which cannot render WOFF format, we fall back to system fonts
19
16
  @include govuk-exports("govuk/helpers/font-faces") {
20
17
  @at-root {
21
- /*! Copyright (c) 2011 by Margaret Calvert & Henrik Kubel. All rights reserved. The font has been customised for exclusive use on gov.uk. This cut is not commercially available. */
22
-
18
+ /*! Copyright (c) 2011 by Margaret Calvert & Henrik Kubel. All rights reserved. The font has been customised for exclusive use on gov.uk. This cut is not commercially available. */ /* stylelint-disable-line scss/comment-no-loud */
23
19
  @font-face {
24
20
  font-family: "GDS Transport";
25
- src: govuk-font-url("light-94a07e06a1-v2.woff2") format("woff2"),
26
- govuk-font-url("light-f591b13f7d-v2.woff") format("woff");
27
- font-weight: normal;
28
21
  font-style: normal;
22
+ font-weight: normal;
23
+ src:
24
+ govuk-font-url("light-94a07e06a1-v2.woff2") format("woff2"),
25
+ govuk-font-url("light-f591b13f7d-v2.woff") format("woff");
29
26
  font-display: fallback;
30
27
  }
31
28
 
32
29
  @font-face {
33
30
  font-family: "GDS Transport";
34
- src: govuk-font-url("bold-b542beb274-v2.woff2") format("woff2"),
35
- govuk-font-url("bold-affa96571d-v2.woff") format("woff");
36
- font-weight: bold;
37
31
  font-style: normal;
32
+ font-weight: bold;
33
+ src:
34
+ govuk-font-url("bold-b542beb274-v2.woff2") format("woff2"),
35
+ govuk-font-url("bold-affa96571d-v2.woff") format("woff");
38
36
  font-display: fallback;
39
37
  }
40
38
  }
@@ -1,5 +1,5 @@
1
1
  ////
2
- /// @group helpers
2
+ /// @group helpers/layout
3
3
  ////
4
4
 
5
5
  /// Grid width percentage
@@ -44,6 +44,7 @@
44
44
  /// @example scss - Customising the float direction
45
45
  /// .govuk-grid-column-one-half-right {
46
46
  /// @include govuk-grid-column(two-thirds, $float: right);
47
+ /// }
47
48
  ///
48
49
  /// @access public
49
50
 
@@ -1,8 +1,8 @@
1
1
  ////
2
- /// @group helpers
2
+ /// @group helpers/links
3
3
  ////
4
4
 
5
- /// Common link mixin
5
+ /// Common link styles
6
6
  ///
7
7
  /// Provides the typography and focus state, regardless of link style.
8
8
  ///
@@ -10,18 +10,63 @@
10
10
 
11
11
  @mixin govuk-link-common {
12
12
  @include govuk-typography-common;
13
+ @include govuk-link-decoration;
14
+
15
+ &:hover {
16
+ @include govuk-link-hover-decoration;
17
+ }
13
18
 
14
19
  &:focus {
15
20
  @include govuk-focused-text;
16
21
  }
17
22
  }
18
23
 
19
- /// Default link style mixin
24
+ /// Link decoration
25
+ ///
26
+ /// Provides the text decoration for links, including thickness and underline
27
+ /// offset. Use this mixin only if you cannot use the `govuk-link-common` mixin.
28
+ ///
29
+ /// @access public
30
+ @mixin govuk-link-decoration {
31
+ text-decoration: underline;
32
+
33
+ @if ($govuk-new-link-styles) {
34
+ @if ($govuk-link-underline-thickness) {
35
+ text-decoration-thickness: $govuk-link-underline-thickness;
36
+ }
37
+
38
+ @if ($govuk-link-underline-offset) {
39
+ text-underline-offset: $govuk-link-underline-offset;
40
+ }
41
+ }
42
+ }
43
+
44
+ /// Link hover decoration
45
+ ///
46
+ /// Provides the text decoration for links in their hover state, for you to use
47
+ /// within a `:hover` pseudo-selector. Use this mixin only if you cannot use the
48
+ /// `govuk-link-common` mixin.
49
+ ///
50
+ /// @access public
51
+
52
+ @mixin govuk-link-hover-decoration {
53
+ @if ($govuk-new-link-styles and $govuk-link-hover-underline-thickness) {
54
+ text-decoration-thickness: $govuk-link-hover-underline-thickness;
55
+ // Disable ink skipping on underlines on hover. Browsers haven't
56
+ // standardised on this part of the spec yet, so set both properties
57
+ -webkit-text-decoration-skip-ink: none;
58
+ text-decoration-skip-ink: none; // Chromium, Firefox
59
+ -webkit-text-decoration-skip: none;
60
+ text-decoration-skip: none; // Safari
61
+ }
62
+ }
63
+
64
+ /// Default link styles
20
65
  ///
21
- /// Provides the default unvisited, visited, hover and active states for links.
66
+ /// Makes links use the default unvisited, visited, hover and active colours.
22
67
  ///
23
- /// If you use this mixin in a component you must also include the
24
- /// govuk-link-common mixin in order to get the focus state.
68
+ /// If you use this mixin in a component, you must also include the
69
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
25
70
  ///
26
71
  /// @example scss
27
72
  /// .govuk-component__link {
@@ -66,13 +111,109 @@
66
111
  }
67
112
  }
68
113
 
69
- /// Muted style link mixin
114
+ /// Error link styles
115
+ ///
116
+ /// Makes links use the error colour. The link will darken if it's active or a
117
+ /// user hovers their cursor over it.
118
+ ///
119
+ /// If you use this mixin in a component, you must also include the
120
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
121
+ ///
122
+ /// @example scss
123
+ /// .govuk-component__link {
124
+ /// @include govuk-link-common;
125
+ /// @include govuk-link-style-error;
126
+ /// }
127
+ ///
128
+ /// @access public
129
+
130
+ @mixin govuk-link-style-error {
131
+ &:link,
132
+ &:visited {
133
+ color: $govuk-error-colour;
134
+ }
135
+
136
+ &:hover {
137
+ color: scale-color($govuk-error-colour, $lightness: -30%);
138
+ }
139
+
140
+ &:active {
141
+ color: $govuk-error-colour;
142
+ }
143
+
144
+ // When focussed, the text colour needs to be darker to ensure that colour
145
+ // contrast is still acceptable
146
+ &:focus {
147
+ color: $govuk-focus-text-colour;
148
+ }
149
+
150
+ // alphagov/govuk_template includes a specific a:link:focus selector
151
+ // designed to make unvisited link s a slightly darker blue when focussed, so
152
+ // we need to override the text colour for that combination of selectors so
153
+ // so that unvisited links styled as buttons do not end up with dark blue
154
+ // text when focussed.
155
+ @include govuk-compatibility(govuk_template) {
156
+ &:link:focus {
157
+ color: $govuk-focus-text-colour;
158
+ }
159
+ }
160
+ }
161
+
162
+ /// Success link styles
163
+ ///
164
+ /// Makes links use the success colour. The link will darken if it's active or a
165
+ /// user hovers their cursor over it.
166
+ ///
167
+ /// If you use this mixin in a component, you must also include the
168
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
169
+ ///
170
+ /// @example scss
171
+ /// .govuk-component__link {
172
+ /// @include govuk-link-common;
173
+ /// @include govuk-link-style-success;
174
+ /// }
175
+ ///
176
+ /// @access public
177
+
178
+ @mixin govuk-link-style-success {
179
+ &:link,
180
+ &:visited {
181
+ color: $govuk-success-colour;
182
+ }
183
+
184
+ &:hover {
185
+ color: scale-color($govuk-success-colour, $lightness: -30%);
186
+ }
187
+
188
+ &:active {
189
+ color: $govuk-success-colour;
190
+ }
191
+
192
+ // When focussed, the text colour needs to be darker to ensure that colour
193
+ // contrast is still acceptable
194
+ &:focus {
195
+ color: $govuk-focus-text-colour;
196
+ }
197
+
198
+ // alphagov/govuk_template includes a specific a:link:focus selector
199
+ // designed to make unvisited link s a slightly darker blue when focussed, so
200
+ // we need to override the text colour for that combination of selectors so
201
+ // so that unvisited links styled as buttons do not end up with dark blue
202
+ // text when focussed.
203
+ @include govuk-compatibility(govuk_template) {
204
+ &:link:focus {
205
+ color: $govuk-focus-text-colour;
206
+ }
207
+ }
208
+ }
209
+
210
+ /// Muted link styles
70
211
  ///
71
- /// Used for secondary links on a page - the link will appear in muted colours
72
- /// regardless of visited state.
212
+ /// Makes links use the secondary text colour. The link will darken if it's
213
+ /// active or a user hovers their cursor over it.
73
214
  ///
74
- /// If you use this mixin in a component you must also include the
75
- /// govuk-link-common mixin in order to get the focus state.
215
+ /// If you use this mixin in a component, you must also include the
216
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
76
217
  ///
77
218
  /// @example scss
78
219
  /// .govuk-component__link {
@@ -84,10 +225,13 @@
84
225
 
85
226
  @mixin govuk-link-style-muted {
86
227
  &:link,
87
- &:visited,
228
+ &:visited {
229
+ color: $govuk-secondary-text-colour;
230
+ }
231
+
88
232
  &:hover,
89
233
  &:active {
90
- color: $govuk-secondary-text-colour;
234
+ color: $govuk-text-colour;
91
235
  }
92
236
 
93
237
  // When focussed, the text colour needs to be darker to ensure that colour
@@ -106,13 +250,13 @@
106
250
  }
107
251
  }
108
252
 
109
- /// Text style link mixin
253
+ /// Text link styles
110
254
  ///
111
- /// Overrides the colour of links to match the text colour. Generally used by
255
+ /// Makes links use the primary text colour, in all states. Use this mixin for
112
256
  /// navigation components, such as breadcrumbs or the back link.
113
257
  ///
114
- /// If you use this mixin in a component you must also include the
115
- /// govuk-link-common mixin in order to get the focus state.
258
+ /// If you use this mixin in a component, you must also include the
259
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
116
260
  ///
117
261
  /// @example scss
118
262
  /// .govuk-component__link {
@@ -123,10 +267,17 @@
123
267
  /// @access public
124
268
 
125
269
  @mixin govuk-link-style-text {
126
- // Override link colour to use text colour
127
270
  &:link,
128
- &:visited,
129
- &:hover,
271
+ &:visited {
272
+ @include govuk-text-colour;
273
+ }
274
+
275
+ // Force a colour change on hover to work around a bug in Safari
276
+ // https://bugs.webkit.org/show_bug.cgi?id=224483
277
+ &:hover {
278
+ color: rgba($govuk-text-colour, .99);
279
+ }
280
+
130
281
  &:active,
131
282
  &:focus {
132
283
  @include govuk-text-colour;
@@ -142,18 +293,60 @@
142
293
  }
143
294
  }
144
295
 
296
+ /// Inverse link styles
297
+ ///
298
+ /// Makes links white, in all states. Use this mixin if you're displaying links
299
+ /// against a dark background.
300
+ ///
301
+ /// If you use this mixin in a component, you must also include the
302
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
303
+ ///
304
+ /// @example scss
305
+ /// .govuk-component__link {
306
+ /// @include govuk-link-common;
307
+ /// @include govuk-link-style-inverse;
308
+ /// }
309
+ ///
310
+ /// @access public
311
+
312
+ @mixin govuk-link-style-inverse {
313
+ &:link,
314
+ &:visited {
315
+ color: govuk-colour("white");
316
+ }
317
+
318
+ // Force a colour change on hover to work around a bug in Safari
319
+ // https://bugs.webkit.org/show_bug.cgi?id=224483
320
+ &:hover,
321
+ &:active {
322
+ color: rgba(govuk-colour("white"), .99);
323
+ }
324
+
325
+ &:focus {
326
+ color: $govuk-focus-text-colour;
327
+ }
328
+
329
+ // alphagov/govuk_template includes a specific a:link:focus selector designed
330
+ // to make unvisited links a slightly darker blue when focussed, so we need to
331
+ // override the text colour for that combination of selectors.
332
+ @include govuk-compatibility(govuk_template) {
333
+ &:link:focus {
334
+ color: $govuk-focus-text-colour;
335
+ }
336
+ }
337
+ }
145
338
 
146
- /// No visited state link mixin
339
+ /// Default link styles, without a visited state
147
340
  ///
148
- /// Used in cases where it is not helpful to distinguish between visited and
149
- /// non-visited links.
341
+ /// Makes links use the default unvisited, hover and active colours, with no
342
+ /// distinct visited state.
150
343
  ///
151
- /// For example, navigation links to pages with dynamic content like admin
152
- /// dashboards. The content on the page is changing all the time, so the fact
153
- /// that you’ve visited it before is not important.
344
+ /// Use this mixin when it's not helpful to distinguish between visited and
345
+ /// non-visited links. For example, when you link to pages with
346
+ /// frequently-changing content, such as the dashboard for an admin interface.
154
347
  ///
155
- /// If you use this mixin in a component you must also include the
156
- /// govuk-link-common mixin in order to get the focus state.
348
+ /// If you use this mixin in a component, you must also include the
349
+ /// `govuk-link-common` mixin to get the correct focus and hover states.
157
350
  ///
158
351
  /// @example scss
159
352
  /// .govuk-component__link {
@@ -187,20 +380,40 @@
187
380
  }
188
381
  }
189
382
 
190
- /// Print friendly link mixin
383
+ /// Remove underline from links
191
384
  ///
192
- /// When printing, append the the destination URL to the link text, as long
193
- /// as the URL starts with either `/`, `http://` or `https://`.
385
+ /// Remove underlines from links unless the link is active or a user hovers
386
+ /// their cursor over it. This has no effect in Internet Explorer 8 (IE8),
387
+ /// because IE8 does not support `:not`.
388
+ ///
389
+ /// @example scss
390
+ /// .govuk-component__link {
391
+ /// @include govuk-link-common;
392
+ /// @include govuk-link-style-default;
393
+ /// @include govuk-link-style-no-underline;
394
+ /// }
395
+ ///
396
+ /// @access public
397
+
398
+ @mixin govuk-link-style-no-underline {
399
+ &:not(:hover):not(:active) {
400
+ text-decoration: none;
401
+ }
402
+ }
403
+
404
+ /// Include link destination when printing the page
405
+ ///
406
+ /// If the user prints the page, add the destination URL after the link text, if
407
+ /// the URL starts with `/`, `http://` or `https://`.
194
408
  ///
195
409
  /// @access public
196
410
 
197
411
  @mixin govuk-link-print-friendly {
198
412
  @include govuk-media-query($media-type: print) {
199
-
200
413
  &[href^="/"],
201
414
  &[href^="http://"],
202
415
  &[href^="https://"] {
203
- &::after {
416
+ &:after {
204
417
  content: " (" attr(href) ")";
205
418
  font-size: 90%;
206
419