govuk_publishing_components 62.0.0 → 62.1.0

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 (190) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/option-select.js +4 -3
  3. data/app/assets/javascripts/govuk_publishing_components/lib/filter-list.js +48 -0
  4. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +373 -245
  5. data/app/assets/stylesheets/component_guide/application.scss +1 -42
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +5 -1
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +6 -11
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +2 -2
  9. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +6 -38
  10. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +2 -3
  11. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +6 -1
  12. data/app/controllers/govuk_publishing_components/applications_page_controller.rb +50 -0
  13. data/app/models/govuk_publishing_components/applications_page.rb +64 -0
  14. data/app/views/govuk_publishing_components/applications_page/_table-content.html.erb +39 -0
  15. data/app/views/govuk_publishing_components/applications_page/show.html.erb +37 -0
  16. data/app/views/govuk_publishing_components/audit/show.html.erb +5 -1
  17. data/app/views/govuk_publishing_components/component_guide/_component_list.html.erb +14 -0
  18. data/app/views/govuk_publishing_components/component_guide/example.html.erb +3 -3
  19. data/app/views/govuk_publishing_components/component_guide/index.html.erb +50 -75
  20. data/app/views/govuk_publishing_components/component_guide/show.html.erb +7 -7
  21. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +27 -25
  22. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +6 -0
  23. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +7 -1
  24. data/config/routes.rb +1 -0
  25. data/lib/govuk_publishing_components/minitest/component_guide_test.rb +1 -1
  26. data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +7 -1
  27. data/lib/govuk_publishing_components/version.rb +1 -1
  28. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +37 -133
  29. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
  30. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +37 -133
  31. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
  32. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  33. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +4 -4
  34. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +1 -126
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +1 -126
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
  39. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +1 -1
  40. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss.map +1 -1
  41. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +2 -2
  42. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss.map +1 -1
  43. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +1 -126
  44. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
  45. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +1 -126
  46. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
  47. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +34 -29
  48. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json +1 -1
  49. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-default.html +23 -23
  50. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-conditional-reveal.html +21 -21
  51. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +30 -30
  52. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-error.html +26 -26
  53. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-hint.html +25 -25
  54. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-long-text.html +23 -23
  55. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small.html +23 -23
  56. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items.html +35 -35
  57. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-and-none.html +30 -30
  58. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-none-and-conditional-items.html +40 -40
  59. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message.html +32 -32
  60. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hint.html +25 -25
  61. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hints-on-items.html +21 -21
  62. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-legend-as-a-page-heading.html +27 -27
  63. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-optional-form-group-classes-showing-group-error.html +36 -36
  64. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-pre-checked-values.html +35 -35
  65. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-very-long-option-text.html +25 -25
  66. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template.njk +1 -1
  67. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
  68. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss.map +1 -1
  69. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +1 -126
  70. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
  71. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +1 -126
  72. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
  73. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +2 -1
  74. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
  75. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +36 -132
  76. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -1
  77. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +36 -132
  78. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -1
  79. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +35 -6
  80. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -1
  81. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +17 -0
  82. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-multiple-files.html +10 -0
  83. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +4 -4
  84. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
  85. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +20 -20
  86. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
  87. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -15
  88. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
  89. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +2 -2
  90. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
  91. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +4 -2
  92. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
  93. data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +1 -1
  94. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-many-pages.html +2 -2
  95. data/node_modules/govuk-frontend/dist/govuk/components/pagination/template.njk +1 -1
  96. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +2 -2
  97. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
  98. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
  99. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
  100. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +1 -126
  101. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
  102. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +1 -126
  103. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
  104. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +1 -1
  105. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
  106. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +1 -1
  107. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
  108. data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +36 -31
  109. data/node_modules/govuk-frontend/dist/govuk/components/radios/macro-options.json +3 -3
  110. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-default.html +17 -17
  111. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-inline.html +19 -19
  112. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline.html +23 -23
  113. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +24 -24
  114. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-conditional-reveal.html +27 -27
  115. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-error.html +26 -26
  116. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-hint.html +25 -25
  117. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-long-text.html +23 -23
  118. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small.html +23 -23
  119. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +24 -24
  120. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-item-checked.html +35 -35
  121. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-and-pre-checked-value.html +35 -35
  122. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items.html +35 -35
  123. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-fieldset-and-error-message.html +20 -20
  124. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hint.html +19 -19
  125. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hints-on-items.html +23 -23
  126. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-legend-as-page-heading.html +21 -21
  127. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-optional-form-group-classes-showing-group-error.html +36 -36
  128. data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-very-long-option-text.html +28 -28
  129. data/node_modules/govuk-frontend/dist/govuk/components/radios/template.njk +1 -1
  130. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +1 -7
  131. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
  132. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +5 -5
  133. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -1
  134. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +16 -16
  135. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
  136. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +1 -1
  137. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss.map +1 -1
  138. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +1 -1
  139. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss.map +1 -1
  140. data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +46 -0
  141. data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-forced-hover-state.html +37 -0
  142. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +1 -7
  143. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
  144. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +1 -1
  145. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
  146. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  147. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
  148. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss.map +1 -1
  149. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +3 -3
  150. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss.map +1 -1
  151. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
  152. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
  153. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  154. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
  155. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +34 -0
  156. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
  157. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  158. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
  159. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +1 -1
  160. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
  161. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
  162. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss.map +1 -1
  163. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
  164. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss.map +1 -1
  165. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +4 -4
  166. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
  167. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +1 -126
  168. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
  169. data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
  170. data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss.map +1 -1
  171. data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
  172. data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss.map +1 -1
  173. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +1 -1
  174. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
  175. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
  176. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss.map +1 -1
  177. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
  178. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss.map +1 -1
  179. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
  180. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss.map +1 -1
  181. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +7 -0
  182. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss.map +1 -1
  183. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
  184. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss.map +1 -1
  185. data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
  186. data/node_modules/govuk-frontend/package.json +9 -8
  187. metadata +9 -4
  188. data/app/assets/javascripts/component_guide/filter-components.js +0 -35
  189. data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
  190. data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss.map +0 -1
@@ -7,6 +7,11 @@
7
7
  /// Provides an outline to clearly indicate when the target element is focused.
8
8
  /// Used for interactive text-based elements.
9
9
  ///
10
+ /// @example scss - Styling the focus state for a link
11
+ /// .govuk-link:focus {
12
+ /// @include govuk-focused-text;
13
+ /// }
14
+ ///
10
15
  /// @access public
11
16
 
12
17
  @mixin govuk-focused-text {
@@ -47,6 +52,11 @@
47
52
  /// govuk-focused-box draws an outline around all sides of the element.
48
53
  /// Best used for non-text content contained within links.
49
54
  ///
55
+ /// @example scss - Styling the focus state for a linked image
56
+ /// .govuk-link-image:focus {
57
+ /// @include govuk-focused-box;
58
+ /// }
59
+ ///
50
60
  /// @access public
51
61
 
52
62
  @mixin govuk-focused-box {
@@ -56,4 +66,28 @@
56
66
  0 0 0 8px $govuk-focus-text-colour;
57
67
  }
58
68
 
69
+ /// Focused form input
70
+ ///
71
+ /// Provides an outline to clearly indicate when the target element is focused.
72
+ /// Used for form inputs.
73
+ ///
74
+ /// @example scss - Styling the focus state for a form input
75
+ /// .govuk-input:focus {
76
+ /// @include govuk-focused-form-input;
77
+ /// }
78
+ ///
79
+ /// @access public
80
+
81
+ @mixin govuk-focused-form-input {
82
+ outline: $govuk-focus-width solid $govuk-focus-colour;
83
+ // Ensure outline appears outside of the element
84
+ outline-offset: 0;
85
+ // Double the border by adding its width again. Use `box-shadow` for this
86
+ // instead of changing `border-width` - this is for consistency with
87
+ // components such as textarea where we avoid changing `border-width` as
88
+ // it will change the element size. Also, `outline` cannot be utilised
89
+ // here as it is already used for the yellow focus state.
90
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element;
91
+ }
92
+
59
93
  /*# sourceMappingURL=_focused.scss.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_focused.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,+BAA+B;AAC/B,GAAG;;AAEH,eAAe;AACf,EAAE;AACF,8EAA8E;AAC9E,4CAA4C;AAC5C,EAAE;AACF,iBAAiB;;AAEjB;EACE,uEAAuE;EACvE,uEAAuE;EACvE,4DAA4D;;EAE5D,6CAA6C;EAC7C,+BAA+B;EAC/B,qCAAqC;EACrC;;kCAEgC;EAChC,6DAA6D;EAC7D,iCAAiC;EACjC,qBAAqB;;EAErB,4EAA4E;EAC5E,0DAA0D;EAC1D,CAAC;EACD,4EAA4E;EAC5E,yEAAyE;EACzE,uEAAuE;EACvE,2BAA2B;EAC3B,CAAC;EACD,gCAAgC;EAChC,6DAA6D;EAC7D;IACE,mCAA2B;YAA3B,2BAA2B;EAC7B;AACF;;AAEA,cAAc;AACd,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,sEAAsE;AACtE,yDAAyD;AACzD,EAAE;AACF,iBAAiB;;AAEjB;EACE,6CAA6C;EAC7C;;sCAEoC;AACtC","file":"_focused.scss","sourcesContent":["////\n/// @group helpers/accessibility\n////\n\n/// Focused text\n///\n/// Provides an outline to clearly indicate when the target element is focused.\n/// Used for interactive text-based elements.\n///\n/// @access public\n\n@mixin govuk-focused-text {\n // When colours are overridden, for example when users have a dark mode,\n // backgrounds and box-shadows disappear, so we need to ensure there's a\n // transparent outline which will be set to a visible colour.\n\n outline: $govuk-focus-width solid transparent;\n color: $govuk-focus-text-colour;\n background-color: $govuk-focus-colour;\n box-shadow:\n 0 -2px $govuk-focus-colour,\n 0 4px $govuk-focus-text-colour;\n // When link is focussed, hide the default underline since the\n // box shadow adds the \"underline\"\n text-decoration: none;\n\n // Fixes an issue in Chromium 108–111 where the box-shadow on the focus state\n // is missing on links that wrap across multiple lines [1].\n //\n // However, text-wrap: balance doesn't play nicely with box-decoration-break:\n // clone, causing links to re-flow when focused [2]. As text-wrap: balance\n // wasn't introduced until Chromium 114 we can use it as a way to target\n // this fix to just 108–111.\n //\n // [1]: http://crbug.com/40884971\n // [2]: https://github.com/alphagov/govuk-frontend/issues/5878\n @supports not (text-wrap: balance) {\n box-decoration-break: clone;\n }\n}\n\n/// Focused box\n///\n/// Provides an outline to clearly indicate when the target element is focused.\n/// Unlike govuk-focused-text, which only draws an underline below the element,\n/// govuk-focused-box draws an outline around all sides of the element.\n/// Best used for non-text content contained within links.\n///\n/// @access public\n\n@mixin govuk-focused-box {\n outline: $govuk-focus-width solid transparent;\n box-shadow:\n 0 0 0 4px $govuk-focus-colour,\n 0 0 0 8px $govuk-focus-text-colour;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/helpers/_focused.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,+BAA+B;AAC/B,GAAG;;AAEH,eAAe;AACf,EAAE;AACF,8EAA8E;AAC9E,4CAA4C;AAC5C,EAAE;AACF,qDAAqD;AACrD,wBAAwB;AACxB,mCAAmC;AACnC,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,uEAAuE;EACvE,uEAAuE;EACvE,4DAA4D;;EAE5D,6CAA6C;EAC7C,+BAA+B;EAC/B,qCAAqC;EACrC;;kCAEgC;EAChC,6DAA6D;EAC7D,iCAAiC;EACjC,qBAAqB;;EAErB,4EAA4E;EAC5E,0DAA0D;EAC1D,CAAC;EACD,4EAA4E;EAC5E,yEAAyE;EACzE,uEAAuE;EACvE,2BAA2B;EAC3B,CAAC;EACD,gCAAgC;EAChC,6DAA6D;EAC7D;IACE,mCAA2B;YAA3B,2BAA2B;EAC7B;AACF;;AAEA,cAAc;AACd,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,sEAAsE;AACtE,yDAAyD;AACzD,EAAE;AACF,6DAA6D;AAC7D,8BAA8B;AAC9B,kCAAkC;AAClC,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,6CAA6C;EAC7C;;sCAEoC;AACtC;;AAEA,qBAAqB;AACrB,EAAE;AACF,8EAA8E;AAC9E,wBAAwB;AACxB,EAAE;AACF,2DAA2D;AAC3D,yBAAyB;AACzB,yCAAyC;AACzC,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,qDAAqD;EACrD,+CAA+C;EAC/C,iBAAiB;EACjB,wEAAwE;EACxE,mEAAmE;EACnE,uEAAuE;EACvE,qEAAqE;EACrE,wDAAwD;EACxD,wDAAwD;AAC1D","file":"_focused.scss","sourcesContent":["////\n/// @group helpers/accessibility\n////\n\n/// Focused text\n///\n/// Provides an outline to clearly indicate when the target element is focused.\n/// Used for interactive text-based elements.\n///\n/// @example scss - Styling the focus state for a link\n/// .govuk-link:focus {\n/// @include govuk-focused-text;\n/// }\n///\n/// @access public\n\n@mixin govuk-focused-text {\n // When colours are overridden, for example when users have a dark mode,\n // backgrounds and box-shadows disappear, so we need to ensure there's a\n // transparent outline which will be set to a visible colour.\n\n outline: $govuk-focus-width solid transparent;\n color: $govuk-focus-text-colour;\n background-color: $govuk-focus-colour;\n box-shadow:\n 0 -2px $govuk-focus-colour,\n 0 4px $govuk-focus-text-colour;\n // When link is focussed, hide the default underline since the\n // box shadow adds the \"underline\"\n text-decoration: none;\n\n // Fixes an issue in Chromium 108–111 where the box-shadow on the focus state\n // is missing on links that wrap across multiple lines [1].\n //\n // However, text-wrap: balance doesn't play nicely with box-decoration-break:\n // clone, causing links to re-flow when focused [2]. As text-wrap: balance\n // wasn't introduced until Chromium 114 we can use it as a way to target\n // this fix to just 108–111.\n //\n // [1]: http://crbug.com/40884971\n // [2]: https://github.com/alphagov/govuk-frontend/issues/5878\n @supports not (text-wrap: balance) {\n box-decoration-break: clone;\n }\n}\n\n/// Focused box\n///\n/// Provides an outline to clearly indicate when the target element is focused.\n/// Unlike govuk-focused-text, which only draws an underline below the element,\n/// govuk-focused-box draws an outline around all sides of the element.\n/// Best used for non-text content contained within links.\n///\n/// @example scss - Styling the focus state for a linked image\n/// .govuk-link-image:focus {\n/// @include govuk-focused-box;\n/// }\n///\n/// @access public\n\n@mixin govuk-focused-box {\n outline: $govuk-focus-width solid transparent;\n box-shadow:\n 0 0 0 4px $govuk-focus-colour,\n 0 0 0 8px $govuk-focus-text-colour;\n}\n\n/// Focused form input\n///\n/// Provides an outline to clearly indicate when the target element is focused.\n/// Used for form inputs.\n///\n/// @example scss - Styling the focus state for a form input\n/// .govuk-input:focus {\n/// @include govuk-focused-form-input;\n/// }\n///\n/// @access public\n\n@mixin govuk-focused-form-input {\n outline: $govuk-focus-width solid $govuk-focus-colour;\n // Ensure outline appears outside of the element\n outline-offset: 0;\n // Double the border by adding its width again. Use `box-shadow` for this\n // instead of changing `border-width` - this is for consistency with\n // components such as textarea where we avoid changing `border-width` as\n // it will change the element size. Also, `outline` cannot be utilised\n // here as it is already used for the yellow focus state.\n box-shadow: inset 0 0 0 $govuk-border-width-form-element;\n}\n"]}
@@ -54,7 +54,7 @@
54
54
  width: 100%;
55
55
  }
56
56
  padding: 0 $govuk-gutter-half;
57
- @include govuk-media-query($from: $at) {
57
+ @media #{govuk-from-breakpoint($at)} {
58
58
  width: govuk-grid-width($width);
59
59
  float: $float;
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_grid.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,wBAAwB;AACxB,GAAG;;AAEH,wBAAwB;AACxB,EAAE;AACF,8DAA8D;AAC9D,oCAAoC;AACpC,6CAA6C;AAC7C,iBAAiB;;AAEjB;EACE;IACE,yCAAyC;EAC3C;;EAEA,qCAAqC;AACvC;;AAEA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,aAAa;AACb,EAAE;AACF,6EAA6E;AAC7E,6CAA6C;AAC7C,mFAAmF;AACnF,EAAE;AACF,0BAA0B;AAC1B,oCAAoC;AACpC,6CAA6C;AAC7C,MAAM;AACN,EAAE;AACF,+EAA+E;AAC/E,+CAA+C;AAC/C,0DAA0D;AAC1D,MAAM;AACN,EAAE;AACF,kDAAkD;AAClD,wCAAwC;AACxC,6DAA6D;AAC7D,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,sBAAsB;EACtB;IACE,WAAW;EACb;EACA,6BAA6B;EAC7B;IACE,+BAA+B;IAC/B,aAAa;EACf;AACF","file":"_grid.scss","sourcesContent":["////\n/// @group helpers/layout\n////\n\n/// Grid width percentage\n///\n/// @param {String} $key - Name of grid width (e.g. two-thirds)\n/// @return {Number} Percentage width\n/// @throw if `$key` is not a valid grid width\n/// @access public\n\n@function govuk-grid-width($key) {\n @if map-has-key($govuk-grid-widths, $key) {\n @return map-get($govuk-grid-widths, $key);\n }\n\n @error \"Unknown grid width `#{$key}`\";\n}\n\n/// Generate grid column styles\n///\n/// Creates a grid column with standard gutter between the columns.\n///\n/// Grid widths are defined in the `$govuk-grid-widths` map.\n///\n/// By default the column width changes from 100% to specified width at the\n/// 'tablet' breakpoint, but other breakpoints can be specified using the `$at`\n/// parameter.\n///\n/// @param {String} $width [full] name of a grid width from $govuk-grid-widths\n/// @param {String} $float [left] left | right\n/// @param {String} $at [tablet] - mobile | tablet | desktop | any custom breakpoint\n///\n/// @example scss - Default\n/// .govuk-grid-column-two-thirds {\n/// @include govuk-grid-column(two-thirds)\n/// }\n///\n/// @example scss - Customising the breakpoint where width percentage is applied\n/// .govuk-grid-column-one-half-from-desktop {\n/// @include govuk-grid-column(one-half, $at: desktop);\n/// }\n///\n/// @example scss - Customising the float direction\n/// .govuk-grid-column-one-half-right {\n/// @include govuk-grid-column(two-thirds, $float: right);\n/// }\n///\n/// @access public\n\n@mixin govuk-grid-column($width: full, $float: left, $at: tablet) {\n box-sizing: border-box;\n @if $at != desktop {\n width: 100%;\n }\n padding: 0 $govuk-gutter-half;\n @include govuk-media-query($from: $at) {\n width: govuk-grid-width($width);\n float: $float;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/helpers/_grid.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,wBAAwB;AACxB,GAAG;;AAEH,wBAAwB;AACxB,EAAE;AACF,8DAA8D;AAC9D,oCAAoC;AACpC,6CAA6C;AAC7C,iBAAiB;;AAEjB;EACE;IACE,yCAAyC;EAC3C;;EAEA,qCAAqC;AACvC;;AAEA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,aAAa;AACb,EAAE;AACF,6EAA6E;AAC7E,6CAA6C;AAC7C,mFAAmF;AACnF,EAAE;AACF,0BAA0B;AAC1B,oCAAoC;AACpC,6CAA6C;AAC7C,MAAM;AACN,EAAE;AACF,+EAA+E;AAC/E,+CAA+C;AAC/C,0DAA0D;AAC1D,MAAM;AACN,EAAE;AACF,kDAAkD;AAClD,wCAAwC;AACxC,6DAA6D;AAC7D,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,sBAAsB;EACtB;IACE,WAAW;EACb;EACA,6BAA6B;EAC7B;IACE,+BAA+B;IAC/B,aAAa;EACf;AACF","file":"_grid.scss","sourcesContent":["////\n/// @group helpers/layout\n////\n\n/// Grid width percentage\n///\n/// @param {String} $key - Name of grid width (e.g. two-thirds)\n/// @return {Number} Percentage width\n/// @throw if `$key` is not a valid grid width\n/// @access public\n\n@function govuk-grid-width($key) {\n @if map-has-key($govuk-grid-widths, $key) {\n @return map-get($govuk-grid-widths, $key);\n }\n\n @error \"Unknown grid width `#{$key}`\";\n}\n\n/// Generate grid column styles\n///\n/// Creates a grid column with standard gutter between the columns.\n///\n/// Grid widths are defined in the `$govuk-grid-widths` map.\n///\n/// By default the column width changes from 100% to specified width at the\n/// 'tablet' breakpoint, but other breakpoints can be specified using the `$at`\n/// parameter.\n///\n/// @param {String} $width [full] name of a grid width from $govuk-grid-widths\n/// @param {String} $float [left] left | right\n/// @param {String} $at [tablet] - mobile | tablet | desktop | any custom breakpoint\n///\n/// @example scss - Default\n/// .govuk-grid-column-two-thirds {\n/// @include govuk-grid-column(two-thirds)\n/// }\n///\n/// @example scss - Customising the breakpoint where width percentage is applied\n/// .govuk-grid-column-one-half-from-desktop {\n/// @include govuk-grid-column(one-half, $at: desktop);\n/// }\n///\n/// @example scss - Customising the float direction\n/// .govuk-grid-column-one-half-right {\n/// @include govuk-grid-column(two-thirds, $float: right);\n/// }\n///\n/// @access public\n\n@mixin govuk-grid-column($width: full, $float: left, $at: tablet) {\n box-sizing: border-box;\n @if $at != desktop {\n width: 100%;\n }\n padding: 0 $govuk-gutter-half;\n @media #{govuk-from-breakpoint($at)} {\n width: govuk-grid-width($width);\n float: $float;\n }\n}\n"]}
@@ -348,7 +348,7 @@
348
348
  /// @access public
349
349
 
350
350
  @mixin govuk-link-print-friendly {
351
- @include govuk-media-query($media-type: print) {
351
+ @media print {
352
352
  &[href^="/"],
353
353
  &[href^="http://"],
354
354
  &[href^="https://"]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_links.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,uBAAuB;AACvB,GAAG;;AAEH,qBAAqB;AACrB,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,iBAAiB;;AAEjB;EACE,gCAAgC;EAChC,8BAA8B;;EAE9B;IACE,oCAAoC;EACtC;;EAEA;IACE,2BAA2B;EAC7B;AACF;;AAEA,kBAAkB;AAClB,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,EAAE;AACF,iBAAiB;AACjB;EACE,0BAA0B;;EAE1B;IACE,0DAA0D;EAC5D;;EAEA;IACE,mDAAmD;EACrD;AACF;;AAEA,wBAAwB;AACxB,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,6BAA6B;AAC7B,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE,gEAAgE;IACh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AEjB;EACE;IACE,yBAAyB;EAC3B;;EAEA;IACE,yBAAyB;EAC3B;;EAEA;IACE,+BAA+B;EACjC;;EAEA;IACE,gCAAgC;EAClC;;EAEA,yEAAyE;EACzE,8BAA8B;EAC9B;IACE,+BAA+B;EACjC;AACF;;AAEA,8BAA8B;AAC9B,EAAE;AACF,0EAA0E;AAC1E,wBAAwB;AACxB,EAAE;AACF,gBAAgB;AAChB,6BAA6B;AAC7B,kCAAkC;AAClC,yCAAyC;AACzC,8CAA8C;AAC9C,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE,qBAAqB;EACvB;AACF;;AAEA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,oDAAoD;AACpD,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE;;;;MAIE;QACE,4BAA4B;QAC5B,cAAc;;QAEd,mEAAmE;QACnE,gEAAgE;QAChE,oBAAoB;QACpB,qBAAqB;MACvB;IACF;EACF;AACF;;AAEA,oBAAoB;AACpB,EAAE;AACF,2EAA2E;AAC3E,6BAA6B;AAC7B,EAAE;AACF,iBAAiB;;AAEjB;EACE,kDAAkD;EAClD,qBAAqB;;EAErB,2EAA2E;EAC3E,cAAc;;EAEd,2BAA2B;EAC3B,qBAAqB;;EAErB;IACE,0BAA0B;EAC5B;AACF","file":"_links.scss","sourcesContent":["////\n/// @group helpers/links\n////\n\n/// Common link styles\n///\n/// Provides the typography and focus state, regardless of link style.\n///\n/// @access public\n\n@mixin govuk-link-common {\n @include govuk-typography-common;\n @include govuk-link-decoration;\n\n &:hover {\n @include govuk-link-hover-decoration;\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n}\n\n/// Link decoration\n///\n/// Provides the text decoration for links, including thickness and underline\n/// offset. Use this mixin only if you cannot use the `govuk-link-common` mixin.\n///\n/// @access public\n@mixin govuk-link-decoration {\n text-decoration: underline;\n\n @if $govuk-link-underline-thickness {\n text-decoration-thickness: $govuk-link-underline-thickness;\n }\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n}\n\n/// Link hover decoration\n///\n/// Provides the text decoration for links in their hover state, for you to use\n/// within a `:hover` pseudo-selector. Use this mixin only if you cannot use the\n/// `govuk-link-common` mixin.\n///\n/// @access public\n\n@mixin govuk-link-hover-decoration {\n @if $govuk-link-hover-underline-thickness {\n text-decoration-thickness: $govuk-link-hover-underline-thickness;\n // Disable ink skipping on underlines on hover. Browsers haven't\n // standardised on this part of the spec yet, so set both properties\n text-decoration-skip-ink: none; // Chromium, Firefox\n text-decoration-skip: none; // Safari\n }\n}\n\n/// Default link styles\n///\n/// Makes links use the default unvisited, visited, hover and active colours.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-default;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-default {\n &:link {\n color: $govuk-link-colour;\n }\n\n &:visited {\n color: $govuk-link-visited-colour;\n }\n\n &:hover {\n color: $govuk-link-hover-colour;\n }\n\n &:active {\n color: $govuk-link-active-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Error link styles\n///\n/// Makes links use the error colour. The link will darken if it's active or a\n/// user hovers their cursor over it.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-error;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-error {\n &:link,\n &:visited {\n color: $govuk-error-colour;\n }\n\n &:hover {\n color: scale-color($govuk-error-colour, $lightness: -30%);\n }\n\n &:active {\n color: $govuk-error-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Success link styles\n///\n/// Makes links use the success colour. The link will darken if it's active or a\n/// user hovers their cursor over it.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-success;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-success {\n &:link,\n &:visited {\n color: $govuk-success-colour;\n }\n\n &:hover {\n color: scale-color($govuk-success-colour, $lightness: -30%);\n }\n\n &:active {\n color: $govuk-success-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Muted link styles\n///\n/// Makes links use the secondary text colour. The link will darken if it's\n/// active or a user hovers their cursor over it.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-muted;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-muted {\n &:link,\n &:visited {\n color: $govuk-secondary-text-colour;\n }\n\n &:hover,\n &:active {\n color: $govuk-text-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Text link styles\n///\n/// Makes links use the primary text colour, in all states. Use this mixin for\n/// navigation components, such as breadcrumbs or the back link.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-text;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-text {\n &:link,\n &:visited {\n @include govuk-text-colour;\n }\n\n // Force a colour change on hover to work around a bug in Safari\n // https://webkit.org/b/224483\n &:hover {\n @if type-of($govuk-text-colour) == color {\n color: rgba($govuk-text-colour, 0.99);\n }\n }\n\n &:active,\n &:focus {\n @include govuk-text-colour;\n }\n}\n\n/// Inverse link styles\n///\n/// Makes links white, in all states. Use this mixin if you're displaying links\n/// against a dark background.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-inverse;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-inverse {\n &:link,\n &:visited {\n color: govuk-colour(\"white\");\n }\n\n // Force a colour change on hover to work around a bug in Safari\n // https://webkit.org/b/224483\n &:hover,\n &:active {\n color: rgba(govuk-colour(\"white\"), 0.99);\n }\n\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Default link styles, without a visited state\n///\n/// Makes links use the default unvisited, hover and active colours, with no\n/// distinct visited state.\n///\n/// Use this mixin when it's not helpful to distinguish between visited and\n/// non-visited links. For example, when you link to pages with\n/// frequently-changing content, such as the dashboard for an admin interface.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-no-visited-state;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-no-visited-state {\n &:link {\n color: $govuk-link-colour;\n }\n\n &:visited {\n color: $govuk-link-colour;\n }\n\n &:hover {\n color: $govuk-link-hover-colour;\n }\n\n &:active {\n color: $govuk-link-active-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Remove underline from links\n///\n/// Remove underlines from links unless the link is active or a user hovers\n/// their cursor over it.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-default;\n/// @include govuk-link-style-no-underline;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-no-underline {\n &:not(:hover):not(:active) {\n text-decoration: none;\n }\n}\n\n/// Include link destination when printing the page\n///\n/// If the user prints the page, add the destination URL after the link text, if\n/// the URL starts with `/`, `http://` or `https://`.\n///\n/// @access public\n\n@mixin govuk-link-print-friendly {\n @include govuk-media-query($media-type: print) {\n &[href^=\"/\"],\n &[href^=\"http://\"],\n &[href^=\"https://\"]\n {\n &::after {\n content: \" (\" attr(href) \")\";\n font-size: 90%;\n\n // Because the URLs may be very long, ensure that they may be broken\n // at arbitrary points if there are no otherwise acceptable break\n // points in the line\n word-wrap: break-word;\n }\n }\n }\n}\n\n/// Image link styles\n///\n/// Prepares and provides the focus state for links that only contain images\n/// with no accompanying text.\n///\n/// @access public\n\n@mixin govuk-link-image {\n // Needed to draw the focus around the entire image\n display: inline-block;\n\n // Remove extra space at the bottom of the image that's added by line-height\n line-height: 0;\n\n // Don't render an underline\n text-decoration: none;\n\n &:focus {\n @include govuk-focused-box;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/helpers/_links.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,uBAAuB;AACvB,GAAG;;AAEH,qBAAqB;AACrB,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,iBAAiB;;AAEjB;EACE,gCAAgC;EAChC,8BAA8B;;EAE9B;IACE,oCAAoC;EACtC;;EAEA;IACE,2BAA2B;EAC7B;AACF;;AAEA,kBAAkB;AAClB,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,EAAE;AACF,iBAAiB;AACjB;EACE,0BAA0B;;EAE1B;IACE,0DAA0D;EAC5D;;EAEA;IACE,mDAAmD;EACrD;AACF;;AAEA,wBAAwB;AACxB,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,6BAA6B;AAC7B,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE,gEAAgE;IAChE,+DAA+D;IAC/D,mEAAmE;IACnE,sCAA8B;YAA9B,8BAA8B,EAAE,mBAAmB;IACnD,kCAA0B;YAA1B,0BAA0B,EAAE,QAAQ;EACtC;AACF;;AAEA,sBAAsB;AACtB,EAAE;AACF,4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+B;EACjC;AACF;;AAEA,8BAA8B;AAC9B,EAAE;AACF,0EAA0E;AAC1E,wBAAwB;AACxB,EAAE;AACF,gBAAgB;AAChB,6BAA6B;AAC7B,kCAAkC;AAClC,yCAAyC;AACzC,8CAA8C;AAC9C,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE,qBAAqB;EACvB;AACF;;AAEA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,oDAAoD;AACpD,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE;;;;MAIE;QACE,4BAA4B;QAC5B,cAAc;;QAEd,mEAAmE;QACnE,gEAAgE;QAChE,oBAAoB;QACpB,qBAAqB;MACvB;IACF;EACF;AACF;;AAEA,oBAAoB;AACpB,EAAE;AACF,2EAA2E;AAC3E,6BAA6B;AAC7B,EAAE;AACF,iBAAiB;;AAEjB;EACE,kDAAkD;EAClD,qBAAqB;;EAErB,2EAA2E;EAC3E,cAAc;;EAEd,2BAA2B;EAC3B,qBAAqB;;EAErB;IACE,0BAA0B;EAC5B;AACF","file":"_links.scss","sourcesContent":["////\n/// @group helpers/links\n////\n\n/// Common link styles\n///\n/// Provides the typography and focus state, regardless of link style.\n///\n/// @access public\n\n@mixin govuk-link-common {\n @include govuk-typography-common;\n @include govuk-link-decoration;\n\n &:hover {\n @include govuk-link-hover-decoration;\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n}\n\n/// Link decoration\n///\n/// Provides the text decoration for links, including thickness and underline\n/// offset. Use this mixin only if you cannot use the `govuk-link-common` mixin.\n///\n/// @access public\n@mixin govuk-link-decoration {\n text-decoration: underline;\n\n @if $govuk-link-underline-thickness {\n text-decoration-thickness: $govuk-link-underline-thickness;\n }\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n}\n\n/// Link hover decoration\n///\n/// Provides the text decoration for links in their hover state, for you to use\n/// within a `:hover` pseudo-selector. Use this mixin only if you cannot use the\n/// `govuk-link-common` mixin.\n///\n/// @access public\n\n@mixin govuk-link-hover-decoration {\n @if $govuk-link-hover-underline-thickness {\n text-decoration-thickness: $govuk-link-hover-underline-thickness;\n // Disable ink skipping on underlines on hover. Browsers haven't\n // standardised on this part of the spec yet, so set both properties\n text-decoration-skip-ink: none; // Chromium, Firefox\n text-decoration-skip: none; // Safari\n }\n}\n\n/// Default link styles\n///\n/// Makes links use the default unvisited, visited, hover and active colours.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-default;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-default {\n &:link {\n color: $govuk-link-colour;\n }\n\n &:visited {\n color: $govuk-link-visited-colour;\n }\n\n &:hover {\n color: $govuk-link-hover-colour;\n }\n\n &:active {\n color: $govuk-link-active-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Error link styles\n///\n/// Makes links use the error colour. The link will darken if it's active or a\n/// user hovers their cursor over it.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-error;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-error {\n &:link,\n &:visited {\n color: $govuk-error-colour;\n }\n\n &:hover {\n color: scale-color($govuk-error-colour, $lightness: -30%);\n }\n\n &:active {\n color: $govuk-error-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Success link styles\n///\n/// Makes links use the success colour. The link will darken if it's active or a\n/// user hovers their cursor over it.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-success;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-success {\n &:link,\n &:visited {\n color: $govuk-success-colour;\n }\n\n &:hover {\n color: scale-color($govuk-success-colour, $lightness: -30%);\n }\n\n &:active {\n color: $govuk-success-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Muted link styles\n///\n/// Makes links use the secondary text colour. The link will darken if it's\n/// active or a user hovers their cursor over it.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-muted;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-muted {\n &:link,\n &:visited {\n color: $govuk-secondary-text-colour;\n }\n\n &:hover,\n &:active {\n color: $govuk-text-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Text link styles\n///\n/// Makes links use the primary text colour, in all states. Use this mixin for\n/// navigation components, such as breadcrumbs or the back link.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-text;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-text {\n &:link,\n &:visited {\n @include govuk-text-colour;\n }\n\n // Force a colour change on hover to work around a bug in Safari\n // https://webkit.org/b/224483\n &:hover {\n @if type-of($govuk-text-colour) == color {\n color: rgba($govuk-text-colour, 0.99);\n }\n }\n\n &:active,\n &:focus {\n @include govuk-text-colour;\n }\n}\n\n/// Inverse link styles\n///\n/// Makes links white, in all states. Use this mixin if you're displaying links\n/// against a dark background.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-inverse;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-inverse {\n &:link,\n &:visited {\n color: govuk-colour(\"white\");\n }\n\n // Force a colour change on hover to work around a bug in Safari\n // https://webkit.org/b/224483\n &:hover,\n &:active {\n color: rgba(govuk-colour(\"white\"), 0.99);\n }\n\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Default link styles, without a visited state\n///\n/// Makes links use the default unvisited, hover and active colours, with no\n/// distinct visited state.\n///\n/// Use this mixin when it's not helpful to distinguish between visited and\n/// non-visited links. For example, when you link to pages with\n/// frequently-changing content, such as the dashboard for an admin interface.\n///\n/// If you use this mixin in a component, you must also include the\n/// `govuk-link-common` mixin to get the correct focus and hover states.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-no-visited-state;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-no-visited-state {\n &:link {\n color: $govuk-link-colour;\n }\n\n &:visited {\n color: $govuk-link-colour;\n }\n\n &:hover {\n color: $govuk-link-hover-colour;\n }\n\n &:active {\n color: $govuk-link-active-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n }\n}\n\n/// Remove underline from links\n///\n/// Remove underlines from links unless the link is active or a user hovers\n/// their cursor over it.\n///\n/// @example scss\n/// .govuk-component__link {\n/// @include govuk-link-common;\n/// @include govuk-link-style-default;\n/// @include govuk-link-style-no-underline;\n/// }\n///\n/// @access public\n\n@mixin govuk-link-style-no-underline {\n &:not(:hover):not(:active) {\n text-decoration: none;\n }\n}\n\n/// Include link destination when printing the page\n///\n/// If the user prints the page, add the destination URL after the link text, if\n/// the URL starts with `/`, `http://` or `https://`.\n///\n/// @access public\n\n@mixin govuk-link-print-friendly {\n @media print {\n &[href^=\"/\"],\n &[href^=\"http://\"],\n &[href^=\"https://\"]\n {\n &::after {\n content: \" (\" attr(href) \")\";\n font-size: 90%;\n\n // Because the URLs may be very long, ensure that they may be broken\n // at arbitrary points if there are no otherwise acceptable break\n // points in the line\n word-wrap: break-word;\n }\n }\n }\n}\n\n/// Image link styles\n///\n/// Prepares and provides the focus state for links that only contain images\n/// with no accompanying text.\n///\n/// @access public\n\n@mixin govuk-link-image {\n // Needed to draw the focus around the entire image\n display: inline-block;\n\n // Remove extra space at the bottom of the image that's added by line-height\n line-height: 0;\n\n // Don't render an underline\n text-decoration: none;\n\n &:focus {\n @include govuk-focused-box;\n }\n}\n"]}
@@ -2,52 +2,168 @@
2
2
  /// @group helpers/layout
3
3
  ////
4
4
 
5
+ @import "../settings/media-queries";
6
+ @import "../tools/px-to-em";
7
+
5
8
  // =========================================================
6
- // Wrangle sass-mq config...
9
+ // Helpers
7
10
  // =========================================================
8
11
 
9
- // Pass our breakpoint definitions through to sass-mq.
10
- $mq-breakpoints: if(variable-exists(govuk-breakpoints), $govuk-breakpoints, ());
12
+ /// Get the value of a breakpoint by name.
13
+ ///
14
+ /// @param {String | Number} $value - If a string, the name of a breakpoint
15
+ /// in $breakpoints. If a number without units, it will convert to px. If a
16
+ /// number with units, it will return the value unaltered.
17
+ /// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $value.
18
+ /// @returns {Number} - The set (minimum) value of the breakpoint
19
+ ///
20
+ /// @example scss
21
+ /// .element {
22
+ /// width: govuk-breakpoint-value(tablet);
23
+ /// @media (min-width: #{govuk-breakpoint-value(desktop)}) {
24
+ /// color: red;
25
+ /// }
26
+ /// @media (min-width: #{govuk-breakpoint-value(400px)}) {
27
+ /// color: green;
28
+ /// }
29
+ /// $custom-breakpoint-map: (
30
+ /// small: 350px,
31
+ /// medium: 769px,
32
+ /// large: 1100px,
33
+ /// extra-large: 1600px
34
+ /// );
35
+ /// @media (orientation: landscape) and (min-width: #{govuk-breakpoint-value(extra-large, $custom-breakpoint-map)}) {
36
+ /// color: blue;
37
+ /// }
38
+ /// }
39
+ ///
40
+ /// @access public
11
41
 
12
- $mq-show-breakpoints: ();
42
+ @function govuk-breakpoint-value($value, $breakpoints: $govuk-breakpoints) {
43
+ // If $value is a number
44
+ @if type-of($value) == "number" {
45
+ // If the number is unitless, coerce it into a pixel value
46
+ @if unitless($value) {
47
+ $value: $value * 1px;
48
+ }
13
49
 
14
- @if variable-exists(govuk-show-breakpoints) and $govuk-show-breakpoints {
15
- $mq-show-breakpoints: map-keys($govuk-breakpoints);
16
- }
50
+ @return $value;
51
+ }
17
52
 
18
- // This is a horrible, horrible hack to prevent the 'dev mode' CSS to display
19
- // the current breakpoint from being included multiple times.
20
- //
21
- // We can't use the `exports` mixin for this because import directives cannot be
22
- // used within control directives 😠
23
- $sass-mq-already-included: false !default;
53
+ // If $value is a string and exists as a key in in $breakpoints,
54
+ // look up and use the value of it
55
+ @if type-of($value) == "string" and map-has-key($breakpoints, $value) {
56
+ @return map-get($breakpoints, $value);
57
+ }
24
58
 
25
- @if $sass-mq-already-included {
26
- $mq-show-breakpoints: ();
59
+ // If we get this far, we can't use the value, so return an error
60
+ @error "Could not find a breakpoint given `#{$value}`.";
27
61
  }
28
62
 
29
- @import "../vendor/sass-mq";
63
+ /// Generate the `min-width` segment of a media query given a breakpoint key
64
+ ///
65
+ /// Pixel values are converted to ems for backwards compatibility with
66
+ /// sass-mq. Unlike sass-mq, non-px and em values can be used as well.
67
+ ///
68
+ /// @param {String | Number} $from - If a string, expects the name of a
69
+ /// breakpoint in $breakpoints. If a number, it will use that number.
70
+ /// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $from.
71
+ /// @returns {String} - A `min-width` media query segment
72
+ ///
73
+ /// @example scss
74
+ /// .example {
75
+ /// @media #{govuk-from-breakpoint(tablet)} {
76
+ /// color: red;
77
+ /// }
78
+ /// @media #{govuk-from-breakpoint(30em)} {
79
+ /// color: green;
80
+ /// }
81
+ /// @media #{govuk-from-breakpoint(tablet)} and (orientation: landscape) {
82
+ /// color: blue;
83
+ /// }
84
+ /// $custom-breakpoint-map: (
85
+ /// small: 350px,
86
+ /// medium: 769px,
87
+ /// large: 1100px,
88
+ /// extra-large: 1600px
89
+ /// );
90
+ /// @media #{govuk-from-breakpoint(extra-large, $custom-breakpoint-map)} {
91
+ /// color: cyan;
92
+ /// }
93
+ /// }
94
+ ///
95
+ /// @access public
30
96
 
31
- $sass-mq-already-included: true;
97
+ @function govuk-from-breakpoint($from, $breakpoints: $govuk-breakpoints) {
98
+ $value: govuk-breakpoint-value($from, $breakpoints);
32
99
 
33
- // =========================================================
34
- // Helpers
35
- // =========================================================
100
+ @if type-of($value) == "number" and unit($value) == "px" {
101
+ $value: govuk-em($value);
102
+ }
103
+
104
+ @return "(min-width: #{$value})";
105
+ }
36
106
 
37
- /// Media Query
107
+ /// Generate the `max-width` segment of a media query given a breakpoint key
38
108
  ///
39
- /// This is a currently a wrapper for sass-mq - abstracted so that we can
40
- /// replace it in the future if we so choose.
109
+ /// sass-mq converted pixel values to ems, and only performed subtractions on
110
+ /// named breakpoints. These have been retained for backwards compatibility,
111
+ /// though unlike sass-mq, this also supports using non-px and em values.
41
112
  ///
42
- /// @param {String | Boolean} $from [false] - One of $govuk-breakpoints
43
- /// @param {String | Boolean} $until [false] - One of $govuk-breakpoints
44
- /// @param {String | Boolean} $and [false] - Additional media query parameters
45
- /// @param {String} $media-type [all] - Media type: screen, print…
113
+ /// @param {String | Number} $until - If a string, expects the name of a
114
+ /// breakpoint in $breakpoints. If a number, it will use that number.
115
+ /// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $until.
116
+ /// @returns {String} - A `max-width` media query segment
117
+ ///
118
+ /// @example scss
119
+ /// .example {
120
+ /// @media #{govuk-until-breakpoint(desktop)} {
121
+ /// color: red;
122
+ /// }
123
+ /// @media #{govuk-until-breakpoint(40em)} {
124
+ /// color: green;
125
+ /// }
126
+ /// @media #{govuk-until-breakpoint(tablet)} and (orientation: landscape) {
127
+ /// color: blue;
128
+ /// }
129
+ /// $custom-breakpoint-map: (
130
+ /// small: 350px,
131
+ /// medium: 769px,
132
+ /// large: 1100px,
133
+ /// extra-large: 1600px
134
+ /// );
135
+ /// @media #{govuk-until-breakpoint(extra-large, $custom-breakpoint-map)} {
136
+ /// color: cyan;
137
+ /// }
138
+ /// }
139
+ ///
140
+ /// @access public
141
+
142
+ @function govuk-until-breakpoint($until, $breakpoints: $govuk-breakpoints) {
143
+ $value: govuk-breakpoint-value($until, $breakpoints);
144
+
145
+ @if type-of($value) == "number" and unit($value) == "px" {
146
+ // If it's a pixel value, convert it to ems.
147
+ $value: govuk-em($value);
148
+ }
149
+
150
+ // If $value derives from a named breakpoint, additionally subtract .01em
151
+ @if type-of($until) != "number" and unit($value) == "em" {
152
+ $value: $value - 0.01em;
153
+ }
154
+
155
+ @return "(max-width: #{$value})";
156
+ }
157
+
158
+ /// Media query
46
159
  ///
47
- /// @ignore Undocumented mq API, for advanced use only:
48
- /// @ignore @param {Map} $breakpoints [$govuk-breakpoints]
160
+ /// @param {String | Boolean} $from [false] - One of $breakpoints
161
+ /// @param {String | Boolean} $until [false] - One of $breakpoints
162
+ /// @param {String | Boolean} $and [false] - Additional media query parameters
163
+ /// @param {String} $media-type [all] - Override media type: screen, print…
164
+ /// @param {Map} $breakpoints [$govuk-breakpoints] - Map of breakpoints to use
49
165
  ///
50
- /// @content styling rules, wrapped into a @media query when $responsive is true
166
+ /// @content styling rules to use for the given media query range
51
167
  ///
52
168
  /// @example scss
53
169
  /// .element {
@@ -67,14 +183,37 @@ $sass-mq-already-included: true;
67
183
  /// color: hotpink;
68
184
  /// }
69
185
  /// @include govuk-media-query(tablet, $media-type: screen) {
70
- /// color: hotpink;
186
+ /// color: rebeccapurple;
71
187
  /// }
72
188
  /// }
73
189
  ///
74
190
  /// @access public
75
191
 
76
- @mixin govuk-media-query($args...) {
77
- @include mq($args...) {
192
+ @mixin govuk-media-query($from: null, $until: null, $and: null, $media-type: "all", $breakpoints: $govuk-breakpoints) {
193
+ $media-query: "";
194
+ $min-width: if($from, govuk-from-breakpoint($from, $breakpoints), null);
195
+ $max-width: if($until, govuk-until-breakpoint($until, $breakpoints), null);
196
+
197
+ // Assemble the media query string
198
+ @if $media-type != "all" {
199
+ $media-query: "#{$media-type}";
200
+ }
201
+ @if $min-width {
202
+ $media-query: "#{$media-query} and #{$min-width}";
203
+ }
204
+ @if $max-width {
205
+ $media-query: "#{$media-query} and #{$max-width}";
206
+ }
207
+ @if $and {
208
+ $media-query: "#{$media-query} and #{$and}";
209
+ }
210
+
211
+ // If $media-query currently begins with an orphaned ' and ', remove it.
212
+ @if str-index($media-query, " and ") == 1 {
213
+ $media-query: str-slice($media-query, 6);
214
+ }
215
+
216
+ @media #{$media-query} {
78
217
  @content;
79
218
  }
80
219
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_media-queries.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,wBAAwB;AACxB,GAAG;;AAEH,2DAA2D;AAC3D,2BAA2B;AAC3B,2DAA2D;;AAE3D,qDAAqD;AACrD,+EAA+E;;AAE/E,wBAAwB;;AAExB;EACE,kDAAkD;AACpD;;AAEA,4EAA4E;AAC5E,4DAA4D;AAC5D,CAAC;AACD,+EAA+E;AAC/E,mCAAmC;AACnC,yCAAyC;;AAEzC;EACE,wBAAwB;AAC1B;;AAEA,2BAA2B;;AAE3B,+BAA+B;;AAE/B,2DAA2D;AAC3D,SAAS;AACT,2DAA2D;;AAE3D,cAAc;AACd,EAAE;AACF,wEAAwE;AACxE,4CAA4C;AAC5C,EAAE;AACF,sEAAsE;AACtE,uEAAuE;AACvE,6EAA6E;AAC7E,iEAAiE;AACjE,EAAE;AACF,sDAAsD;AACtD,yDAAyD;AACzD,EAAE;AACF,+EAA+E;AAC/E,EAAE;AACF,gBAAgB;AAChB,cAAc;AACd,iDAAiD;AACjD,mBAAmB;AACnB,OAAO;AACP,kDAAkD;AAClD,oBAAoB;AACpB,OAAO;AACP,kDAAkD;AAClD,qBAAqB;AACrB,OAAO;AACP,mFAAmF;AACnF,oBAAoB;AACpB,OAAO;AACP,yCAAyC;AACzC,uBAAuB;AACvB,OAAO;AACP,+DAA+D;AAC/D,uBAAuB;AACvB,OAAO;AACP,KAAK;AACL,EAAE;AACF,iBAAiB;;AAEjB;EACE;IACE,QAAQ;EACV;AACF","file":"_media-queries.scss","sourcesContent":["////\n/// @group helpers/layout\n////\n\n// =========================================================\n// Wrangle sass-mq config...\n// =========================================================\n\n// Pass our breakpoint definitions through to sass-mq.\n$mq-breakpoints: if(variable-exists(govuk-breakpoints), $govuk-breakpoints, ());\n\n$mq-show-breakpoints: ();\n\n@if variable-exists(govuk-show-breakpoints) and $govuk-show-breakpoints {\n $mq-show-breakpoints: map-keys($govuk-breakpoints);\n}\n\n// This is a horrible, horrible hack to prevent the 'dev mode' CSS to display\n// the current breakpoint from being included multiple times.\n//\n// We can't use the `exports` mixin for this because import directives cannot be\n// used within control directives 😠\n$sass-mq-already-included: false !default;\n\n@if $sass-mq-already-included {\n $mq-show-breakpoints: ();\n}\n\n@import \"../vendor/sass-mq\";\n\n$sass-mq-already-included: true;\n\n// =========================================================\n// Helpers\n// =========================================================\n\n/// Media Query\n///\n/// This is a currently a wrapper for sass-mq - abstracted so that we can\n/// replace it in the future if we so choose.\n///\n/// @param {String | Boolean} $from [false] - One of $govuk-breakpoints\n/// @param {String | Boolean} $until [false] - One of $govuk-breakpoints\n/// @param {String | Boolean} $and [false] - Additional media query parameters\n/// @param {String} $media-type [all] - Media type: screen, print…\n///\n/// @ignore Undocumented mq API, for advanced use only:\n/// @ignore @param {Map} $breakpoints [$govuk-breakpoints]\n///\n/// @content styling rules, wrapped into a @media query when $responsive is true\n///\n/// @example scss\n/// .element {\n/// @include govuk-media-query($from: mobile) {\n/// color: red;\n/// }\n/// @include govuk-media-query($until: tablet) {\n/// color: blue;\n/// }\n/// @include govuk-media-query(mobile, tablet) {\n/// color: green;\n/// }\n/// @include govuk-media-query($from: tablet, $and: '(orientation: landscape)') {\n/// color: teal;\n/// }\n/// @include govuk-media-query(950px) {\n/// color: hotpink;\n/// }\n/// @include govuk-media-query(tablet, $media-type: screen) {\n/// color: hotpink;\n/// }\n/// }\n///\n/// @access public\n\n@mixin govuk-media-query($args...) {\n @include mq($args...) {\n @content;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/helpers/_media-queries.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,wBAAwB;AACxB,GAAG;;AAEH,mCAAmC;AACnC,2BAA2B;;AAE3B,2DAA2D;AAC3D,SAAS;AACT,2DAA2D;;AAE3D,yCAAyC;AACzC,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,2DAA2D;AAC3D,+EAA+E;AAC/E,gEAAgE;AAChE,EAAE;AACF,gBAAgB;AAChB,cAAc;AACd,4CAA4C;AAC5C,8DAA8D;AAC9D,mBAAmB;AACnB,OAAO;AACP,4DAA4D;AAC5D,qBAAqB;AACrB,OAAO;AACP,+BAA+B;AAC/B,qBAAqB;AACrB,sBAAsB;AACtB,sBAAsB;AACtB,2BAA2B;AAC3B,QAAQ;AACR,uHAAuH;AACvH,oBAAoB;AACpB,OAAO;AACP,KAAK;AACL,EAAE;AACF,iBAAiB;;AAEjB;EACE,uBAAuB;EACvB;IACE,yDAAyD;IACzD;MACE,oBAAoB;IACtB;;IAEA,cAAc;EAChB;;EAEA,+DAA+D;EAC/D,iCAAiC;EACjC;IACE,qCAAqC;EACvC;;EAEA,gEAAgE;EAChE,uDAAuD;AACzD;;AAEA,2EAA2E;AAC3E,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,8EAA8E;AAC9E,wDAAwD;AACxD,EAAE;AACF,gBAAgB;AAChB,cAAc;AACd,+CAA+C;AAC/C,mBAAmB;AACnB,OAAO;AACP,6CAA6C;AAC7C,qBAAqB;AACrB,OAAO;AACP,4EAA4E;AAC5E,oBAAoB;AACpB,OAAO;AACP,+BAA+B;AAC/B,qBAAqB;AACr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;AAEjB;EACE,gBAAgB;EAChB,uEAAuE;EACvE,0EAA0E;;EAE1E,iCAAiC;EACjC;IACE,8BAA8B;EAChC;EACA;IACE,iDAAiD;EACnD;EACA;IACE,iDAAiD;EACnD;EACA;IACE,2CAA2C;EAC7C;;EAEA,uEAAuE;EACvE;IACE,wCAAwC;EAC1C;;EAEA;IACE,QAAQ;EACV;AACF","file":"_media-queries.scss","sourcesContent":["////\n/// @group helpers/layout\n////\n\n@import \"../settings/media-queries\";\n@import \"../tools/px-to-em\";\n\n// =========================================================\n// Helpers\n// =========================================================\n\n/// Get the value of a breakpoint by name.\n///\n/// @param {String | Number} $value - If a string, the name of a breakpoint\n/// in $breakpoints. If a number without units, it will convert to px. If a\n/// number with units, it will return the value unaltered.\n/// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $value.\n/// @returns {Number} - The set (minimum) value of the breakpoint\n///\n/// @example scss\n/// .element {\n/// width: govuk-breakpoint-value(tablet);\n/// @media (min-width: #{govuk-breakpoint-value(desktop)}) {\n/// color: red;\n/// }\n/// @media (min-width: #{govuk-breakpoint-value(400px)}) {\n/// color: green;\n/// }\n/// $custom-breakpoint-map: (\n/// small: 350px,\n/// medium: 769px,\n/// large: 1100px,\n/// extra-large: 1600px\n/// );\n/// @media (orientation: landscape) and (min-width: #{govuk-breakpoint-value(extra-large, $custom-breakpoint-map)}) {\n/// color: blue;\n/// }\n/// }\n///\n/// @access public\n\n@function govuk-breakpoint-value($value, $breakpoints: $govuk-breakpoints) {\n // If $value is a number\n @if type-of($value) == \"number\" {\n // If the number is unitless, coerce it into a pixel value\n @if unitless($value) {\n $value: $value * 1px;\n }\n\n @return $value;\n }\n\n // If $value is a string and exists as a key in in $breakpoints,\n // look up and use the value of it\n @if type-of($value) == \"string\" and map-has-key($breakpoints, $value) {\n @return map-get($breakpoints, $value);\n }\n\n // If we get this far, we can't use the value, so return an error\n @error \"Could not find a breakpoint given `#{$value}`.\";\n}\n\n/// Generate the `min-width` segment of a media query given a breakpoint key\n///\n/// Pixel values are converted to ems for backwards compatibility with\n/// sass-mq. Unlike sass-mq, non-px and em values can be used as well.\n///\n/// @param {String | Number} $from - If a string, expects the name of a\n/// breakpoint in $breakpoints. If a number, it will use that number.\n/// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $from.\n/// @returns {String} - A `min-width` media query segment\n///\n/// @example scss\n/// .example {\n/// @media #{govuk-from-breakpoint(tablet)} {\n/// color: red;\n/// }\n/// @media #{govuk-from-breakpoint(30em)} {\n/// color: green;\n/// }\n/// @media #{govuk-from-breakpoint(tablet)} and (orientation: landscape) {\n/// color: blue;\n/// }\n/// $custom-breakpoint-map: (\n/// small: 350px,\n/// medium: 769px,\n/// large: 1100px,\n/// extra-large: 1600px\n/// );\n/// @media #{govuk-from-breakpoint(extra-large, $custom-breakpoint-map)} {\n/// color: cyan;\n/// }\n/// }\n///\n/// @access public\n\n@function govuk-from-breakpoint($from, $breakpoints: $govuk-breakpoints) {\n $value: govuk-breakpoint-value($from, $breakpoints);\n\n @if type-of($value) == \"number\" and unit($value) == \"px\" {\n $value: govuk-em($value);\n }\n\n @return \"(min-width: #{$value})\";\n}\n\n/// Generate the `max-width` segment of a media query given a breakpoint key\n///\n/// sass-mq converted pixel values to ems, and only performed subtractions on\n/// named breakpoints. These have been retained for backwards compatibility,\n/// though unlike sass-mq, this also supports using non-px and em values.\n///\n/// @param {String | Number} $until - If a string, expects the name of a\n/// breakpoint in $breakpoints. If a number, it will use that number.\n/// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $until.\n/// @returns {String} - A `max-width` media query segment\n///\n/// @example scss\n/// .example {\n/// @media #{govuk-until-breakpoint(desktop)} {\n/// color: red;\n/// }\n/// @media #{govuk-until-breakpoint(40em)} {\n/// color: green;\n/// }\n/// @media #{govuk-until-breakpoint(tablet)} and (orientation: landscape) {\n/// color: blue;\n/// }\n/// $custom-breakpoint-map: (\n/// small: 350px,\n/// medium: 769px,\n/// large: 1100px,\n/// extra-large: 1600px\n/// );\n/// @media #{govuk-until-breakpoint(extra-large, $custom-breakpoint-map)} {\n/// color: cyan;\n/// }\n/// }\n///\n/// @access public\n\n@function govuk-until-breakpoint($until, $breakpoints: $govuk-breakpoints) {\n $value: govuk-breakpoint-value($until, $breakpoints);\n\n @if type-of($value) == \"number\" and unit($value) == \"px\" {\n // If it's a pixel value, convert it to ems.\n $value: govuk-em($value);\n }\n\n // If $value derives from a named breakpoint, additionally subtract .01em\n @if type-of($until) != \"number\" and unit($value) == \"em\" {\n $value: $value - 0.01em;\n }\n\n @return \"(max-width: #{$value})\";\n}\n\n/// Media query\n///\n/// @param {String | Boolean} $from [false] - One of $breakpoints\n/// @param {String | Boolean} $until [false] - One of $breakpoints\n/// @param {String | Boolean} $and [false] - Additional media query parameters\n/// @param {String} $media-type [all] - Override media type: screen, print…\n/// @param {Map} $breakpoints [$govuk-breakpoints] - Map of breakpoints to use\n///\n/// @content styling rules to use for the given media query range\n///\n/// @example scss\n/// .element {\n/// @include govuk-media-query($from: mobile) {\n/// color: red;\n/// }\n/// @include govuk-media-query($until: tablet) {\n/// color: blue;\n/// }\n/// @include govuk-media-query(mobile, tablet) {\n/// color: green;\n/// }\n/// @include govuk-media-query($from: tablet, $and: '(orientation: landscape)') {\n/// color: teal;\n/// }\n/// @include govuk-media-query(950px) {\n/// color: hotpink;\n/// }\n/// @include govuk-media-query(tablet, $media-type: screen) {\n/// color: rebeccapurple;\n/// }\n/// }\n///\n/// @access public\n\n@mixin govuk-media-query($from: null, $until: null, $and: null, $media-type: \"all\", $breakpoints: $govuk-breakpoints) {\n $media-query: \"\";\n $min-width: if($from, govuk-from-breakpoint($from, $breakpoints), null);\n $max-width: if($until, govuk-until-breakpoint($until, $breakpoints), null);\n\n // Assemble the media query string\n @if $media-type != \"all\" {\n $media-query: \"#{$media-type}\";\n }\n @if $min-width {\n $media-query: \"#{$media-query} and #{$min-width}\";\n }\n @if $max-width {\n $media-query: \"#{$media-query} and #{$max-width}\";\n }\n @if $and {\n $media-query: \"#{$media-query} and #{$and}\";\n }\n\n // If $media-query currently begins with an orphaned ' and ', remove it.\n @if str-index($media-query, \" and \") == 1 {\n $media-query: str-slice($media-query, 6);\n }\n\n @media #{$media-query} {\n @content;\n }\n}\n"]}
@@ -107,7 +107,7 @@
107
107
  #{$property}-#{$direction}: $breakpoint-value if($important, !important, null);
108
108
  }
109
109
  } @else {
110
- @include govuk-media-query($from: $breakpoint) {
110
+ @media #{govuk-from-breakpoint($breakpoint)} {
111
111
  @if $direction == all {
112
112
  #{$property}: $breakpoint-value if($important, !important, null);
113
113
  } @else {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/govuk/helpers/_spacing.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,yBAAyB;AACzB,GAAG;;AAEH,uBAAuB;AACvB,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,8DAA8D;AAC9D,qCAAqC;AACrC,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,iCAAiC;AACjC,MAAM;AACN,EAAE;AACF,uCAAuC;AACvC,eAAe;AACf,qCAAqC;AACrC,MAAM;AACN,EAAE;AACF,0DAA0D;AAC1D,eAAe;AACf,+CAA+C;AAC/C,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,2CAA2C;EAC3C;IACE;gCAC4B;EAC9B;;EAEA,mBAAmB;EACnB;IACE,kBAAkB;IAClB,mCAAmC;EACrC;;EAEA;IACE,0IAA0I;EAC5I;;EAEA,sDAAsD;EACtD,6CAA6C;AAC/C;;AAEA,qBAAqB;AACrB,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,qDAAqD;AACrD,EAAE;AACF,mEAAmE;AACnE,oCAAoC;AACpC,EAAE;AACF,8EAA8E;AAC9E,kEAAkE;AAClE,yEAAyE;AACzE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,kBAAkB;;AAElB;;;;;;;EAOE,sDAAsD;EACtD;IACE,2EAA2E;EAC7E;;EAEA;IACE;+DAC2D;EAC7D;;EAEA,yEAAyE;EACzE,+EAA+E;EAC/E,qCAAqC;EACrC;IACE;uHACmH;EACrH;;EAEA,yCAAyC;EACzC;IACE;MACE,kDAAkD;IACpD;;IAEA,sCAAsC;IACtC;MACE;QACE,gEAAgE;MAClE,EAAE;QACA,8EAA8E;MAChF;IACF,EAAE;MACA;QACE;UACE,gEAAgE;QAClE,EAAE;UACA,8EAA8E;QAChF;MACF;IACF;EACF;AACF;;AAEA,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,kEAAkE;AAClE,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,8EAA8E;AAC9E,gEAAgE;AAChE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,sEAAsE;AACtE,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,4GAA4G;AAC9G;;AAEA,qBAAqB;AACrB,EAAE;AACF,0EAA0E;AAC1E,qEAAqE;AACrE,kEAAkE;AAClE,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,8EAA8E;AAC9E,kEAAkE;AAClE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,uEAAuE;AACvE,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,6GAA6G;AAC/G","file":"_spacing.scss","sourcesContent":["////\n/// @group helpers/spacing\n////\n\n/// Single point spacing\n///\n/// Returns measurement corresponding to the spacing point requested.\n///\n/// @param {Number} $spacing-point - Point on the spacing scale\n/// (set in `settings/_spacing.scss`)\n///\n/// @returns {String} Spacing measurement eg. 10px\n///\n/// @example scss\n/// .element {\n/// padding: govuk-spacing(5);\n/// }\n///\n/// @example scss Using negative spacing\n/// .element {\n/// margin-top: govuk-spacing(-1);\n/// }\n///\n/// @example scss Marking spacing declarations as important\n/// .element {\n/// margin-top: govuk-spacing(1) !important;\n/// }\n///\n/// @access public\n\n@function govuk-spacing($spacing-point) {\n $actual-input-type: type-of($spacing-point);\n @if $actual-input-type != \"number\" {\n @error \"Expected a number (integer), but got a \"\n + \"#{$actual-input-type}.\";\n }\n\n $is-negative: false;\n @if $spacing-point < 0 {\n $is-negative: true;\n $spacing-point: abs($spacing-point);\n }\n\n @if not map-has-key($govuk-spacing-points, $spacing-point) {\n @error \"Unknown spacing variable `#{$spacing-point}`. Make sure you are using a point from the spacing scale in `_settings/spacing.scss`.\";\n }\n\n $value: map-get($govuk-spacing-points, $spacing-point);\n @return if($is-negative, $value * -1, $value);\n}\n\n/// Responsive spacing\n///\n/// Adds responsive spacing (either padding or margin, depending on `$property`)\n/// by fetching a 'spacing map' from the responsive spacing scale, which defines\n/// different spacing values at different breakpoints.\n///\n/// To generate responsive spacing, use 'govuk-responsive-margin' or\n/// 'govuk-responsive-padding' mixins\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $property - Property to add spacing to (e.g. 'margin')\n/// @param {String} $direction [all] - Direction to add spacing to\n/// (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing by\n///\n/// @access private\n\n@mixin _govuk-responsive-spacing(\n $responsive-spacing-point,\n $property,\n $direction: \"all\",\n $important: false,\n $adjustment: false\n) {\n $actual-input-type: type-of($responsive-spacing-point);\n @if $actual-input-type != \"number\" {\n @error \"Expected a number (integer), but got a \" + \"#{$actual-input-type}.\";\n }\n\n @if not map-has-key($govuk-spacing-responsive-scale, $responsive-spacing-point) {\n @error \"Unknown spacing point `#{$responsive-spacing-point}`. Make sure you are using a point from the \"\n + \"responsive spacing scale in `_settings/spacing.scss`.\";\n }\n\n // Make sure that the return value from `_settings/spacing.scss` is a map.\n $scale-map: map-get($govuk-spacing-responsive-scale, $responsive-spacing-point);\n $actual-map-type: type-of($scale-map);\n @if $actual-map-type != \"map\" {\n @error \"Expected a number (integer), but got a \"\n + \"#{$actual-map-type}. Make sure you are using a map to set the responsive spacing in `_settings/spacing.scss`)\";\n }\n\n // Loop through each breakpoint in the map\n @each $breakpoint, $breakpoint-value in $scale-map {\n @if $adjustment {\n $breakpoint-value: $breakpoint-value + $adjustment;\n }\n\n // The 'null' breakpoint is for mobile.\n @if not $breakpoint {\n @if $direction == all {\n #{$property}: $breakpoint-value if($important, !important, null);\n } @else {\n #{$property}-#{$direction}: $breakpoint-value if($important, !important, null);\n }\n } @else {\n @include govuk-media-query($from: $breakpoint) {\n @if $direction == all {\n #{$property}: $breakpoint-value if($important, !important, null);\n } @else {\n #{$property}-#{$direction}: $breakpoint-value if($important, !important, null);\n }\n }\n }\n }\n}\n\n/// Responsive margin\n///\n/// Adds responsive margin by fetching a 'spacing map' from the responsive\n/// spacing scale, which defines different spacing values at different\n/// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.\n///\n/// @see {mixin} _govuk-responsive-spacing\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $direction [all] - Direction to add spacing to\n/// (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing by\n///\n/// @example scss\n/// .element {\n/// @include govuk-responsive-margin(6, \"left\", $adjustment: 1px);\n/// }\n///\n/// @access public\n\n@mixin govuk-responsive-margin($responsive-spacing-point, $direction: \"all\", $important: false, $adjustment: false) {\n @include _govuk-responsive-spacing($responsive-spacing-point, \"margin\", $direction, $important, $adjustment);\n}\n\n/// Responsive padding\n///\n/// Adds responsive padding by fetching a 'spacing map' from the responsive\n/// spacing scale, which defines different spacing values at different\n/// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.\n///\n/// @see {mixin} _govuk-responsive-spacing\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $direction [all] - Direction to add spacing to\n/// (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing\n///\n/// @example scss\n/// .element {\n/// @include govuk-responsive-padding(6, \"left\", $adjustment: 1px);\n/// }\n///\n/// @access public\n\n@mixin govuk-responsive-padding($responsive-spacing-point, $direction: \"all\", $important: false, $adjustment: false) {\n @include _govuk-responsive-spacing($responsive-spacing-point, \"padding\", $direction, $important, $adjustment);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/govuk/helpers/_spacing.scss"],"names":[],"mappings":"AAAA,GAAG;AACH,yBAAyB;AACzB,GAAG;;AAEH,uBAAuB;AACvB,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,8DAA8D;AAC9D,qCAAqC;AACrC,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,iCAAiC;AACjC,MAAM;AACN,EAAE;AACF,uCAAuC;AACvC,eAAe;AACf,qCAAqC;AACrC,MAAM;AACN,EAAE;AACF,0DAA0D;AAC1D,eAAe;AACf,+CAA+C;AAC/C,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,2CAA2C;EAC3C;IACE;gCAC4B;EAC9B;;EAEA,mBAAmB;EACnB;IACE,kBAAkB;IAClB,mCAAmC;EACrC;;EAEA;IACE,0IAA0I;EAC5I;;EAEA,sDAAsD;EACtD,6CAA6C;AAC/C;;AAEA,qBAAqB;AACrB,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,qDAAqD;AACrD,EAAE;AACF,mEAAmE;AACnE,oCAAoC;AACpC,EAAE;AACF,8EAA8E;AAC9E,kEAAkE;AAClE,yEAAyE;AACzE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,kBAAkB;;AAElB;;;;;;;EAOE,sDAAsD;EACtD;IACE,2EAA2E;EAC7E;;EAEA;IACE;+DAC2D;EAC7D;;EAEA,yEAAyE;EACzE,+EAA+E;EAC/E,qCAAqC;EACrC;IACE;uHACmH;EACrH;;EAEA,yCAAyC;EACzC;IACE;MACE,kDAAkD;IACpD;;IAEA,sCAAsC;IACtC;MACE;QACE,gEAAgE;MAClE,EAAE;QACA,8EAA8E;MAChF;IACF,EAAE;MACA;QACE;UACE,gEAAgE;QAClE,EAAE;UACA,8EAA8E;QAChF;MACF;IACF;EACF;AACF;;AAEA,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,kEAAkE;AAClE,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,8EAA8E;AAC9E,gEAAgE;AAChE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,sEAAsE;AACtE,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,4GAA4G;AAC9G;;AAEA,qBAAqB;AACrB,EAAE;AACF,0EAA0E;AAC1E,qEAAqE;AACrE,kEAAkE;AAClE,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,8EAA8E;AAC9E,kEAAkE;AAClE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,uEAAuE;AACvE,MAAM;AACN,EAAE;AACF,iBAAiB;;AAEjB;EACE,6GAA6G;AAC/G","file":"_spacing.scss","sourcesContent":["////\n/// @group helpers/spacing\n////\n\n/// Single point spacing\n///\n/// Returns measurement corresponding to the spacing point requested.\n///\n/// @param {Number} $spacing-point - Point on the spacing scale\n/// (set in `settings/_spacing.scss`)\n///\n/// @returns {String} Spacing measurement eg. 10px\n///\n/// @example scss\n/// .element {\n/// padding: govuk-spacing(5);\n/// }\n///\n/// @example scss Using negative spacing\n/// .element {\n/// margin-top: govuk-spacing(-1);\n/// }\n///\n/// @example scss Marking spacing declarations as important\n/// .element {\n/// margin-top: govuk-spacing(1) !important;\n/// }\n///\n/// @access public\n\n@function govuk-spacing($spacing-point) {\n $actual-input-type: type-of($spacing-point);\n @if $actual-input-type != \"number\" {\n @error \"Expected a number (integer), but got a \"\n + \"#{$actual-input-type}.\";\n }\n\n $is-negative: false;\n @if $spacing-point < 0 {\n $is-negative: true;\n $spacing-point: abs($spacing-point);\n }\n\n @if not map-has-key($govuk-spacing-points, $spacing-point) {\n @error \"Unknown spacing variable `#{$spacing-point}`. Make sure you are using a point from the spacing scale in `_settings/spacing.scss`.\";\n }\n\n $value: map-get($govuk-spacing-points, $spacing-point);\n @return if($is-negative, $value * -1, $value);\n}\n\n/// Responsive spacing\n///\n/// Adds responsive spacing (either padding or margin, depending on `$property`)\n/// by fetching a 'spacing map' from the responsive spacing scale, which defines\n/// different spacing values at different breakpoints.\n///\n/// To generate responsive spacing, use 'govuk-responsive-margin' or\n/// 'govuk-responsive-padding' mixins\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $property - Property to add spacing to (e.g. 'margin')\n/// @param {String} $direction [all] - Direction to add spacing to\n/// (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing by\n///\n/// @access private\n\n@mixin _govuk-responsive-spacing(\n $responsive-spacing-point,\n $property,\n $direction: \"all\",\n $important: false,\n $adjustment: false\n) {\n $actual-input-type: type-of($responsive-spacing-point);\n @if $actual-input-type != \"number\" {\n @error \"Expected a number (integer), but got a \" + \"#{$actual-input-type}.\";\n }\n\n @if not map-has-key($govuk-spacing-responsive-scale, $responsive-spacing-point) {\n @error \"Unknown spacing point `#{$responsive-spacing-point}`. Make sure you are using a point from the \"\n + \"responsive spacing scale in `_settings/spacing.scss`.\";\n }\n\n // Make sure that the return value from `_settings/spacing.scss` is a map.\n $scale-map: map-get($govuk-spacing-responsive-scale, $responsive-spacing-point);\n $actual-map-type: type-of($scale-map);\n @if $actual-map-type != \"map\" {\n @error \"Expected a number (integer), but got a \"\n + \"#{$actual-map-type}. Make sure you are using a map to set the responsive spacing in `_settings/spacing.scss`)\";\n }\n\n // Loop through each breakpoint in the map\n @each $breakpoint, $breakpoint-value in $scale-map {\n @if $adjustment {\n $breakpoint-value: $breakpoint-value + $adjustment;\n }\n\n // The 'null' breakpoint is for mobile.\n @if not $breakpoint {\n @if $direction == all {\n #{$property}: $breakpoint-value if($important, !important, null);\n } @else {\n #{$property}-#{$direction}: $breakpoint-value if($important, !important, null);\n }\n } @else {\n @media #{govuk-from-breakpoint($breakpoint)} {\n @if $direction == all {\n #{$property}: $breakpoint-value if($important, !important, null);\n } @else {\n #{$property}-#{$direction}: $breakpoint-value if($important, !important, null);\n }\n }\n }\n }\n}\n\n/// Responsive margin\n///\n/// Adds responsive margin by fetching a 'spacing map' from the responsive\n/// spacing scale, which defines different spacing values at different\n/// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.\n///\n/// @see {mixin} _govuk-responsive-spacing\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $direction [all] - Direction to add spacing to\n/// (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing by\n///\n/// @example scss\n/// .element {\n/// @include govuk-responsive-margin(6, \"left\", $adjustment: 1px);\n/// }\n///\n/// @access public\n\n@mixin govuk-responsive-margin($responsive-spacing-point, $direction: \"all\", $important: false, $adjustment: false) {\n @include _govuk-responsive-spacing($responsive-spacing-point, \"margin\", $direction, $important, $adjustment);\n}\n\n/// Responsive padding\n///\n/// Adds responsive padding by fetching a 'spacing map' from the responsive\n/// spacing scale, which defines different spacing values at different\n/// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.\n///\n/// @see {mixin} _govuk-responsive-spacing\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $direction [all] - Direction to add spacing to\n/// (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing\n///\n/// @example scss\n/// .element {\n/// @include govuk-responsive-padding(6, \"left\", $adjustment: 1px);\n/// }\n///\n/// @access public\n\n@mixin govuk-responsive-padding($responsive-spacing-point, $direction: \"all\", $important: false, $adjustment: false) {\n @include _govuk-responsive-spacing($responsive-spacing-point, \"padding\", $direction, $important, $adjustment);\n}\n"]}
@@ -23,7 +23,7 @@
23
23
  @include _govuk-font-face-gds-transport;
24
24
  }
25
25
 
26
- @include govuk-media-query($media-type: print) {
26
+ @media print {
27
27
  font-family: $govuk-font-family-print;
28
28
  }
29
29
  }
@@ -37,7 +37,7 @@
37
37
  @mixin govuk-text-colour {
38
38
  color: $govuk-text-colour;
39
39
 
40
- @include govuk-media-query($media-type: print) {
40
+ @media print {
41
41
  color: $govuk-print-text-colour;
42
42
  }
43
43
  }
@@ -240,12 +240,12 @@
240
240
  font-size: $font-size-rem;
241
241
  line-height: $calculated-line-height;
242
242
  } @else if $breakpoint == "print" {
243
- @include govuk-media-query($media-type: print) {
243
+ @media print {
244
244
  font-size: $font-size;
245
245
  line-height: $calculated-line-height;
246
246
  }
247
247
  } @else {
248
- @include govuk-media-query($from: $breakpoint) {
248
+ @media #{govuk-from-breakpoint($breakpoint)} {
249
249
  font-size: $font-size-rem;
250
250
  line-height: $calculated-line-height;
251
251
  }