govuk_tech_docs 5.2.1 → 6.0.0.beta

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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +59 -0
  3. data/.npmrc +1 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +19 -0
  6. data/README.md +13 -4
  7. data/example/config/tech-docs.yml +1 -1
  8. data/govuk_tech_docs.gemspec +2 -2
  9. data/lib/assets/stylesheets/_core.scss +1 -0
  10. data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -15
  11. data/lib/assets/stylesheets/modules/_app-pane.scss +3 -3
  12. data/lib/assets/stylesheets/modules/_page-review.scss +4 -4
  13. data/lib/assets/stylesheets/modules/_search.scss +3 -3
  14. data/lib/assets/stylesheets/modules/_service-navigation.scss +5 -0
  15. data/lib/assets/stylesheets/modules/_technical-documentation.scss +7 -7
  16. data/lib/assets/stylesheets/modules/_toc.scss +13 -13
  17. data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +9 -7
  18. data/lib/govuk_tech_docs/meta_tags.rb +1 -1
  19. data/lib/govuk_tech_docs/version.rb +1 -1
  20. data/lib/source/layouts/_header.erb +2 -16
  21. data/lib/source/layouts/_service_navigation.erb +27 -0
  22. data/lib/source/layouts/core.erb +7 -7
  23. data/node_modules/govuk-frontend/dist/govuk/_base.scss +1 -0
  24. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +183 -300
  25. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +184 -300
  26. data/node_modules/govuk-frontend/dist/govuk/all.mjs +0 -1
  27. data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.ico +0 -0
  28. data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.svg +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-180.png +0 -0
  30. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-192.png +0 -0
  31. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-512.png +0 -0
  32. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-opengraph-image.png +0 -0
  33. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +29 -2
  34. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -10
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +18 -15
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +14 -137
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +14 -137
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
  40. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +2 -2
  41. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +2 -2
  42. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +18 -21
  43. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +7 -5
  44. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +7 -5
  45. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -2
  46. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +30 -143
  47. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +30 -143
  48. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +20 -10
  49. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
  50. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +10 -5
  51. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +10 -5
  52. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -5
  53. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +5 -0
  54. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +6 -4
  55. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +1 -1
  56. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -2
  57. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +8 -12
  58. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +8 -12
  59. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +2 -2
  60. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +10 -133
  62. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +10 -133
  63. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +30 -38
  64. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +46 -140
  65. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +46 -140
  66. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +36 -7
  67. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +30 -27
  68. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +89 -449
  69. data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +1 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +14 -20
  71. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +2 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +10 -8
  73. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +7 -5
  74. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +7 -5
  75. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +16 -11
  76. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +4 -4
  77. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
  78. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +10 -133
  79. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +10 -133
  80. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +12 -6
  81. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +8 -7
  82. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +10 -5
  83. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +10 -5
  84. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +6 -11
  85. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +58 -74
  86. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +40 -7
  87. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +40 -7
  88. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +30 -2
  89. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +8 -4
  90. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +12 -19
  91. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +12 -19
  92. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -9
  93. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +25 -21
  94. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +7 -8
  95. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +9 -6
  96. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +12 -13
  97. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +12 -13
  98. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +3 -3
  99. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +66 -31
  100. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +7 -5
  101. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +5 -10
  102. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +5 -4
  103. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +0 -1
  104. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
  105. data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +2 -1
  106. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +6 -20
  107. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_breakpoints.scss +17 -0
  108. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +15 -0
  109. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +17 -0
  110. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_index.scss +5 -0
  111. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +5 -3
  112. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  113. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +187 -72
  114. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +41 -6
  115. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  116. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +24 -40
  117. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
  118. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
  119. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +6 -30
  120. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +4 -1
  121. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +5 -128
  122. data/node_modules/govuk-frontend/dist/govuk/init.mjs +53 -45
  123. data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
  124. data/node_modules/govuk-frontend/dist/govuk/objects/_form-group.scss +2 -1
  125. data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
  126. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +3 -7
  127. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
  128. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
  129. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +0 -2
  130. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
  131. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +3 -188
  132. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +366 -0
  133. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +9 -255
  134. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-palette.scss +117 -25
  135. data/node_modules/govuk-frontend/dist/govuk/settings/_custom-properties.scss +18 -0
  136. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +3 -14
  137. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +0 -9
  138. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +12 -189
  139. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +0 -1
  140. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
  141. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +2 -0
  142. data/package-lock.json +2461 -1150
  143. data/package.json +3 -3
  144. metadata +16 -30
  145. data/node_modules/govuk-frontend/dist/govuk/all.scss +0 -9
  146. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  147. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +0 -1
  148. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +0 -1
  149. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  150. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  151. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  152. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +0 -1
  153. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  154. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +0 -39
  155. data/node_modules/govuk-frontend/dist/govuk/components/_all.scss +0 -10
  156. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +0 -233
  157. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -225
  158. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +0 -89
  159. data/node_modules/govuk-frontend/dist/govuk/core/_all.scss +0 -10
  160. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +0 -15
  161. data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss +0 -10
  162. data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss +0 -10
  163. data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss +0 -9
  164. data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss +0 -10
  165. data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss +0 -10
  166. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +0 -65
  167. data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss +0 -10
  168. data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
  169. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +0 -25
@@ -4,12 +4,6 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function getFragmentFromUrl(url) {
8
- if (!url.includes('#')) {
9
- return undefined;
10
- }
11
- return url.split('#').pop();
12
- }
13
7
  function getBreakpoint(name) {
14
8
  const property = `--govuk-breakpoint-${name}`;
15
9
  const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);
@@ -37,6 +31,12 @@
37
31
  }
38
32
  return $scope.classList.contains('govuk-frontend-supported');
39
33
  }
34
+ function isArray(option) {
35
+ return Array.isArray(option);
36
+ }
37
+ function isObject(option) {
38
+ return !!option && typeof option === 'object' && !isArray(option);
39
+ }
40
40
  function formatErrorMessage(Component, message) {
41
41
  return `${Component.moduleName}: ${message}`;
42
42
  }
@@ -44,9 +44,6 @@
44
44
  * @typedef ComponentWithModuleName
45
45
  * @property {string} moduleName - Name of the component
46
46
  */
47
- /**
48
- * @import { ObjectNested } from './configuration.mjs'
49
- */
50
47
 
51
48
  class GOVUKFrontendError extends Error {
52
49
  constructor(...args) {
@@ -69,7 +66,7 @@
69
66
  class ElementError extends GOVUKFrontendError {
70
67
  constructor(messageOrOptions) {
71
68
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
72
- if (typeof messageOrOptions === 'object') {
69
+ if (isObject(messageOrOptions)) {
73
70
  const {
74
71
  component,
75
72
  identifier,
@@ -78,7 +75,9 @@
78
75
  } = messageOrOptions;
79
76
  message = identifier;
80
77
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
81
- message = formatErrorMessage(component, message);
78
+ if (component) {
79
+ message = formatErrorMessage(component, message);
80
+ }
82
81
  }
83
82
  super(message);
84
83
  this.name = 'ElementError';
@@ -281,7 +280,7 @@
281
280
  return this.$root.querySelector(`a.govuk-tabs__tab[href="${hash}"]`);
282
281
  }
283
282
  setAttributes($tab) {
284
- const panelId = getFragmentFromUrl($tab.href);
283
+ const panelId = $tab.hash.replace('#', '');
285
284
  if (!panelId) {
286
285
  return;
287
286
  }
@@ -385,7 +384,7 @@
385
384
  this.createHistoryEntry($previousTab);
386
385
  }
387
386
  getPanel($tab) {
388
- const panelId = getFragmentFromUrl($tab.href);
387
+ const panelId = $tab.hash.replace('#', '');
389
388
  if (!panelId) {
390
389
  return null;
391
390
  }
@@ -1,9 +1,3 @@
1
- function getFragmentFromUrl(url) {
2
- if (!url.includes('#')) {
3
- return undefined;
4
- }
5
- return url.split('#').pop();
6
- }
7
1
  function getBreakpoint(name) {
8
2
  const property = `--govuk-breakpoint-${name}`;
9
3
  const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);
@@ -31,6 +25,12 @@ function isSupported($scope = document.body) {
31
25
  }
32
26
  return $scope.classList.contains('govuk-frontend-supported');
33
27
  }
28
+ function isArray(option) {
29
+ return Array.isArray(option);
30
+ }
31
+ function isObject(option) {
32
+ return !!option && typeof option === 'object' && !isArray(option);
33
+ }
34
34
  function formatErrorMessage(Component, message) {
35
35
  return `${Component.moduleName}: ${message}`;
36
36
  }
@@ -38,9 +38,6 @@ function formatErrorMessage(Component, message) {
38
38
  * @typedef ComponentWithModuleName
39
39
  * @property {string} moduleName - Name of the component
40
40
  */
41
- /**
42
- * @import { ObjectNested } from './configuration.mjs'
43
- */
44
41
 
45
42
  class GOVUKFrontendError extends Error {
46
43
  constructor(...args) {
@@ -63,7 +60,7 @@ class SupportError extends GOVUKFrontendError {
63
60
  class ElementError extends GOVUKFrontendError {
64
61
  constructor(messageOrOptions) {
65
62
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
66
- if (typeof messageOrOptions === 'object') {
63
+ if (isObject(messageOrOptions)) {
67
64
  const {
68
65
  component,
69
66
  identifier,
@@ -72,7 +69,9 @@ class ElementError extends GOVUKFrontendError {
72
69
  } = messageOrOptions;
73
70
  message = identifier;
74
71
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
75
- message = formatErrorMessage(component, message);
72
+ if (component) {
73
+ message = formatErrorMessage(component, message);
74
+ }
76
75
  }
77
76
  super(message);
78
77
  this.name = 'ElementError';
@@ -275,7 +274,7 @@ class Tabs extends Component {
275
274
  return this.$root.querySelector(`a.govuk-tabs__tab[href="${hash}"]`);
276
275
  }
277
276
  setAttributes($tab) {
278
- const panelId = getFragmentFromUrl($tab.href);
277
+ const panelId = $tab.hash.replace('#', '');
279
278
  if (!panelId) {
280
279
  return;
281
280
  }
@@ -379,7 +378,7 @@ class Tabs extends Component {
379
378
  this.createHistoryEntry($previousTab);
380
379
  }
381
380
  getPanel($tab) {
382
- const panelId = getFragmentFromUrl($tab.href);
381
+ const panelId = $tab.hash.replace('#', '');
383
382
  if (!panelId) {
384
383
  return null;
385
384
  }
@@ -1,4 +1,4 @@
1
- import { getBreakpoint, getFragmentFromUrl } from '../../common/index.mjs';
1
+ import { getBreakpoint } from '../../common/index.mjs';
2
2
  import { Component } from '../../component.mjs';
3
3
  import { ElementError } from '../../errors/index.mjs';
4
4
 
@@ -133,7 +133,7 @@ class Tabs extends Component {
133
133
  return this.$root.querySelector(`a.govuk-tabs__tab[href="${hash}"]`);
134
134
  }
135
135
  setAttributes($tab) {
136
- const panelId = getFragmentFromUrl($tab.href);
136
+ const panelId = $tab.hash.replace('#', '');
137
137
  if (!panelId) {
138
138
  return;
139
139
  }
@@ -237,7 +237,7 @@ class Tabs extends Component {
237
237
  this.createHistoryEntry($previousTab);
238
238
  }
239
239
  getPanel($tab) {
240
- const panelId = getFragmentFromUrl($tab.href);
240
+ const panelId = $tab.hash.replace('#', '');
241
241
  if (!panelId) {
242
242
  return null;
243
243
  }
@@ -1,8 +1,44 @@
1
+ ////
2
+ /// @group components/tag
3
+ ////
4
+
5
+ /// Get tag text colour
6
+ /// Almost all tags should use the 50% shade of their colour for their text
7
+ ///
8
+ /// @param {String} $colour - name of colour from the colour palette
9
+ /// @return {Colour} Representation of the named colour for use in tags
10
+ /// @access private
11
+ @function _govuk-tag-text-colour($colour) {
12
+ @return govuk-colour($colour, $variant: "shade-50");
13
+ }
14
+
15
+ /// Get tag background colour
16
+ /// Almost all tags should use the 80% tint of their colour for their background
17
+ ///
18
+ /// @param {String} $colour - name of colour from the colour palette
19
+ /// @return {Colour} Representation of the named colour for use in tags
20
+ /// @access private
21
+ @function _govuk-tag-background-colour($colour) {
22
+ @return govuk-colour($colour, $variant: "tint-80");
23
+ }
24
+
25
+ /// Generate colour CSS for tag and tag modifiers
26
+ /// Applies standard rules from the tag colour functions
27
+ ///
28
+ /// @param {String} $colour - name of colour from the colour palette
29
+ /// @access private
30
+ @mixin _govuk-tag-colours($colour) {
31
+ color: _govuk-tag-text-colour($colour);
32
+ background-color: _govuk-tag-background-colour($colour);
33
+ }
34
+
1
35
  @include govuk-exports("govuk/component/tag") {
2
36
  $govuk-tag-max-width: if(map-has-key($govuk-breakpoints, "mobile"), map-get($govuk-breakpoints, "mobile") / 2, 160px);
3
37
 
4
38
  .govuk-tag {
5
39
  @include govuk-font($size: 19);
40
+ // Default tag colour is blue
41
+ @include _govuk-tag-colours("blue");
6
42
 
7
43
  display: inline-block;
8
44
 
@@ -25,8 +61,8 @@
25
61
  padding-right: 8px;
26
62
  padding-bottom: 3px;
27
63
  padding-left: 8px;
28
- color: govuk-shade(govuk-colour("blue"), 60%);
29
- background-color: govuk-tint(govuk-colour("blue"), 70%);
64
+
65
+ border-radius: 1px;
30
66
  text-decoration: none;
31
67
  overflow-wrap: break-word;
32
68
 
@@ -43,54 +79,53 @@
43
79
  }
44
80
  }
45
81
 
46
- .govuk-tag--grey {
47
- color: govuk-shade(govuk-colour("dark-grey"), 50%);
48
- background-color: govuk-tint(govuk-colour("dark-grey"), 85%);
82
+ // Tag colour modifiers. Use the _govuk-tag-colours mixin to define consistent
83
+ // colour rules per modifier
84
+ .govuk-tag--green {
85
+ @include _govuk-tag-colours("green");
49
86
  }
50
87
 
51
88
  .govuk-tag--purple {
52
- color: govuk-shade(govuk-colour("bright-purple"), 50%);
53
- background-color: govuk-tint(govuk-colour("bright-purple"), 85%);
89
+ @include _govuk-tag-colours("purple");
54
90
  }
55
91
 
56
- .govuk-tag--turquoise {
57
- color: govuk-shade(govuk-colour("turquoise"), 60%);
58
- background-color: govuk-tint(govuk-colour("turquoise"), 80%);
92
+ .govuk-tag--red {
93
+ @include _govuk-tag-colours("red");
59
94
  }
60
95
 
61
- .govuk-tag--blue {
62
- color: govuk-shade(govuk-colour("blue"), 60%);
63
- background-color: govuk-tint(govuk-colour("blue"), 70%);
96
+ .govuk-tag--orange {
97
+ @include _govuk-tag-colours("orange");
64
98
  }
65
99
 
66
- .govuk-tag--light-blue {
67
- color: govuk-shade(govuk-colour("blue"), 60%);
68
- background-color: govuk-tint(govuk-colour("blue"), 90%);
100
+ .govuk-tag--teal {
101
+ @include _govuk-tag-colours("teal");
69
102
  }
70
103
 
71
- .govuk-tag--yellow {
72
- color: govuk-shade(govuk-colour("yellow"), 65%);
73
- background-color: govuk-tint(govuk-colour("yellow"), 75%);
104
+ .govuk-tag--magenta {
105
+ @include _govuk-tag-colours("magenta");
74
106
  }
75
107
 
76
- .govuk-tag--orange {
77
- color: govuk-shade(govuk-colour("orange"), 55%);
78
- background-color: govuk-tint(govuk-colour("orange"), 70%);
108
+ // Yellow uses different colours to ensure it's legible
109
+ .govuk-tag--yellow {
110
+ color: govuk-colour("orange", $variant: "shade-50");
111
+ background-color: govuk-colour("yellow", $variant: "tint-50");
79
112
  }
80
113
 
81
- .govuk-tag--red {
82
- color: govuk-shade(govuk-colour("red"), 80%);
83
- background-color: govuk-tint(govuk-colour("red"), 75%);
114
+ // Grey uses different colours to ensure it's legible
115
+ .govuk-tag--grey {
116
+ color: govuk-colour("black");
117
+ background-color: govuk-colour("black", $variant: "tint-80");
84
118
  }
85
119
 
86
- .govuk-tag--pink {
87
- color: govuk-shade(govuk-colour("pink"), 50%);
88
- background-color: govuk-tint(govuk-colour("pink"), 85%);
120
+ // Turquoise and pink are deprecated over teal and magenta respectively
121
+ // @deprecated
122
+ .govuk-tag--turquoise {
123
+ @include _govuk-tag-colours("teal");
89
124
  }
90
125
 
91
- .govuk-tag--green {
92
- color: govuk-shade(govuk-colour("green"), 20%);
93
- background-color: govuk-tint(govuk-colour("green"), 80%);
126
+ // @deprecated
127
+ .govuk-tag--pink {
128
+ @include _govuk-tag-colours("magenta");
94
129
  }
95
130
  }
96
131
 
@@ -1,7 +1,7 @@
1
1
  @import "../tag/index";
2
2
 
3
3
  @include govuk-exports("govuk/component/task-list") {
4
- $govuk-task-list-hover-colour: govuk-colour("light-grey");
4
+ $govuk-task-list-hover-colour: govuk-colour("black", $variant: "tint-95");
5
5
 
6
6
  .govuk-task-list {
7
7
  @include govuk-font($size: 19);
@@ -25,11 +25,13 @@
25
25
  margin-bottom: 0;
26
26
  padding-top: govuk-spacing(2);
27
27
  padding-bottom: govuk-spacing(2);
28
- border-bottom: 1px solid $govuk-border-colour;
28
+ border-bottom: 1px solid;
29
+ border-bottom-color: govuk-functional-colour(border);
29
30
  }
30
31
 
31
32
  .govuk-task-list__item:first-child {
32
- border-top: 1px solid $govuk-border-colour;
33
+ border-top: 1px solid;
34
+ border-top-color: govuk-functional-colour(border);
33
35
  }
34
36
 
35
37
  // This class is added to the <li> elements where the task name is a link. The
@@ -54,7 +56,7 @@
54
56
  }
55
57
 
56
58
  .govuk-task-list__status--cannot-start-yet {
57
- color: $govuk-secondary-text-colour;
59
+ color: govuk-functional-colour(secondary-text);
58
60
  }
59
61
 
60
62
  // This adds an empty transparent box covering the whole row, including the
@@ -72,7 +74,7 @@
72
74
 
73
75
  .govuk-task-list__hint {
74
76
  margin-top: govuk-spacing(1);
75
- color: $govuk-secondary-text-colour;
77
+ color: govuk-functional-colour(secondary-text);
76
78
  }
77
79
  }
78
80
 
@@ -15,19 +15,14 @@
15
15
 
16
16
  resize: vertical;
17
17
 
18
- border: $govuk-border-width-form-element solid $govuk-input-border-colour;
18
+ border: $govuk-border-width-form-element solid;
19
19
  border-radius: 0;
20
+ border-color: govuk-functional-colour(input-border);
20
21
 
21
22
  -webkit-appearance: none;
22
23
 
23
24
  &:focus {
24
- outline: $govuk-focus-width solid $govuk-focus-colour;
25
- // Ensure outline appears outside of the element
26
- outline-offset: 0;
27
- // Double the border by adding its width again. Use `box-shadow` to do
28
- // this instead of changing `border-width` (which changes element size)
29
- // and since `outline` is already used for the yellow focus state.
30
- box-shadow: inset 0 0 0 $govuk-border-width-form-element;
25
+ @include govuk-focused-form-input;
31
26
  }
32
27
 
33
28
  &:disabled {
@@ -39,10 +34,10 @@
39
34
  }
40
35
 
41
36
  .govuk-textarea--error {
42
- border-color: $govuk-error-colour;
37
+ border-color: govuk-functional-colour(error);
43
38
 
44
39
  &:focus {
45
- border-color: $govuk-input-border-colour;
40
+ border-color: govuk-functional-colour(input-border);
46
41
  }
47
42
  }
48
43
  }
@@ -19,17 +19,18 @@
19
19
  min-height: 35px;
20
20
  margin-top: -7px;
21
21
 
22
- @include govuk-media-query($from: tablet) {
22
+ @media #{govuk-from-breakpoint(tablet)} {
23
23
  margin-top: -5px;
24
24
  }
25
25
 
26
26
  // When a user customises their colours the background colour will often be
27
27
  // removed. Adding a border to the component keeps it's shape as a circle.
28
- border: 3px solid $govuk-text-colour;
28
+ border: 3px solid;
29
29
  border-radius: 50%;
30
+ border-color: govuk-functional-colour(text);
30
31
 
31
- color: $govuk-body-background-colour;
32
- background: $govuk-text-colour;
32
+ color: govuk-functional-colour(body-background);
33
+ background: govuk-functional-colour(text);
33
34
 
34
35
  font-size: 30px;
35
36
  line-height: 29px;
@@ -1,4 +1,3 @@
1
- @import "govuk-frontend-properties";
2
1
  @import "links";
3
2
  @import "lists";
4
3
  @import "typography";
@@ -38,7 +38,7 @@
38
38
  %govuk-list--number > li {
39
39
  margin-bottom: 0;
40
40
 
41
- @include govuk-media-query($from: tablet) {
41
+ @media #{govuk-from-breakpoint(tablet)} {
42
42
  margin-bottom: govuk-spacing(1);
43
43
  }
44
44
  }
@@ -46,7 +46,7 @@
46
46
  %govuk-list--spaced > li {
47
47
  margin-bottom: govuk-spacing(2);
48
48
 
49
- @include govuk-media-query($from: tablet) {
49
+ @media #{govuk-from-breakpoint(tablet)} {
50
50
  margin-bottom: govuk-spacing(3);
51
51
  }
52
52
  }
@@ -40,7 +40,8 @@
40
40
  // Visible variant
41
41
 
42
42
  %govuk-section-break--visible {
43
- border-bottom: 1px solid $govuk-border-colour;
43
+ border-bottom: 1px solid;
44
+ border-bottom-color: govuk-functional-colour(border);
44
45
  }
45
46
 
46
47
  .govuk-section-break--visible {
@@ -66,7 +66,7 @@
66
66
 
67
67
  margin-bottom: govuk-spacing(1);
68
68
 
69
- color: $govuk-secondary-text-colour;
69
+ color: govuk-functional-colour(secondary-text);
70
70
  }
71
71
 
72
72
  .govuk-caption-l {
@@ -75,9 +75,9 @@
75
75
  display: block;
76
76
 
77
77
  margin-bottom: govuk-spacing(1);
78
- color: $govuk-secondary-text-colour;
78
+ color: govuk-functional-colour(secondary-text);
79
79
 
80
- @include govuk-media-query($from: tablet) {
80
+ @media #{govuk-from-breakpoint(tablet)} {
81
81
  margin-bottom: 0;
82
82
  }
83
83
  }
@@ -87,7 +87,7 @@
87
87
 
88
88
  display: block;
89
89
 
90
- color: $govuk-secondary-text-colour;
90
+ color: govuk-functional-colour(secondary-text);
91
91
  }
92
92
 
93
93
  // Body (paragraphs)
@@ -128,20 +128,6 @@
128
128
  @extend %govuk-body-s;
129
129
  }
130
130
 
131
- // @deprecated
132
- %govuk-body-xs {
133
- @include govuk-text-colour;
134
- @include govuk-font($size: _14);
135
-
136
- margin-top: 0;
137
- @include govuk-responsive-margin(4, "bottom");
138
- }
139
-
140
- // @deprecated
141
- .govuk-body-xs {
142
- @extend %govuk-body-xs;
143
- }
144
-
145
131
  // Usage aliases
146
132
 
147
133
  // Using extend to alias means we also inherit any contextual adjustments that
@@ -161,7 +147,7 @@
161
147
  %govuk-body-l + %govuk-heading-l {
162
148
  padding-top: govuk-spacing(1);
163
149
 
164
- @include govuk-media-query($from: tablet) {
150
+ @media #{govuk-from-breakpoint(tablet)} {
165
151
  padding-top: govuk-spacing(2);
166
152
  }
167
153
  }
@@ -180,7 +166,7 @@
180
166
  %govuk-list + %govuk-heading-s {
181
167
  padding-top: govuk-spacing(1);
182
168
 
183
- @include govuk-media-query($from: tablet) {
169
+ @media #{govuk-from-breakpoint(tablet)} {
184
170
  padding-top: govuk-spacing(2);
185
171
  }
186
172
  }
@@ -0,0 +1,17 @@
1
+ @import "../settings/custom-properties";
2
+ @import "../settings/media-queries";
3
+ @import "../tools/exports";
4
+ @import "../tools/px-to-rem";
5
+
6
+ // CSS custom property for each breakpoint
7
+ @include govuk-exports("govuk/custom-properties/breakpoints") {
8
+ :root {
9
+ @if $govuk-output-custom-properties {
10
+ @each $name, $value in $govuk-breakpoints {
11
+ --govuk-breakpoint-#{$name}: #{govuk-px-to-rem($value)};
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ /*# sourceMappingURL=_breakpoints.scss.map */
@@ -0,0 +1,15 @@
1
+ @import "../tools/exports";
2
+
3
+ // This custom property is automatically overwritten during builds and
4
+ // releases. It doesn't need to be updated manually.
5
+ //
6
+ // This custom property is always output by base regardless of if
7
+ // `$govuk-output-custom-properties` is true or not to help with checking if
8
+ // multiple stylesheets are outputting the same version
9
+ @include govuk-exports("govuk/custom-properties/frontend-version") {
10
+ :root {
11
+ --govuk-frontend-version: "6.0.0";
12
+ }
13
+ }
14
+
15
+ /*# sourceMappingURL=_frontend-version.scss.map */
@@ -0,0 +1,17 @@
1
+ @import "../settings/custom-properties";
2
+ @import "../settings/colours-functional";
3
+ @import "../tools/exports";
4
+ @import "../helpers/colour";
5
+
6
+ // CSS custom properties for each functional colour
7
+ @include govuk-exports("govuk/custom-properties/functional-colours") {
8
+ :root {
9
+ @if $govuk-output-custom-properties {
10
+ @each $name, $value in $govuk-functional-colours {
11
+ --govuk-#{$name}-colour: #{_govuk-resolve-colour($value)};
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ /*# sourceMappingURL=_functional-colours.scss.map */
@@ -0,0 +1,5 @@
1
+ @import "breakpoints";
2
+ @import "frontend-version";
3
+ @import "functional-colours";
4
+
5
+ /*# sourceMappingURL=_index.scss.map */
@@ -1,4 +1,4 @@
1
- import { formatErrorMessage } from '../common/index.mjs';
1
+ import { isObject, formatErrorMessage } from '../common/index.mjs';
2
2
 
3
3
  class GOVUKFrontendError extends Error {
4
4
  constructor(...args) {
@@ -27,7 +27,7 @@ class ConfigError extends GOVUKFrontendError {
27
27
  class ElementError extends GOVUKFrontendError {
28
28
  constructor(messageOrOptions) {
29
29
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
30
- if (typeof messageOrOptions === 'object') {
30
+ if (isObject(messageOrOptions)) {
31
31
  const {
32
32
  component,
33
33
  identifier,
@@ -36,7 +36,9 @@ class ElementError extends GOVUKFrontendError {
36
36
  } = messageOrOptions;
37
37
  message = identifier;
38
38
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
39
- message = formatErrorMessage(component, message);
39
+ if (component) {
40
+ message = formatErrorMessage(component, message);
41
+ }
40
42
  }
41
43
  super(message);
42
44
  this.name = 'ElementError';