govuk_tech_docs 6.1.0 → 6.2.1

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 (139) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug.yaml +69 -0
  3. data/.github/ISSUE_TEMPLATE/config.yaml +6 -0
  4. data/.github/ISSUE_TEMPLATE/enhancement.yaml +25 -0
  5. data/.github/dependabot.yml +0 -5
  6. data/.github/pull_request_template.md +22 -8
  7. data/.github/workflows/dependency-review.yaml +17 -0
  8. data/.github/workflows/test.yaml +1 -1
  9. data/.nvmrc +1 -1
  10. data/.ruby-version +1 -1
  11. data/CHANGELOG.md +13 -2
  12. data/example/.ruby-version +1 -1
  13. data/example/source/code.html.md +1 -0
  14. data/govuk_tech_docs.gemspec +20 -21
  15. data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +1 -3
  16. data/lib/govuk_tech_docs/version.rb +1 -1
  17. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +1 -1
  18. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +1 -1
  19. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  20. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_accordion.scss +4 -1
  21. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +3 -1
  22. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_back-link.scss +4 -1
  23. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +7 -3
  24. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_breadcrumbs.scss +4 -1
  25. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +8 -4
  26. data/node_modules/govuk-frontend/dist/govuk/components/button/_button.scss +4 -1
  27. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +3 -1
  28. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_character-count.scss +4 -1
  29. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -0
  30. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_checkboxes.scss +4 -1
  31. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +10 -6
  32. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_cookie-banner.scss +4 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -0
  34. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_date-input.scss +4 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +2 -0
  36. data/node_modules/govuk-frontend/dist/govuk/components/details/_details.scss +4 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +3 -1
  38. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_error-message.scss +4 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +2 -0
  40. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_error-summary.scss +4 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +3 -1
  42. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_exit-this-page.scss +4 -1
  43. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +3 -1
  44. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_fieldset.scss +4 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -1
  46. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_file-upload.scss +4 -1
  47. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +4 -1
  48. data/node_modules/govuk-frontend/dist/govuk/components/footer/_footer.scss +4 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +2 -0
  50. data/node_modules/govuk-frontend/dist/govuk/components/header/_header.scss +4 -1
  51. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +2 -0
  52. data/node_modules/govuk-frontend/dist/govuk/components/hint/_hint.scss +4 -1
  53. data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +2 -0
  54. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +2 -0
  55. data/node_modules/govuk-frontend/dist/govuk/components/input/_input.scss +4 -1
  56. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +5 -1
  57. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_inset-text.scss +4 -1
  58. data/node_modules/govuk-frontend/dist/govuk/components/label/_index.scss +3 -1
  59. data/node_modules/govuk-frontend/dist/govuk/components/label/_label.scss +4 -1
  60. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +6 -2
  61. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_notification-banner.scss +4 -1
  62. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +2 -0
  63. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_pagination.scss +4 -1
  64. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +3 -1
  65. data/node_modules/govuk-frontend/dist/govuk/components/panel/_panel.scss +4 -1
  66. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -0
  67. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_password-input.scss +4 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +3 -1
  69. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_phase-banner.scss +4 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +14 -10
  71. data/node_modules/govuk-frontend/dist/govuk/components/radios/_radios.scss +4 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +2 -0
  73. data/node_modules/govuk-frontend/dist/govuk/components/select/_select.scss +4 -1
  74. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +5 -1
  75. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -1
  76. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -3
  77. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_skip-link.scss +4 -1
  78. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +15 -2
  79. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_summary-list.scss +4 -1
  80. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +4 -1
  81. data/node_modules/govuk-frontend/dist/govuk/components/table/_table.scss +4 -1
  82. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +5 -2
  83. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_tabs.scss +4 -1
  84. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +4 -1
  85. data/node_modules/govuk-frontend/dist/govuk/components/tag/_tag.scss +4 -1
  86. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +6 -2
  87. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_task-list.scss +4 -1
  88. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +2 -0
  89. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_textarea.scss +4 -1
  90. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +3 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_warning-text.scss +4 -1
  92. data/node_modules/govuk-frontend/dist/govuk/core/_global-styles.scss +4 -0
  93. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +4 -0
  94. data/node_modules/govuk-frontend/dist/govuk/core/_links.scss +8 -0
  95. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +10 -1
  96. data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +5 -0
  97. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +14 -13
  98. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +1 -1
  99. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +5 -0
  100. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  101. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +38 -70
  102. data/node_modules/govuk-frontend/dist/govuk/helpers/_device-pixels.scss +2 -0
  103. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +1 -1
  104. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +3 -2
  105. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +4 -4
  106. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +17 -15
  107. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +2 -2
  108. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +19 -13
  109. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +48 -26
  110. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +13 -11
  111. data/node_modules/govuk-frontend/dist/govuk/objects/_grid.scss +4 -2
  112. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +10 -9
  113. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +2 -0
  114. data/node_modules/govuk-frontend/dist/govuk/overrides/_index.scss +3 -0
  115. data/node_modules/govuk-frontend/dist/govuk/overrides/_spacing.scss +5 -1
  116. data/node_modules/govuk-frontend/dist/govuk/overrides/_text-align.scss +2 -0
  117. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +7 -2
  118. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +3 -0
  119. data/node_modules/govuk-frontend/dist/govuk/settings/_assets.scss +18 -0
  120. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +28 -4
  121. data/node_modules/govuk-frontend/dist/govuk/settings/_links.scss +3 -2
  122. data/node_modules/govuk-frontend/dist/govuk/settings/_measurements.scss +8 -16
  123. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-font.scss +4 -1
  124. data/node_modules/govuk-frontend/dist/govuk/settings/_warnings.scss +15 -2
  125. data/node_modules/govuk-frontend/dist/govuk/tools/_exports.scss +3 -2
  126. data/node_modules/govuk-frontend/dist/govuk/tools/_font-url.scss +13 -5
  127. data/node_modules/govuk-frontend/dist/govuk/tools/_if.scss +24 -0
  128. data/node_modules/govuk-frontend/dist/govuk/tools/_image-url.scss +13 -5
  129. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +1 -0
  130. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +5 -3
  131. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +4 -2
  132. data/node_modules/govuk-frontend/dist/govuk/utilities/_clearfix.scss +3 -0
  133. data/node_modules/govuk-frontend/dist/govuk/utilities/_index.scss +1 -0
  134. data/node_modules/govuk-frontend/dist/govuk/utilities/_visually-hidden.scss +3 -0
  135. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/init.scss +3 -1
  136. data/package-lock.json +1259 -4963
  137. data/package.json +4 -4
  138. metadata +69 -93
  139. data/.github/ISSUE_TEMPLATE.md +0 -13
@@ -2,6 +2,8 @@
2
2
  /// @group helpers/accessibility
3
3
  ////
4
4
 
5
+ @import "../tools/if";
6
+
5
7
  /// Helper function containing the common code for the following two mixins
6
8
  ///
7
9
  /// @link https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
@@ -14,28 +16,28 @@
14
16
  /// @access private
15
17
 
16
18
  @mixin _govuk-visually-hide-content($important: true) {
17
- position: absolute if($important, !important, null);
19
+ position: absolute govuk-if($important, !important);
18
20
 
19
- width: 1px if($important, !important, null);
20
- height: 1px if($important, !important, null);
21
+ width: 1px govuk-if($important, !important);
22
+ height: 1px govuk-if($important, !important);
21
23
  // If margin is set to a negative value it can cause text to be announced in
22
24
  // the wrong order in VoiceOver for OSX
23
- margin: 0 if($important, !important, null);
24
- padding: 0 if($important, !important, null);
25
+ margin: 0 govuk-if($important, !important);
26
+ padding: 0 govuk-if($important, !important);
25
27
 
26
- overflow: hidden if($important, !important, null);
28
+ overflow: hidden govuk-if($important, !important);
27
29
 
28
30
  // `clip` is needed for IE11 support
29
- clip: rect(0 0 0 0) if($important, !important, null);
30
- -webkit-clip-path: inset(50%) if($important, !important, null);
31
- clip-path: inset(50%) if($important, !important, null);
31
+ clip: rect(0 0 0 0) govuk-if($important, !important);
32
+ -webkit-clip-path: inset(50%) govuk-if($important, !important);
33
+ clip-path: inset(50%) govuk-if($important, !important);
32
34
 
33
- border: 0 if($important, !important, null);
35
+ border: 0 govuk-if($important, !important);
34
36
 
35
37
  // For long content, line feeds are not interpreted as spaces and small width
36
38
  // causes content to wrap 1 word per line:
37
39
  // https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
38
- white-space: nowrap if($important, !important, null);
40
+ white-space: nowrap govuk-if($important, !important);
39
41
 
40
42
  // Prevent users from selecting or copying visually-hidden text. This prevents
41
43
  // a user unintentionally copying more text than they intended and needing to
@@ -1,3 +1,5 @@
1
+ @use "sass:map";
2
+
1
3
  @import "../base";
2
4
 
3
5
  @include govuk-exports("govuk/objects/grid") {
@@ -7,7 +9,7 @@
7
9
  margin-left: -($govuk-gutter-half);
8
10
  }
9
11
 
10
- @each $width in map-keys($govuk-grid-widths) {
12
+ @each $width in map.keys($govuk-grid-widths) {
11
13
  .govuk-grid-column-#{$width} {
12
14
  @include govuk-grid-column($width);
13
15
  }
@@ -16,7 +18,7 @@
16
18
  // These *must* be defined in a separate loop as they have the same
17
19
  // specificity as the non-breakpoint specific classes, so need to appear after
18
20
  // them in the outputted CSS
19
- @each $width in map-keys($govuk-grid-widths) {
21
+ @each $width in map.keys($govuk-grid-widths) {
20
22
  .govuk-grid-column-#{$width}-from-desktop {
21
23
  @include govuk-grid-column($width, $at: desktop);
22
24
  }
@@ -1,8 +1,9 @@
1
- @import "../base";
2
-
3
1
  ////
4
2
  /// @group objects/layout
5
3
  ////
4
+ @use "sass:string";
5
+
6
+ @import "../base";
6
7
 
7
8
  /// Width container mixin
8
9
  ///
@@ -26,14 +27,14 @@
26
27
  margin-left: $govuk-gutter-half;
27
28
 
28
29
  // Respect 'display cutout' safe area (avoids notches and rounded corners)
29
- @supports (margin: unquote("max(calc(0px))")) {
30
+ @supports (margin: string.unquote("max(calc(0px))")) {
30
31
  $gutter-safe-area-right: calc(#{$govuk-gutter-half} + env(safe-area-inset-right));
31
32
  $gutter-safe-area-left: calc(#{$govuk-gutter-half} + env(safe-area-inset-left));
32
33
 
33
34
  // Use max() to pick largest margin, default or with safe area
34
35
  // Escaped due to Sass max() vs. CSS native max()
35
- margin-right: unquote("max(#{$govuk-gutter-half}, #{$gutter-safe-area-right})");
36
- margin-left: unquote("max(#{$govuk-gutter-half}, #{$gutter-safe-area-left})");
36
+ margin-right: string.unquote("max(#{$govuk-gutter-half}, #{$gutter-safe-area-right})");
37
+ margin-left: string.unquote("max(#{$govuk-gutter-half}, #{$gutter-safe-area-left})");
37
38
  }
38
39
 
39
40
  // On tablet, add full width gutters
@@ -42,14 +43,14 @@
42
43
  margin-left: $govuk-gutter;
43
44
 
44
45
  // Respect 'display cutout' safe area (avoids notches and rounded corners)
45
- @supports (margin: unquote("max(calc(0px))")) {
46
+ @supports (margin: string.unquote("max(calc(0px))")) {
46
47
  $gutter-safe-area-right: calc(#{$govuk-gutter-half} + env(safe-area-inset-right));
47
48
  $gutter-safe-area-left: calc(#{$govuk-gutter-half} + env(safe-area-inset-left));
48
49
 
49
50
  // Use max() to pick largest margin, default or with safe area
50
51
  // Escaped due to Sass max() vs. CSS native max()
51
- margin-right: unquote("max(#{$govuk-gutter}, #{$gutter-safe-area-right})");
52
- margin-left: unquote("max(#{$govuk-gutter}, #{$gutter-safe-area-left})");
52
+ margin-right: string.unquote("max(#{$govuk-gutter}, #{$gutter-safe-area-right})");
53
+ margin-left: string.unquote("max(#{$govuk-gutter}, #{$gutter-safe-area-left})");
53
54
  }
54
55
  }
55
56
 
@@ -61,7 +62,7 @@
61
62
 
62
63
  // Since a safe area may have previously been set above,
63
64
  // we need to duplicate this margin that centers the page.
64
- @supports (margin: unquote("max(calc(0px))")) {
65
+ @supports (margin: string.unquote("max(calc(0px))")) {
65
66
  margin-right: auto;
66
67
  margin-left: auto;
67
68
  }
@@ -1,3 +1,5 @@
1
+ @import "../tools/exports";
2
+
1
3
  // stylelint-disable declaration-no-important
2
4
  @include govuk-exports("govuk/overrides/display") {
3
5
  .govuk-\!-display-inline {
@@ -1,3 +1,6 @@
1
+ @import "../settings/spacing";
2
+ @import "../tools/exports";
3
+ @import "../helpers/spacing";
1
4
  @import "display";
2
5
  @import "spacing";
3
6
  @import "text-align";
@@ -1,6 +1,10 @@
1
1
  ////
2
2
  /// @group overrides
3
3
  ////
4
+ @use "sass:map";
5
+ @import "../settings/spacing";
6
+ @import "../tools/exports";
7
+ @import "../helpers/spacing";
4
8
 
5
9
  // stylelint-disable declaration-no-important
6
10
 
@@ -62,7 +66,7 @@ $_spacing-directions: ("top", "right", "bottom", "left") !default;
62
66
  ///
63
67
  /// @access private
64
68
  @mixin _govuk-generate-static-spacing-overrides($property) {
65
- @each $spacing-point in map-keys($govuk-spacing-points) {
69
+ @each $spacing-point in map.keys($govuk-spacing-points) {
66
70
  .govuk-\!-static-#{$property}-#{$spacing-point} {
67
71
  #{$property}: govuk-spacing($spacing-point) !important;
68
72
  }
@@ -1,3 +1,5 @@
1
+ @import "../tools/exports";
2
+
1
3
  // stylelint-disable declaration-no-important
2
4
  @include govuk-exports("govuk/overrides/text-align") {
3
5
  .govuk-\!-text-align-left {
@@ -1,3 +1,8 @@
1
+ @use "sass:map";
2
+ @import "../settings/typography-responsive";
3
+ @import "../tools/exports";
4
+ @import "../helpers/typography";
5
+
1
6
  @include govuk-exports("govuk/overrides/typography") {
2
7
  // Font size and line height
3
8
 
@@ -5,10 +10,10 @@
5
10
  // typography scale eg .govuk-\!-font-size-80
6
11
  @each $size, $font-map in $govuk-typography-scale {
7
12
  .govuk-\!-font-size-#{$size} {
8
- $font-map: map-get($govuk-typography-scale, $size);
13
+ $font-map: map.get($govuk-typography-scale, $size);
9
14
 
10
15
  // Add underscore to deprecated typography scale keys
11
- @if map-has-key($font-map, "deprecation") {
16
+ @if map.has-key($font-map, "deprecation") {
12
17
  $size: _#{$size};
13
18
  }
14
19
 
@@ -1,3 +1,6 @@
1
+ @import "../tools/exports";
2
+ @import "../helpers/media-queries";
3
+
1
4
  // stylelint-disable declaration-no-important
2
5
  @include govuk-exports("govuk/overrides/width") {
3
6
  .govuk-\!-width-full {
@@ -50,6 +50,15 @@ $govuk-fonts-path: "#{$govuk-assets-path}fonts/" !default;
50
50
  ///
51
51
  /// $govuk-image-url-function: 'my-url-handler';
52
52
  ///
53
+ /// @example scss - From an external module
54
+ ///
55
+ /// @use "sass:meta";
56
+ /// // Include the module containing the handler function
57
+ /// @use "url-handlers";
58
+ ///
59
+ /// // Then pass the handler function using `meta.get-function`
60
+ /// $govuk-image-url-function: meta.get-function("image-url", $module: "url-handlers");
61
+ ///
53
62
  /// @access public
54
63
 
55
64
  $govuk-image-url-function: false !default;
@@ -77,6 +86,15 @@ $govuk-image-url-function: false !default;
77
86
  ///
78
87
  /// $govuk-font-url-function: 'my-url-handler';
79
88
  ///
89
+ /// @example scss - From an external module
90
+ ///
91
+ /// @use "sass:meta";
92
+ /// // Include the module containing the handler function
93
+ /// @use "url-handlers";
94
+ ///
95
+ /// // Then pass the handler function using `meta.get-function`
96
+ /// $govuk-font-url-function: meta.get-function("font-url", $module: "url-handlers");
97
+ ///
80
98
  /// @access public
81
99
 
82
100
  $govuk-font-url-function: false !default;
@@ -1,8 +1,11 @@
1
1
  ////
2
2
  /// @group settings/colours
3
3
  ////
4
+ @use "sass:list";
5
+ @use "sass:map";
6
+ @use "sass:meta";
4
7
 
5
- @import "../helpers/colour";
8
+ @import "../settings/warnings";
6
9
 
7
10
  /// Default definitions of the functional colours
8
11
  ///
@@ -99,6 +102,27 @@ $govuk-default-functional-colours: (
99
102
  )
100
103
  );
101
104
 
105
+ /// Validates and merges functional colour overrides with defaults.
106
+ ///
107
+ /// Throws an error if any provided colour name does not exist in the default
108
+ /// functional colours map.
109
+ ///
110
+ /// @param {Map} $colours Functional colour overrides.
111
+ /// @param {Map} $defaults Default functional colours.
112
+ /// @return {Map} Merged functional colours.
113
+ /// @access private
114
+ @function _govuk-define-functional-colours($colours, $defaults) {
115
+ $existing-colours: map.keys($defaults);
116
+
117
+ @each $colour-name, $colour in $colours {
118
+ @if not list.index($existing-colours, $colour-name) {
119
+ @error 'Unknown colour `#{$colour-name}` (available colours: #{$existing-colours})';
120
+ }
121
+ }
122
+
123
+ @return map.merge($defaults, $colours);
124
+ }
125
+
102
126
  /// Functional colours for the GOV.UK palette.
103
127
  ///
104
128
  /// Each functional colour is represented by a name (for example `'brand'`) to
@@ -156,14 +180,14 @@ $_govuk-deprecated-applied-colour-variables: () !default;
156
180
  /// @param {String} Name of variable to check
157
181
  /// @access private
158
182
  @mixin _warn-if-applied-colour-variable-set($functional-colour-name) {
159
- @if not index($_govuk-deprecated-applied-colour-variables, $functional-colour-name) {
160
- @if variable-exists("govuk-#{$functional-colour-name}-colour") {
183
+ @if not list.index($_govuk-deprecated-applied-colour-variables, $functional-colour-name) {
184
+ @if meta.variable-exists("govuk-#{$functional-colour-name}-colour") {
161
185
  $deprecation-message: "Setting \`$govuk-#{$functional-colour-name}-colour\` no longer has any effect. Use \`$govuk-functional-colours: (#{$functional-colour-name}: <NEW_COLOUR_VALUE>);\` instead.";
162
186
 
163
187
  @include _warning("applied-colour-variables", $deprecation-message);
164
188
  }
165
189
 
166
- $_govuk-deprecated-applied-colour-variables: append(
190
+ $_govuk-deprecated-applied-colour-variables: list.append(
167
191
  $_govuk-deprecated-applied-colour-variables,
168
192
  $functional-colour-name
169
193
  ) !global;
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group settings/links
3
3
  ////
4
+ @use "sass:string";
4
5
 
5
6
  /// Thickness of link underlines
6
7
  ///
@@ -15,7 +16,7 @@
15
16
  /// @type Number
16
17
  /// @access public
17
18
 
18
- $govuk-link-underline-thickness: unquote("max(1px, .0625rem)") !default;
19
+ $govuk-link-underline-thickness: string.unquote("max(1px, .0625rem)") !default;
19
20
 
20
21
  /// Offset of link underlines from text baseline
21
22
  ///
@@ -44,6 +45,6 @@ $govuk-link-underline-offset: 0.1578em !default;
44
45
  /// @type Number
45
46
  /// @access public
46
47
 
47
- $govuk-link-hover-underline-thickness: unquote("max(3px, .1875rem, .12em)") !default;
48
+ $govuk-link-hover-underline-thickness: string.unquote("max(3px, .1875rem, .12em)") !default;
48
49
 
49
50
  /*# sourceMappingURL=_links.scss.map */
@@ -11,6 +11,8 @@
11
11
  /// @type Number
12
12
  /// @access public
13
13
 
14
+ @use "sass:math";
15
+
14
16
  $govuk-page-width: 960px !default;
15
17
 
16
18
  /// Map of grid column widths
@@ -19,21 +21,11 @@ $govuk-page-width: 960px !default;
19
21
  /// @access public
20
22
 
21
23
  $govuk-grid-widths: (
22
- one-quarter: (
23
- 100% / 4
24
- ),
25
- one-third: (
26
- 100% / 3
27
- ),
28
- one-half: (
29
- 100% / 2
30
- ),
31
- two-thirds: (
32
- 200% / 3
33
- ),
34
- three-quarters: (
35
- 300% / 4
36
- ),
24
+ one-quarter: math.div(100%, 4),
25
+ one-third: math.div(100%, 3),
26
+ one-half: math.div(100%, 2),
27
+ two-thirds: math.div(200%, 3),
28
+ three-quarters: math.div(300%, 4),
37
29
  full: 100%
38
30
  ) !default;
39
31
 
@@ -49,7 +41,7 @@ $govuk-gutter: 30px !default;
49
41
  /// @type Number
50
42
  /// @access public
51
43
 
52
- $govuk-gutter-half: $govuk-gutter / 2;
44
+ $govuk-gutter-half: math.div($govuk-gutter, 2);
53
45
 
54
46
  // =========================================================
55
47
  // Borders
@@ -1,6 +1,9 @@
1
1
  ////
2
2
  /// @group settings/typography
3
3
  ////
4
+ @use "sass:list";
5
+
6
+ @import "../tools/if";
4
7
 
5
8
  // =========================================================
6
9
  // Font families
@@ -31,7 +34,7 @@ $govuk-font-family-print: sans-serif !default;
31
34
  /// @type Boolean
32
35
  /// @access public
33
36
 
34
- $govuk-include-default-font-face: if(index($govuk-font-family, "GDS Transport"), true, false) !default;
37
+ $govuk-include-default-font-face: govuk-if(list.index($govuk-font-family, "GDS Transport"), true, false) !default;
35
38
 
36
39
  // =========================================================
37
40
  // Font weights
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group settings/warnings
3
3
  ////
4
+ @use "sass:list";
4
5
 
5
6
  /// Suppressed warnings map
6
7
  ///
@@ -51,18 +52,30 @@ $govuk-suppressed-warnings: () !default;
51
52
  @warn _warning-text($key, $message);
52
53
 
53
54
  @if $silence-further-warnings {
54
- $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
55
+ $govuk-suppressed-warnings: list.append($govuk-suppressed-warnings, $key) !global;
55
56
  }
56
57
  }
57
58
  }
58
59
 
60
+ /// Logs a deprecation warning that the given component's `<COMPONENT_NAME>.scss` file is deprecated
61
+ ///
62
+ /// @param {string} $component-name - The name of component, as it appears in the folder gathering its files
63
+ /// @access private
64
+ @mixin _component-scss-file-warning($component-name) {
65
+ $component-path: "<PATH_TO_GOVUK_FRONTEND>/components/#{$component-name}";
66
+
67
+ $message: "Importing `#{$component-path}/#{$component-name}` is deprecated." + " Import `#{$component-path}` instead.";
68
+
69
+ @include _warning("component-scss-files", $message, $silence-further-warnings: false);
70
+ }
71
+
59
72
  /// Check whether a key is present in the suppressed warnings list.
60
73
  ///
61
74
  /// @param {String} $key - The key to be checked against `$govuk-suppressed-warnings`.
62
75
  /// @access private
63
76
 
64
77
  @function _should-warn($key) {
65
- @return index($govuk-suppressed-warnings, $key) == null;
78
+ @return list.index($govuk-suppressed-warnings, $key) == null;
66
79
  }
67
80
 
68
81
  /// Format a warning by appending information on how to suppress it.
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group tools
3
3
  ////
4
+ @use "sass:list";
4
5
 
5
6
  /// List of modules which have already been exported
6
7
  ///
@@ -22,9 +23,9 @@ $_govuk-imported-modules: () !default;
22
23
 
23
24
  @mixin govuk-exports($name) {
24
25
  // If the mixin is not in the list of modules already exported...
25
- @if not index($_govuk-imported-modules, $name) {
26
+ @if not list.index($_govuk-imported-modules, $name) {
26
27
  // ... then add it to the list
27
- $_govuk-imported-modules: append($_govuk-imported-modules, $name) !global;
28
+ $_govuk-imported-modules: list.append($_govuk-imported-modules, $name) !global;
28
29
  // ... and output the CSS for that module
29
30
  @content;
30
31
  }
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group tools/assets
3
3
  ////
4
+ @use "sass:meta";
4
5
 
5
6
  /// Font URL
6
7
  ///
@@ -14,12 +15,19 @@
14
15
 
15
16
  @function govuk-font-url($filename) {
16
17
  // prettier-ignore
17
- $use-custom-function: variable-exists("govuk-font-url-function")
18
- and $govuk-font-url-function
19
- and function-exists($govuk-font-url-function);
18
+ $custom-function: meta.variable-exists("govuk-font-url-function")
19
+ and $govuk-font-url-function;
20
20
 
21
- @if $use-custom-function {
22
- @return call(get-function($govuk-font-url-function), $filename);
21
+ @if meta.type-of($custom-function) == "string" {
22
+ @if meta.function-exists($custom-function) {
23
+ $custom-function: meta.get-function($custom-function);
24
+ } @else {
25
+ $custom-function: null;
26
+ }
27
+ }
28
+
29
+ @if $custom-function {
30
+ @return meta.call($custom-function, $filename);
23
31
  } @else {
24
32
  @return url($govuk-fonts-path + $filename);
25
33
  }
@@ -0,0 +1,24 @@
1
+ ////
2
+ /// @group tools/if
3
+ ////
4
+
5
+ /// Inline `if` function
6
+ ///
7
+ /// Replicates the syntax of the original Sass `if` function
8
+ /// to support Sass `>=1.79 <1.95`. Defaults `$if-false` to `null`
9
+ /// when not set.
10
+ ///
11
+ /// @param {Boolean} $condition - The condition
12
+ /// @param {any} $if-true - The value if the condition is met
13
+ /// @param {any} $if-false [null] - The value if the condition is not met, defaults to `null`.
14
+ /// @returns {any} `$if-true` if the condition is met, `$if-false` otherwise.
15
+ /// @access public
16
+ @function govuk-if($condition, $if-true, $if-false: null) {
17
+ @if $condition {
18
+ @return $if-true;
19
+ } @else {
20
+ @return $if-false;
21
+ }
22
+ }
23
+
24
+ /*# sourceMappingURL=_if.scss.map */
@@ -1,6 +1,7 @@
1
1
  ////
2
2
  /// @group tools/assets
3
3
  ////
4
+ @use "sass:meta";
4
5
 
5
6
  /// Image URL
6
7
  ///
@@ -14,12 +15,19 @@
14
15
 
15
16
  @function govuk-image-url($filename) {
16
17
  // prettier-ignore
17
- $use-custom-function: variable-exists("govuk-image-url-function")
18
- and $govuk-image-url-function
19
- and function-exists($govuk-image-url-function);
18
+ $custom-function: meta.variable-exists("govuk-image-url-function")
19
+ and $govuk-image-url-function;
20
20
 
21
- @if $use-custom-function {
22
- @return call(get-function($govuk-image-url-function), $filename);
21
+ @if meta.type-of($custom-function) == "string" {
22
+ @if meta.function-exists($custom-function) {
23
+ $custom-function: meta.get-function($custom-function);
24
+ } @else {
25
+ $custom-function: null;
26
+ }
27
+ }
28
+
29
+ @if $custom-function {
30
+ @return meta.call($custom-function, $filename);
23
31
  } @else {
24
32
  @return url($govuk-images-path + $filename);
25
33
  }
@@ -1,5 +1,6 @@
1
1
  @import "exports";
2
2
  @import "font-url";
3
+ @import "if";
3
4
  @import "image-url";
4
5
  @import "px-to-em";
5
6
  @import "px-to-rem";
@@ -2,6 +2,8 @@
2
2
  /// @group tools/unit-conversion
3
3
  ////
4
4
 
5
+ @use "sass:math";
6
+
5
7
  @import "../settings/typography-responsive";
6
8
 
7
9
  /// Convert pixels to em
@@ -12,13 +14,13 @@
12
14
  /// @access public
13
15
 
14
16
  @function govuk-em($value, $context-font-size: $govuk-root-font-size) {
15
- @if unitless($value) {
17
+ @if math.is-unitless($value) {
16
18
  $value: $value * 1px;
17
19
  }
18
- @if unitless($context-font-size) {
20
+ @if math.is-unitless($context-font-size) {
19
21
  $context-font-size: $context-font-size * 1px;
20
22
  }
21
- @return $value / $context-font-size * 1em;
23
+ @return math.div($value, $context-font-size) * 1em;
22
24
  }
23
25
 
24
26
  /*# sourceMappingURL=_px-to-em.scss.map */
@@ -2,6 +2,8 @@
2
2
  /// @group tools/unit-conversion
3
3
  ////
4
4
 
5
+ @use "sass:math";
6
+
5
7
  @import "../settings/typography-responsive";
6
8
 
7
9
  /// Convert pixels to rem
@@ -14,11 +16,11 @@
14
16
  /// @access public
15
17
 
16
18
  @function govuk-px-to-rem($value) {
17
- @if unitless($value) {
19
+ @if math.is-unitless($value) {
18
20
  $value: $value * 1px;
19
21
  }
20
22
 
21
- @return $value / $govuk-root-font-size * 1rem;
23
+ @return math.div($value, $govuk-root-font-size) * 1rem;
22
24
  }
23
25
 
24
26
  /*# sourceMappingURL=_px-to-rem.scss.map */
@@ -1,3 +1,6 @@
1
+ @import "../tools/exports";
2
+ @import "../helpers/clearfix";
3
+
1
4
  @include govuk-exports("govuk/utilities/clearfix") {
2
5
  .govuk-clearfix {
3
6
  @include govuk-clearfix;
@@ -1,3 +1,4 @@
1
+ @import "../tools/exports";
1
2
  @import "clearfix";
2
3
  @import "visually-hidden";
3
4
 
@@ -1,3 +1,6 @@
1
+ @import "../tools/exports";
2
+ @import "../helpers/visually-hidden";
3
+
1
4
  @include govuk-exports("govuk/utilities/visually-hidden") {
2
5
  .govuk-visually-hidden {
3
6
  @include govuk-visually-hidden;
@@ -1,6 +1,8 @@
1
+ @import "../govuk/tools/if";
2
+
1
3
  $govuk-prototype-kit-major-version: 0 !default;
2
4
 
3
- $govuk-assets-path: if(
5
+ $govuk-assets-path: govuk-if(
4
6
  $govuk-prototype-kit-major-version > 12,
5
7
  $govuk-extensions-url-context + "/govuk-frontend/dist/govuk/assets/",
6
8
  "/govuk/assets/"