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
@@ -31,6 +31,12 @@
31
31
  }
32
32
  return $scope.classList.contains('govuk-frontend-supported');
33
33
  }
34
+ function isArray(option) {
35
+ return Array.isArray(option);
36
+ }
37
+ function isObject(option) {
38
+ return !!option && typeof option === 'object' && !isArray(option);
39
+ }
34
40
  function formatErrorMessage(Component, message) {
35
41
  return `${Component.moduleName}: ${message}`;
36
42
  }
@@ -38,9 +44,6 @@
38
44
  * @typedef ComponentWithModuleName
39
45
  * @property {string} moduleName - Name of the component
40
46
  */
41
- /**
42
- * @import { ObjectNested } from './configuration.mjs'
43
- */
44
47
 
45
48
  class GOVUKFrontendError extends Error {
46
49
  constructor(...args) {
@@ -63,7 +66,7 @@
63
66
  class ElementError extends GOVUKFrontendError {
64
67
  constructor(messageOrOptions) {
65
68
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
66
- if (typeof messageOrOptions === 'object') {
69
+ if (isObject(messageOrOptions)) {
67
70
  const {
68
71
  component,
69
72
  identifier,
@@ -72,7 +75,9 @@
72
75
  } = messageOrOptions;
73
76
  message = identifier;
74
77
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
75
- message = formatErrorMessage(component, message);
78
+ if (component) {
79
+ message = formatErrorMessage(component, message);
80
+ }
76
81
  }
77
82
  super(message);
78
83
  this.name = 'ElementError';
@@ -205,9 +210,9 @@
205
210
  }
206
211
  if (this.mql.matches) {
207
212
  this.$menu.removeAttribute('hidden');
208
- this.$menuButton.setAttribute('hidden', '');
213
+ setAttributes(this.$menuButton, attributesForHidingButton);
209
214
  } else {
210
- this.$menuButton.removeAttribute('hidden');
215
+ removeAttributes(this.$menuButton, Object.keys(attributesForHidingButton));
211
216
  this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString());
212
217
  if (this.menuIsOpen) {
213
218
  this.$menu.removeAttribute('hidden');
@@ -222,6 +227,34 @@
222
227
  }
223
228
  }
224
229
  ServiceNavigation.moduleName = 'govuk-service-navigation';
230
+ const attributesForHidingButton = {
231
+ hidden: '',
232
+ 'aria-hidden': 'true'
233
+ };
234
+
235
+ /**
236
+ * Sets a group of attributes on the given element
237
+ *
238
+ * @param {Element} $element - The element to set the attribute on
239
+ * @param {{[attributeName: string]: string}} attributes - The attributes to set
240
+ */
241
+ function setAttributes($element, attributes) {
242
+ for (const attributeName in attributes) {
243
+ $element.setAttribute(attributeName, attributes[attributeName]);
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Removes a list of attributes from the given element
249
+ *
250
+ * @param {Element} $element - The element to remove the attributes from
251
+ * @param {string[]} attributeNames - The names of the attributes to remove
252
+ */
253
+ function removeAttributes($element, attributeNames) {
254
+ for (const attributeName of attributeNames) {
255
+ $element.removeAttribute(attributeName);
256
+ }
257
+ }
225
258
 
226
259
  exports.ServiceNavigation = ServiceNavigation;
227
260
 
@@ -25,6 +25,12 @@ function isSupported($scope = document.body) {
25
25
  }
26
26
  return $scope.classList.contains('govuk-frontend-supported');
27
27
  }
28
+ function isArray(option) {
29
+ return Array.isArray(option);
30
+ }
31
+ function isObject(option) {
32
+ return !!option && typeof option === 'object' && !isArray(option);
33
+ }
28
34
  function formatErrorMessage(Component, message) {
29
35
  return `${Component.moduleName}: ${message}`;
30
36
  }
@@ -32,9 +38,6 @@ function formatErrorMessage(Component, message) {
32
38
  * @typedef ComponentWithModuleName
33
39
  * @property {string} moduleName - Name of the component
34
40
  */
35
- /**
36
- * @import { ObjectNested } from './configuration.mjs'
37
- */
38
41
 
39
42
  class GOVUKFrontendError extends Error {
40
43
  constructor(...args) {
@@ -57,7 +60,7 @@ class SupportError extends GOVUKFrontendError {
57
60
  class ElementError extends GOVUKFrontendError {
58
61
  constructor(messageOrOptions) {
59
62
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
60
- if (typeof messageOrOptions === 'object') {
63
+ if (isObject(messageOrOptions)) {
61
64
  const {
62
65
  component,
63
66
  identifier,
@@ -66,7 +69,9 @@ class ElementError extends GOVUKFrontendError {
66
69
  } = messageOrOptions;
67
70
  message = identifier;
68
71
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
69
- message = formatErrorMessage(component, message);
72
+ if (component) {
73
+ message = formatErrorMessage(component, message);
74
+ }
70
75
  }
71
76
  super(message);
72
77
  this.name = 'ElementError';
@@ -199,9 +204,9 @@ class ServiceNavigation extends Component {
199
204
  }
200
205
  if (this.mql.matches) {
201
206
  this.$menu.removeAttribute('hidden');
202
- this.$menuButton.setAttribute('hidden', '');
207
+ setAttributes(this.$menuButton, attributesForHidingButton);
203
208
  } else {
204
- this.$menuButton.removeAttribute('hidden');
209
+ removeAttributes(this.$menuButton, Object.keys(attributesForHidingButton));
205
210
  this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString());
206
211
  if (this.menuIsOpen) {
207
212
  this.$menu.removeAttribute('hidden');
@@ -216,6 +221,34 @@ class ServiceNavigation extends Component {
216
221
  }
217
222
  }
218
223
  ServiceNavigation.moduleName = 'govuk-service-navigation';
224
+ const attributesForHidingButton = {
225
+ hidden: '',
226
+ 'aria-hidden': 'true'
227
+ };
228
+
229
+ /**
230
+ * Sets a group of attributes on the given element
231
+ *
232
+ * @param {Element} $element - The element to set the attribute on
233
+ * @param {{[attributeName: string]: string}} attributes - The attributes to set
234
+ */
235
+ function setAttributes($element, attributes) {
236
+ for (const attributeName in attributes) {
237
+ $element.setAttribute(attributeName, attributes[attributeName]);
238
+ }
239
+ }
240
+
241
+ /**
242
+ * Removes a list of attributes from the given element
243
+ *
244
+ * @param {Element} $element - The element to remove the attributes from
245
+ * @param {string[]} attributeNames - The names of the attributes to remove
246
+ */
247
+ function removeAttributes($element, attributeNames) {
248
+ for (const attributeName of attributeNames) {
249
+ $element.removeAttribute(attributeName);
250
+ }
251
+ }
219
252
 
220
253
  export { ServiceNavigation };
221
254
  //# sourceMappingURL=service-navigation.bundle.mjs.map
@@ -63,9 +63,9 @@ class ServiceNavigation extends Component {
63
63
  }
64
64
  if (this.mql.matches) {
65
65
  this.$menu.removeAttribute('hidden');
66
- this.$menuButton.setAttribute('hidden', '');
66
+ setAttributes(this.$menuButton, attributesForHidingButton);
67
67
  } else {
68
- this.$menuButton.removeAttribute('hidden');
68
+ removeAttributes(this.$menuButton, Object.keys(attributesForHidingButton));
69
69
  this.$menuButton.setAttribute('aria-expanded', this.menuIsOpen.toString());
70
70
  if (this.menuIsOpen) {
71
71
  this.$menu.removeAttribute('hidden');
@@ -80,6 +80,34 @@ class ServiceNavigation extends Component {
80
80
  }
81
81
  }
82
82
  ServiceNavigation.moduleName = 'govuk-service-navigation';
83
+ const attributesForHidingButton = {
84
+ hidden: '',
85
+ 'aria-hidden': 'true'
86
+ };
87
+
88
+ /**
89
+ * Sets a group of attributes on the given element
90
+ *
91
+ * @param {Element} $element - The element to set the attribute on
92
+ * @param {{[attributeName: string]: string}} attributes - The attributes to set
93
+ */
94
+ function setAttributes($element, attributes) {
95
+ for (const attributeName in attributes) {
96
+ $element.setAttribute(attributeName, attributes[attributeName]);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Removes a list of attributes from the given element
102
+ *
103
+ * @param {Element} $element - The element to remove the attributes from
104
+ * @param {string[]} attributeNames - The names of the attributes to remove
105
+ */
106
+ function removeAttributes($element, attributeNames) {
107
+ for (const attributeName of attributeNames) {
108
+ $element.removeAttribute(attributeName);
109
+ }
110
+ }
83
111
 
84
112
  export { ServiceNavigation };
85
113
  //# sourceMappingURL=service-navigation.mjs.map
@@ -1,10 +1,9 @@
1
1
  @include govuk-exports("govuk/component/skip-link") {
2
2
  .govuk-skip-link {
3
3
  @include govuk-visually-hidden-focusable;
4
- @include govuk-typography-common;
5
4
  @include govuk-link-decoration;
6
5
  @include govuk-link-style-text;
7
- @include govuk-font-size($size: 16);
6
+ @include govuk-font($size: 16);
8
7
 
9
8
  display: block;
10
9
  padding: govuk-spacing(2) govuk-spacing(3);
@@ -21,9 +20,14 @@
21
20
  }
22
21
 
23
22
  &:focus {
24
- outline: $govuk-focus-width solid $govuk-focus-colour;
23
+ outline: $govuk-focus-width solid;
24
+ outline-color: govuk-functional-colour(focus);
25
25
  outline-offset: 0;
26
- background-color: $govuk-focus-colour;
26
+ background-color: govuk-functional-colour(focus);
27
+
28
+ @media (forced-colors: active) {
29
+ outline-offset: (0 - $govuk-focus-width);
30
+ }
27
31
 
28
32
  // Undo unwanted changes when global styles are enabled
29
33
  @if $govuk-global-styles {
@@ -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 setFocus($element, options = {}) {
14
8
  var _options$onBeforeFocu;
15
9
  const isFocusable = $element.getAttribute('tabindex');
@@ -53,6 +47,12 @@
53
47
  }
54
48
  return $scope.classList.contains('govuk-frontend-supported');
55
49
  }
50
+ function isArray(option) {
51
+ return Array.isArray(option);
52
+ }
53
+ function isObject(option) {
54
+ return !!option && typeof option === 'object' && !isArray(option);
55
+ }
56
56
  function formatErrorMessage(Component, message) {
57
57
  return `${Component.moduleName}: ${message}`;
58
58
  }
@@ -60,9 +60,6 @@
60
60
  * @typedef ComponentWithModuleName
61
61
  * @property {string} moduleName - Name of the component
62
62
  */
63
- /**
64
- * @import { ObjectNested } from './configuration.mjs'
65
- */
66
63
 
67
64
  class GOVUKFrontendError extends Error {
68
65
  constructor(...args) {
@@ -85,7 +82,7 @@
85
82
  class ElementError extends GOVUKFrontendError {
86
83
  constructor(messageOrOptions) {
87
84
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
88
- if (typeof messageOrOptions === 'object') {
85
+ if (isObject(messageOrOptions)) {
89
86
  const {
90
87
  component,
91
88
  identifier,
@@ -94,7 +91,9 @@
94
91
  } = messageOrOptions;
95
92
  message = identifier;
96
93
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
97
- message = formatErrorMessage(component, message);
94
+ if (component) {
95
+ message = formatErrorMessage(component, message);
96
+ }
98
97
  }
99
98
  super(message);
100
99
  this.name = 'ElementError';
@@ -184,16 +183,10 @@
184
183
  super($root);
185
184
  const hash = this.$root.hash;
186
185
  const href = (_this$$root$getAttrib = this.$root.getAttribute('href')) != null ? _this$$root$getAttrib : '';
187
- let url;
188
- try {
189
- url = new window.URL(this.$root.href);
190
- } catch (error) {
191
- throw new ElementError(`Skip link: Target link (\`href="${href}"\`) is invalid`);
192
- }
193
- if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) {
186
+ if (this.$root.origin !== window.location.origin || this.$root.pathname !== window.location.pathname) {
194
187
  return;
195
188
  }
196
- const linkedElementId = getFragmentFromUrl(hash);
189
+ const linkedElementId = hash.replace('#', '');
197
190
  if (!linkedElementId) {
198
191
  throw new ElementError(`Skip link: Target link (\`href="${href}"\`) has no hash fragment`);
199
192
  }
@@ -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 setFocus($element, options = {}) {
8
2
  var _options$onBeforeFocu;
9
3
  const isFocusable = $element.getAttribute('tabindex');
@@ -47,6 +41,12 @@ function isSupported($scope = document.body) {
47
41
  }
48
42
  return $scope.classList.contains('govuk-frontend-supported');
49
43
  }
44
+ function isArray(option) {
45
+ return Array.isArray(option);
46
+ }
47
+ function isObject(option) {
48
+ return !!option && typeof option === 'object' && !isArray(option);
49
+ }
50
50
  function formatErrorMessage(Component, message) {
51
51
  return `${Component.moduleName}: ${message}`;
52
52
  }
@@ -54,9 +54,6 @@ function formatErrorMessage(Component, message) {
54
54
  * @typedef ComponentWithModuleName
55
55
  * @property {string} moduleName - Name of the component
56
56
  */
57
- /**
58
- * @import { ObjectNested } from './configuration.mjs'
59
- */
60
57
 
61
58
  class GOVUKFrontendError extends Error {
62
59
  constructor(...args) {
@@ -79,7 +76,7 @@ class SupportError extends GOVUKFrontendError {
79
76
  class ElementError extends GOVUKFrontendError {
80
77
  constructor(messageOrOptions) {
81
78
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
82
- if (typeof messageOrOptions === 'object') {
79
+ if (isObject(messageOrOptions)) {
83
80
  const {
84
81
  component,
85
82
  identifier,
@@ -88,7 +85,9 @@ class ElementError extends GOVUKFrontendError {
88
85
  } = messageOrOptions;
89
86
  message = identifier;
90
87
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
91
- message = formatErrorMessage(component, message);
88
+ if (component) {
89
+ message = formatErrorMessage(component, message);
90
+ }
92
91
  }
93
92
  super(message);
94
93
  this.name = 'ElementError';
@@ -178,16 +177,10 @@ class SkipLink extends Component {
178
177
  super($root);
179
178
  const hash = this.$root.hash;
180
179
  const href = (_this$$root$getAttrib = this.$root.getAttribute('href')) != null ? _this$$root$getAttrib : '';
181
- let url;
182
- try {
183
- url = new window.URL(this.$root.href);
184
- } catch (error) {
185
- throw new ElementError(`Skip link: Target link (\`href="${href}"\`) is invalid`);
186
- }
187
- if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) {
180
+ if (this.$root.origin !== window.location.origin || this.$root.pathname !== window.location.pathname) {
188
181
  return;
189
182
  }
190
- const linkedElementId = getFragmentFromUrl(hash);
183
+ const linkedElementId = hash.replace('#', '');
191
184
  if (!linkedElementId) {
192
185
  throw new ElementError(`Skip link: Target link (\`href="${href}"\`) has no hash fragment`);
193
186
  }
@@ -1,4 +1,4 @@
1
- import { getFragmentFromUrl, setFocus } from '../../common/index.mjs';
1
+ import { setFocus } from '../../common/index.mjs';
2
2
  import { Component } from '../../component.mjs';
3
3
  import { ElementError } from '../../errors/index.mjs';
4
4
 
@@ -20,16 +20,10 @@ class SkipLink extends Component {
20
20
  super($root);
21
21
  const hash = this.$root.hash;
22
22
  const href = (_this$$root$getAttrib = this.$root.getAttribute('href')) != null ? _this$$root$getAttrib : '';
23
- let url;
24
- try {
25
- url = new window.URL(this.$root.href);
26
- } catch (error) {
27
- throw new ElementError(`Skip link: Target link (\`href="${href}"\`) is invalid`);
28
- }
29
- if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) {
23
+ if (this.$root.origin !== window.location.origin || this.$root.pathname !== window.location.pathname) {
30
24
  return;
31
25
  }
32
- const linkedElementId = getFragmentFromUrl(hash);
26
+ const linkedElementId = hash.replace('#', '');
33
27
  if (!linkedElementId) {
34
28
  throw new ElementError(`Skip link: Target link (\`href="${href}"\`) has no hash fragment`);
35
29
  }
@@ -2,7 +2,7 @@
2
2
  .govuk-summary-list {
3
3
  @include govuk-font($size: 19);
4
4
  @include govuk-text-colour;
5
- @include govuk-media-query($from: tablet) {
5
+ @media #{govuk-from-breakpoint(tablet)} {
6
6
  display: table;
7
7
  width: 100%;
8
8
  table-layout: fixed; // Required to allow us to wrap words that overflow.
@@ -13,12 +13,13 @@
13
13
  }
14
14
 
15
15
  .govuk-summary-list__row {
16
- border-bottom: 1px solid $govuk-border-colour;
16
+ border-bottom: 1px solid;
17
+ border-bottom-color: govuk-functional-colour(border);
17
18
 
18
- @include govuk-media-query($until: tablet) {
19
+ @media #{govuk-until-breakpoint(tablet)} {
19
20
  margin-bottom: govuk-spacing(3);
20
21
  }
21
- @include govuk-media-query($from: tablet) {
22
+ @media #{govuk-from-breakpoint(tablet)} {
22
23
  display: table-row;
23
24
  }
24
25
  }
@@ -31,7 +32,7 @@
31
32
  // Provide an empty 'cell' for rows that don't have actions – otherwise the
32
33
  // bottom border is not drawn for that part of the row in some browsers.
33
34
  .govuk-summary-list__row--no-actions {
34
- @include govuk-media-query($from: tablet) {
35
+ @media #{govuk-from-breakpoint(tablet)} {
35
36
  &::after {
36
37
  content: "";
37
38
  display: table-cell;
@@ -45,7 +46,7 @@
45
46
  .govuk-summary-list__actions {
46
47
  margin: 0; // Reset default user agent styles
47
48
 
48
- @include govuk-media-query($from: tablet) {
49
+ @media #{govuk-from-breakpoint(tablet)} {
49
50
  display: table-cell;
50
51
  padding-top: govuk-spacing(2);
51
52
  padding-right: govuk-spacing(4);
@@ -55,7 +56,7 @@
55
56
 
56
57
  .govuk-summary-list__actions {
57
58
  margin-bottom: govuk-spacing(3);
58
- @include govuk-media-query($from: tablet) {
59
+ @media #{govuk-from-breakpoint(tablet)} {
59
60
  width: 20%;
60
61
  text-align: right;
61
62
  }
@@ -71,13 +72,13 @@
71
72
  .govuk-summary-list__key {
72
73
  margin-bottom: govuk-spacing(1);
73
74
  @include govuk-typography-weight-bold;
74
- @include govuk-media-query($from: tablet) {
75
+ @media #{govuk-from-breakpoint(tablet)} {
75
76
  width: 30%;
76
77
  }
77
78
  }
78
79
 
79
80
  .govuk-summary-list__value {
80
- @include govuk-media-query($until: tablet) {
81
+ @media #{govuk-until-breakpoint(tablet)} {
81
82
  margin-bottom: govuk-spacing(3);
82
83
  }
83
84
  }
@@ -101,12 +102,13 @@
101
102
  display: inline-block;
102
103
  }
103
104
 
104
- @include govuk-media-query($until: tablet) {
105
+ @media #{govuk-until-breakpoint(tablet)} {
105
106
  .govuk-summary-list__actions-list-item,
106
107
  .govuk-summary-card__action {
107
108
  margin-right: govuk-spacing(2);
108
109
  padding-right: govuk-spacing(2);
109
- border-right: 1px solid $govuk-border-colour;
110
+ border-right: 1px solid;
111
+ border-right-color: govuk-functional-colour(border);
110
112
  }
111
113
 
112
114
  .govuk-summary-list__actions-list-item:last-child,
@@ -117,7 +119,7 @@
117
119
  }
118
120
  }
119
121
 
120
- @include govuk-media-query($from: tablet) {
122
+ @media #{govuk-from-breakpoint(tablet)} {
121
123
  .govuk-summary-list__actions-list-item,
122
124
  .govuk-summary-card__action {
123
125
  margin-left: govuk-spacing(2);
@@ -126,7 +128,8 @@
126
128
 
127
129
  .govuk-summary-list__actions-list-item:not(:first-child),
128
130
  .govuk-summary-card__action:not(:first-child) {
129
- border-left: 1px solid $govuk-border-colour;
131
+ border-left: 1px solid;
132
+ border-left-color: govuk-functional-colour(border);
130
133
  }
131
134
 
132
135
  .govuk-summary-list__actions-list-item:first-child,
@@ -153,7 +156,7 @@
153
156
  }
154
157
 
155
158
  // Increase padding by 1px to compensate for 'missing' border
156
- @include govuk-media-query($from: tablet) {
159
+ @media #{govuk-from-breakpoint(tablet)} {
157
160
  .govuk-summary-list__key,
158
161
  .govuk-summary-list__value,
159
162
  .govuk-summary-list__actions {
@@ -167,7 +170,7 @@
167
170
  border: 0;
168
171
 
169
172
  // Increase padding by 1px to compensate for 'missing' border
170
- @include govuk-media-query($from: tablet) {
173
+ @media #{govuk-from-breakpoint(tablet)} {
171
174
  .govuk-summary-list__key,
172
175
  .govuk-summary-list__value,
173
176
  .govuk-summary-list__actions {
@@ -179,7 +182,8 @@
179
182
  // Additional block for the summary card
180
183
  .govuk-summary-card {
181
184
  @include govuk-responsive-margin(6, "bottom");
182
- border: 1px solid $govuk-border-colour;
185
+ border: 1px solid;
186
+ border-color: govuk-functional-colour(border);
183
187
  }
184
188
 
185
189
  .govuk-summary-card__title-wrapper {
@@ -188,9 +192,9 @@
188
192
  // Ensures the card header appears separate to the summary list in forced
189
193
  // colours mode
190
194
  border-bottom: 1px solid transparent;
191
- background-color: govuk-colour("light-grey");
195
+ background-color: govuk-colour("black", $variant: "tint-95");
192
196
 
193
- @include govuk-media-query($from: "tablet") {
197
+ @media #{govuk-from-breakpoint(tablet)} {
194
198
  display: flex;
195
199
  justify-content: space-between;
196
200
  flex-wrap: nowrap;
@@ -203,7 +207,7 @@
203
207
  @include govuk-text-colour;
204
208
  margin: govuk-spacing(1) govuk-spacing(4) govuk-spacing(2) 0;
205
209
 
206
- @include govuk-media-query($from: "tablet") {
210
+ @media #{govuk-from-breakpoint(tablet)} {
207
211
  margin-bottom: govuk-spacing(1);
208
212
  }
209
213
  }
@@ -218,7 +222,7 @@
218
222
  padding: 0;
219
223
  list-style: none;
220
224
 
221
- @include govuk-media-query($from: "tablet") {
225
+ @media #{govuk-from-breakpoint(tablet)} {
222
226
  justify-content: right;
223
227
  text-align: right;
224
228
  }
@@ -251,7 +255,7 @@
251
255
  .govuk-summary-card__content {
252
256
  padding: govuk-spacing(3) govuk-spacing(3) 0;
253
257
 
254
- @include govuk-media-query($from: "tablet") {
258
+ @media #{govuk-from-breakpoint(tablet)} {
255
259
  padding: govuk-spacing(3) govuk-spacing(4);
256
260
  }
257
261
 
@@ -9,13 +9,11 @@
9
9
  border-collapse: collapse;
10
10
  }
11
11
 
12
- @if $govuk-new-typography-scale {
13
- // Modifier for tables with a lot of data. Tables with lots of data benefit
14
- // from a smaller font size on small screens.
15
- .govuk-table--small-text-until-tablet {
16
- @include govuk-media-query($until: tablet) {
17
- @include govuk-font-size($size: 16);
18
- }
12
+ // Modifier for tables with a lot of data. Tables with lots of data benefit
13
+ // from a smaller font size on small screens.
14
+ .govuk-table--small-text-until-tablet {
15
+ @media #{govuk-until-breakpoint(tablet)} {
16
+ @include govuk-font-size($size: 16);
19
17
  }
20
18
  }
21
19
 
@@ -26,7 +24,8 @@
26
24
  .govuk-table__header,
27
25
  .govuk-table__cell {
28
26
  padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) 0;
29
- border-bottom: 1px solid $govuk-border-colour;
27
+ border-bottom: 1px solid;
28
+ border-bottom-color: govuk-functional-colour(border);
30
29
  text-align: left;
31
30
  vertical-align: top;
32
31
  }
@@ -46,11 +46,12 @@
46
46
 
47
47
  // GOV.UK Frontend JavaScript enabled
48
48
  .govuk-frontend-supported {
49
- @include govuk-media-query($from: tablet) {
49
+ @media #{govuk-from-breakpoint(tablet)} {
50
50
  .govuk-tabs__list {
51
51
  @include govuk-clearfix;
52
52
  margin-bottom: 0;
53
- border-bottom: 1px solid $govuk-border-colour;
53
+ border-bottom: 1px solid;
54
+ border-bottom-color: govuk-functional-colour(border);
54
55
  }
55
56
 
56
57
  .govuk-tabs__title {
@@ -66,7 +67,7 @@
66
67
  padding: govuk-spacing(2) govuk-spacing(4);
67
68
 
68
69
  float: left;
69
- background-color: govuk-colour("light-grey");
70
+ background-color: govuk-colour("black", $variant: "tint-95");
70
71
  text-align: center;
71
72
 
72
73
  &::before {
@@ -88,10 +89,11 @@
88
89
  padding-bottom: govuk-spacing(3) + $border-width;
89
90
  padding-left: govuk-spacing(4) - $border-width;
90
91
 
91
- border: $border-width solid $govuk-border-colour;
92
+ border: $border-width solid;
92
93
  border-bottom: 0;
94
+ border-color: govuk-functional-colour(border);
93
95
 
94
- background-color: $govuk-body-background-colour;
96
+ background-color: govuk-functional-colour(body-background);
95
97
 
96
98
  .govuk-tabs__tab {
97
99
  text-decoration: none;
@@ -116,8 +118,9 @@
116
118
  .govuk-tabs__panel {
117
119
  @include govuk-responsive-margin(0, "bottom");
118
120
  padding: govuk-spacing(6) govuk-spacing(4);
119
- border: 1px solid $govuk-border-colour;
121
+ border: 1px solid;
120
122
  border-top: 0;
123
+ border-color: govuk-functional-colour(border);
121
124
 
122
125
  & > :last-child {
123
126
  margin-bottom: 0;