govuk_fe_assets 0.1.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +39 -0
  8. data/Rakefile +6 -0
  9. data/govuk_fe_assets.gemspec +26 -0
  10. data/lib/govuk_fe_assets.rb +5 -0
  11. data/lib/govuk_fe_assets/version.rb +3 -0
  12. data/node_modules/govuk-frontend/README.md +96 -0
  13. data/node_modules/govuk-frontend/all-ie8.scss +6 -0
  14. data/node_modules/govuk-frontend/all.js +1720 -0
  15. data/node_modules/govuk-frontend/all.scss +11 -0
  16. data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
  17. data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
  18. data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
  19. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
  20. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
  21. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
  22. data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
  23. data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
  24. data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
  25. data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
  26. data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
  27. data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
  28. data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
  29. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
  30. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
  31. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
  32. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
  33. data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
  34. data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
  35. data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
  36. data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
  37. data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
  38. data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
  39. data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
  40. data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
  41. data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
  42. data/node_modules/govuk-frontend/common.js +39 -0
  43. data/node_modules/govuk-frontend/components/_all.scss +26 -0
  44. data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
  45. data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
  46. data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
  47. data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
  48. data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
  49. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
  50. data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
  51. data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
  52. data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
  53. data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
  54. data/node_modules/govuk-frontend/components/button/README.md +319 -0
  55. data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
  56. data/node_modules/govuk-frontend/components/button/button.js +548 -0
  57. data/node_modules/govuk-frontend/components/button/button.njk +3 -0
  58. data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
  59. data/node_modules/govuk-frontend/components/button/template.njk +35 -0
  60. data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
  61. data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
  62. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
  63. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
  64. data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
  65. data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
  66. data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
  67. data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
  68. data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
  69. data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
  70. data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
  71. data/node_modules/govuk-frontend/components/details/README.md +237 -0
  72. data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
  73. data/node_modules/govuk-frontend/components/details/details.js +836 -0
  74. data/node_modules/govuk-frontend/components/details/details.njk +7 -0
  75. data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
  76. data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
  77. data/node_modules/govuk-frontend/components/details/template.njk +10 -0
  78. data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
  79. data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
  80. data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
  81. data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
  82. data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
  83. data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
  84. data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
  85. data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
  86. data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
  87. data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
  88. data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
  89. data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
  90. data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
  91. data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
  92. data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
  93. data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
  94. data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
  95. data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
  96. data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
  97. data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
  98. data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
  99. data/node_modules/govuk-frontend/components/footer/README.md +284 -0
  100. data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
  101. data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
  102. data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
  103. data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
  104. data/node_modules/govuk-frontend/components/header/README.md +524 -0
  105. data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
  106. data/node_modules/govuk-frontend/components/header/header.js +717 -0
  107. data/node_modules/govuk-frontend/components/header/header.njk +3 -0
  108. data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
  109. data/node_modules/govuk-frontend/components/header/template.njk +82 -0
  110. data/node_modules/govuk-frontend/components/hint/README.md +157 -0
  111. data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
  112. data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
  113. data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
  114. data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
  115. data/node_modules/govuk-frontend/components/input/README.md +416 -0
  116. data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
  117. data/node_modules/govuk-frontend/components/input/input.njk +9 -0
  118. data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
  119. data/node_modules/govuk-frontend/components/input/template.njk +42 -0
  120. data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
  121. data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
  122. data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
  123. data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
  124. data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
  125. data/node_modules/govuk-frontend/components/label/README.md +193 -0
  126. data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
  127. data/node_modules/govuk-frontend/components/label/label.njk +6 -0
  128. data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
  129. data/node_modules/govuk-frontend/components/label/template.njk +15 -0
  130. data/node_modules/govuk-frontend/components/panel/README.md +151 -0
  131. data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
  132. data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
  133. data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
  134. data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
  135. data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
  136. data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
  137. data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
  138. data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
  139. data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
  140. data/node_modules/govuk-frontend/components/radios/README.md +686 -0
  141. data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
  142. data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
  143. data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
  144. data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
  145. data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
  146. data/node_modules/govuk-frontend/components/select/README.md +387 -0
  147. data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
  148. data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
  149. data/node_modules/govuk-frontend/components/select/select.njk +24 -0
  150. data/node_modules/govuk-frontend/components/select/template.njk +44 -0
  151. data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
  152. data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
  153. data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
  154. data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
  155. data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
  156. data/node_modules/govuk-frontend/components/table/README.md +585 -0
  157. data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
  158. data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
  159. data/node_modules/govuk-frontend/components/table/table.njk +45 -0
  160. data/node_modules/govuk-frontend/components/table/template.njk +39 -0
  161. data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
  162. data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
  163. data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
  164. data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
  165. data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
  166. data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
  167. data/node_modules/govuk-frontend/components/tag/README.md +150 -0
  168. data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
  169. data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
  170. data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
  171. data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
  172. data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
  173. data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
  174. data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
  175. data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
  176. data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
  177. data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
  178. data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
  179. data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
  180. data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
  181. data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
  182. data/node_modules/govuk-frontend/core/_all.scss +6 -0
  183. data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
  184. data/node_modules/govuk-frontend/core/_links.scss +40 -0
  185. data/node_modules/govuk-frontend/core/_lists.scss +63 -0
  186. data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
  187. data/node_modules/govuk-frontend/core/_template.scss +16 -0
  188. data/node_modules/govuk-frontend/core/_typography.scss +186 -0
  189. data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
  190. data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
  191. data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
  192. data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
  193. data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
  194. data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
  195. data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
  196. data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
  197. data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
  198. data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
  199. data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
  200. data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
  201. data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
  202. data/node_modules/govuk-frontend/objects/_all.scss +4 -0
  203. data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
  204. data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
  205. data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
  206. data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
  207. data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
  208. data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
  209. data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
  210. data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
  211. data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
  212. data/node_modules/govuk-frontend/package.json +50 -0
  213. data/node_modules/govuk-frontend/settings/_all.scss +21 -0
  214. data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
  215. data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
  216. data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
  217. data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
  218. data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
  219. data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
  220. data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
  221. data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
  222. data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
  223. data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
  224. data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
  225. data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
  226. data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
  227. data/node_modules/govuk-frontend/template.njk +56 -0
  228. data/node_modules/govuk-frontend/tools/_all.scss +7 -0
  229. data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
  230. data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
  231. data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
  232. data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
  233. data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
  234. data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
  235. data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
  236. data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
  237. data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
  238. data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
  239. data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
  240. data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
  241. data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
  242. data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
  243. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
  244. data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
  245. data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
  246. data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
  247. data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
  248. data/package-lock.json +10 -0
  249. data/package.json +5 -0
  250. metadata +334 -0
@@ -0,0 +1,100 @@
1
+ ////
2
+ /// @group helpers
3
+ ////
4
+
5
+ /// Map of grid column widths
6
+ ///
7
+ /// @type Map
8
+ /// @access private
9
+
10
+ $_govuk-grid-widths: (
11
+ one-quarter: 25%,
12
+ one-third: 33.3333%,
13
+ one-half: 50%,
14
+ two-thirds: 66.6666%,
15
+ three-quarters: 75%,
16
+ full: 100%
17
+ ) !default;
18
+
19
+ /// Grid width percentage
20
+ ///
21
+ /// @param {String} $key - Name of grid width (e.g. two-thirds)
22
+ /// @return {Number} Percentage width
23
+ /// @throw if `$key` is not a valid grid width
24
+ /// @access public
25
+
26
+ @function grid-width($key) {
27
+ @if map-has-key($_govuk-grid-widths, $key) {
28
+ @return map-get($_govuk-grid-widths, $key);
29
+ }
30
+
31
+ @error "Unknown grid width `#{$key}`";
32
+ }
33
+
34
+ /// Generate grid row styles
35
+ ///
36
+ /// Creates a grid row class with a standardised margin.
37
+ ///
38
+ /// @param {String} $class [govuk-grid-row] CSS class name
39
+ ///
40
+ /// @example scss - Default
41
+ /// @include govuk-grid-row;
42
+ ///
43
+ /// @example scss - Customising the class name
44
+ /// @include govuk-grid-row("app-grid");
45
+ ///
46
+ /// @access public
47
+
48
+ @mixin govuk-grid-row($class: "govuk-grid-row") {
49
+ .#{$class} {
50
+ @include govuk-clearfix;
51
+ margin-right: - ($govuk-gutter-half);
52
+ margin-left: - ($govuk-gutter-half);
53
+ }
54
+ }
55
+
56
+ /// Generate grid column styles
57
+ ///
58
+ /// Creates a cross browser grid column with a class of '.govuk-grid-column' by
59
+ /// default, and a standardised gutter between the columns.
60
+ ///
61
+ /// Common widths are predefined above as keywords in the `$grid-widths` map.
62
+ ///
63
+ /// By default their width changes from 100% to specified width at the 'tablet'
64
+ /// breakpoint, but that can be configured to be any other breakpoint by using
65
+ /// the `$at` parameter.
66
+ ///
67
+ /// @param {String} $class [govuk-grid-column] CSS class name
68
+ /// @param {String} $width [full] one-quarter | one-third | one-half | two-third | three-quarters | full
69
+ /// @param {String} $float [left] left | right
70
+ /// @param {String} $at [tablet] - mobile | tablet | desktop | any custom breakpoint in px or em
71
+ ///
72
+ /// @example scss - Default
73
+ /// @include govuk-grid-column(two-thirds)
74
+ ///
75
+ /// @example scss - Customising the class name
76
+ /// @include govuk-grid-column(one-half, $class: "test-column");
77
+ ///
78
+ /// @example scss - Customising the breakpoint where width percentage is applied
79
+ /// @include govuk-grid-column(one-half, $at: desktop);
80
+ ///
81
+ /// @example scss - Customising the float direction
82
+ /// @include govuk-grid-column(one-half, $float: right);
83
+ ///
84
+ /// @access public
85
+
86
+ @mixin govuk-grid-column($width: full, $float: left, $at: tablet, $class: "govuk-grid-column") {
87
+
88
+ .#{$class}-#{$width} {
89
+ -webkit-box-sizing: border-box;
90
+ box-sizing: border-box;
91
+ @if $at != desktop {
92
+ width: 100%;
93
+ }
94
+ padding: 0 $govuk-gutter-half;
95
+ @include govuk-media-query($from: $at) {
96
+ width: grid-width($width);
97
+ float: $float;
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,149 @@
1
+ ////
2
+ /// @group helpers
3
+ ////
4
+
5
+ /// Common link mixin
6
+ ///
7
+ /// Provides the typography and focus state, regardless of link style.
8
+ ///
9
+ /// @access public
10
+
11
+ @mixin govuk-link-common {
12
+ @include govuk-typography-common;
13
+ @include govuk-focusable-fill;
14
+ }
15
+
16
+ /// Default link style mixin
17
+ ///
18
+ /// Provides the default unvisited, visited, hover and active states for links.
19
+ ///
20
+ /// If you use this mixin in a component you must also include the
21
+ /// govuk-link-common mixin in order to get the focus state.
22
+ ///
23
+ /// @example scss
24
+ /// .govuk-component__link {
25
+ /// @include govuk-link-common;
26
+ /// @include govuk-link-style-muted;
27
+ /// }
28
+ ///
29
+ /// @access public
30
+
31
+ @mixin govuk-link-style-default {
32
+ &:link {
33
+ color: $govuk-link-colour;
34
+ }
35
+
36
+ &:visited {
37
+ color: $govuk-link-visited-colour;
38
+ }
39
+
40
+ &:hover {
41
+ color: $govuk-link-hover-colour;
42
+ }
43
+
44
+ &:active {
45
+ color: $govuk-link-active-colour;
46
+ }
47
+ }
48
+
49
+ /// Muted style link mixin
50
+ ///
51
+ /// Used for secondary links on a page - the link will appear in muted colours
52
+ /// regardless of visited state.
53
+ ///
54
+ /// If you use this mixin in a component you must also include the
55
+ /// govuk-link-common mixin in order to get the focus state.
56
+ ///
57
+ /// @example scss
58
+ /// .govuk-component__link {
59
+ /// @include govuk-link-common;
60
+ /// @include govuk-link-style-muted;
61
+ /// }
62
+ ///
63
+ /// @access public
64
+
65
+ @mixin govuk-link-style-muted {
66
+ &:link,
67
+ &:visited,
68
+ &:hover,
69
+ &:active {
70
+ color: $govuk-secondary-text-colour;
71
+ }
72
+
73
+ // When focussed, the text colour needs to be darker to ensure that colour
74
+ // contrast is still acceptable
75
+ &:focus {
76
+ color: $govuk-text-colour;
77
+ }
78
+
79
+ // alphagov/govuk_template includes a specific a:link:focus selector designed
80
+ // to make unvisited links a slightly darker blue when focussed, so we need to
81
+ // override the text colour for that combination of selectors.
82
+ @include govuk-compatibility(govuk_template) {
83
+ &:link:focus {
84
+ @include govuk-text-colour;
85
+ }
86
+ }
87
+ }
88
+
89
+ /// Text style link mixin
90
+ ///
91
+ /// Overrides the colour of links to match the text colour. Generally used by
92
+ /// navigation components, such as breadcrumbs or the back link.
93
+ ///
94
+ /// If you use this mixin in a component you must also include the
95
+ /// govuk-link-common mixin in order to get the focus state.
96
+ ///
97
+ /// @example scss
98
+ /// .govuk-component__link {
99
+ /// @include govuk-link-common;
100
+ /// @include govuk-link-style-text;
101
+ /// }
102
+ ///
103
+ /// @access public
104
+
105
+ @mixin govuk-link-style-text {
106
+ // Override link colour to use text colour
107
+ &:link,
108
+ &:visited,
109
+ &:hover,
110
+ &:active,
111
+ &:focus {
112
+ @include govuk-text-colour;
113
+ }
114
+
115
+ // alphagov/govuk_template includes a specific a:link:focus selector designed
116
+ // to make unvisited links a slightly darker blue when focussed, so we need to
117
+ // override the text colour for that combination of selectors.
118
+ @include govuk-compatibility(govuk_template) {
119
+ &:link:focus {
120
+ @include govuk-text-colour;
121
+ }
122
+ }
123
+ }
124
+
125
+ /// Print friendly link mixin
126
+ ///
127
+ /// When printing, append the the destination URL to the link text, as long
128
+ /// as the URL starts with either `/`, `http://` or `https://`.
129
+ ///
130
+ /// @access public
131
+
132
+ @mixin govuk-link-print-friendly {
133
+ @include govuk-media-query($media-type: print) {
134
+
135
+ &[href^="/"],
136
+ &[href^="http://"],
137
+ &[href^="https://"] {
138
+ &::after {
139
+ content: " (" attr(href) ")";
140
+ font-size: 90%;
141
+
142
+ // Because the URLs may be very long, ensure that they may be broken
143
+ // at arbitrary points if there are no otherwise acceptable break
144
+ // points in the line
145
+ word-wrap: break-word;
146
+ }
147
+ }
148
+ }
149
+ }
@@ -0,0 +1,95 @@
1
+ ////
2
+ /// @group helpers
3
+ ////
4
+
5
+
6
+
7
+ // =========================================================
8
+ // Wrangle sass-mq config...
9
+ // =========================================================
10
+
11
+ // Pass our breakpoints and static breakpoint definitions through to sass-mq.
12
+ $mq-breakpoints: if(variable-exists(govuk-breakpoints), $govuk-breakpoints, ());
13
+ $mq-static-breakpoint: if(variable-exists(govuk-ie8-breakpoint), $govuk-ie8-breakpoint, desktop);
14
+
15
+ $mq-show-breakpoints: ();
16
+
17
+ @if (variable-exists(govuk-show-breakpoints) and $govuk-show-breakpoints) {
18
+ $mq-show-breakpoints: map-keys($govuk-breakpoints);
19
+ }
20
+
21
+ // When building a stylesheet for IE8, set $mq-responsive to false in order to
22
+ // 'rasterize' any media queries.
23
+
24
+ $mq-responsive: true;
25
+ @if (variable-exists(govuk-is-ie8) and $govuk-is-ie8) {
26
+ $mq-responsive: false;
27
+ }
28
+
29
+ // This is a horrible, horrible hack to prevent the 'dev mode' CSS to display
30
+ // the current breakpoint from being included multiple times.
31
+ //
32
+ // We can't use the `exports` mixin for this because import directives cannot be
33
+ // used within control directives 😠
34
+ $sass-mq-already-included: false !default;
35
+
36
+ @if $sass-mq-already-included {
37
+ $mq-show-breakpoints: ();
38
+ }
39
+
40
+ @import "../vendor/sass-mq";
41
+
42
+ $sass-mq-already-included: true;
43
+
44
+
45
+
46
+ // =========================================================
47
+ // Helpers
48
+ // =========================================================
49
+
50
+ /// Media Query
51
+ ///
52
+ /// This is a currently a wrapper for sass-mq - abstracted so that we can
53
+ /// replace it in the future if we so choose.
54
+ ///
55
+ /// @param {String | Boolean} $from [false] - One of $govuk-breakpoints
56
+ /// @param {String | Boolean} $until [false] - One of $govuk-breakpoints
57
+ /// @param {String | Boolean} $and [false] - Additional media query parameters
58
+ /// @param {String} $media-type [all] - Media type: screen, print…
59
+ ///
60
+ /// @ignore Undocumented mq API, for advanced use only:
61
+ /// @ignore @param {Map} $breakpoints [$govuk-breakpoints]
62
+ /// @ignore @param {String} $static-breakpoint [$govuk-ie8-breakpoint]
63
+ /// @ignore @param {Boolean} $responsive [$govuk-is-ie8]
64
+ ///
65
+ /// @content styling rules, wrapped into a @media query when $responsive is true
66
+ ///
67
+ /// @example scss
68
+ /// .element {
69
+ /// @include govuk-media-query($from: mobile) {
70
+ /// color: red;
71
+ /// }
72
+ /// @include govuk-media-query($until: tablet) {
73
+ /// color: blue;
74
+ /// }
75
+ /// @include govuk-media-query(mobile, tablet) {
76
+ /// color: green;
77
+ /// }
78
+ /// @include govuk-media-query($from: tablet, $and: '(orientation: landscape)') {
79
+ /// color: teal;
80
+ /// }
81
+ /// @include govuk-media-query(950px) {
82
+ /// color: hotpink;
83
+ /// }
84
+ /// @include govuk-media-query(tablet, $media-type: screen) {
85
+ /// color: hotpink;
86
+ /// }
87
+ /// }
88
+ ///
89
+ /// @access public
90
+
91
+ @mixin govuk-media-query($args...) {
92
+ @include mq($args...) {
93
+ @content;
94
+ };
95
+ }
@@ -0,0 +1,80 @@
1
+ ////
2
+ /// @group helpers
3
+ ////
4
+
5
+ /// Calculate the height of an equilateral triangle
6
+ ///
7
+ /// Multiplying half the length of the base of an equilateral triangle by the
8
+ /// square root of three gives us its height. We use 1.732 as an approximation.
9
+ ///
10
+ /// @param {Number} $base - Length of the base of the triangle
11
+ /// @return {Number} Calculated height of the triangle
12
+ /// @access private
13
+
14
+ @function _govuk-equilateral-height($base) {
15
+ $square-root-of-three: 1.732;
16
+
17
+ @return ($base / 2) * $square-root-of-three;
18
+ }
19
+
20
+ /// Arrow mixin
21
+ ///
22
+ /// Generate Arrows (triangles) by using a mix of transparent (1) and coloured
23
+ /// borders. The coloured borders inherit the text colour of the element (2).
24
+ ///
25
+ /// Ensure the arrow is rendered correctly if browser colours are overridden by
26
+ /// providing a clip path (3). Without this the transparent borders are
27
+ /// overridden to become visible which results in a square.
28
+ ///
29
+ /// We need both because older browsers do not support clip-path.
30
+ ///
31
+ /// @param {String} $direction - Direction for arrow: up, right, down, left.
32
+ /// @param {Number} $base - Length of the triangle 'base' side
33
+ /// @param {Number} $height [null] - Height of triangle. Omit for equilateral.
34
+ /// @param {String} $display [block] - CSS display property of the arrow
35
+ ///
36
+ /// @access public
37
+
38
+ @mixin govuk-shape-arrow($direction, $base, $height: null, $display: block) {
39
+ display: $display;
40
+
41
+ width: 0;
42
+ height: 0;
43
+
44
+ border-style: solid;
45
+ border-color: transparent; // 1
46
+
47
+ $perpendicular: $base / 2;
48
+
49
+ @if ($height == null) {
50
+ $height: _govuk-equilateral-height($base);
51
+ }
52
+
53
+ @if $direction == "up" {
54
+ -webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
55
+ clip-path: polygon(50% 0%, 0% 100%, 100% 100%); // 3
56
+
57
+ border-width: 0 $perpendicular $height $perpendicular;
58
+ border-bottom-color: inherit; // 2
59
+ } @else if $direction == "right" {
60
+ -webkit-clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
61
+ clip-path: polygon(0% 0%, 100% 50%, 0% 100%); // 3
62
+
63
+ border-width: $perpendicular 0 $perpendicular $height;
64
+ border-left-color: inherit; // 2
65
+ } @else if $direction == "down" {
66
+ -webkit-clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
67
+ clip-path: polygon(0% 0%, 50% 100%, 100% 0%); // 3
68
+
69
+ border-width: $height $perpendicular 0 $perpendicular;
70
+ border-top-color: inherit; // 2
71
+ } @else if $direction == "left" {
72
+ -webkit-clip-path: polygon(0% 50%, 100% 100%, 100% 0%);
73
+ clip-path: polygon(0% 50%, 100% 100%, 100% 0%); // 3
74
+
75
+ border-width: $perpendicular $height $perpendicular 0;
76
+ border-right-color: inherit; // 2
77
+ } @else {
78
+ @error "Invalid arrow direction: expected `up`, `right`, `down` or `left`, got `#{$direction}`";
79
+ }
80
+ }
@@ -0,0 +1,152 @@
1
+ ////
2
+ /// @group helpers
3
+ ////
4
+
5
+ /// Single point spacing
6
+ ///
7
+ /// Returns measurement corresponding to the spacing point requested.
8
+ ///
9
+ /// @param {Number} $spacing-point - Point on the spacing scale (set in `settings/_spacing.sccs`)
10
+ ///
11
+ /// @returns {String} Spacing Measurement eg. 10px
12
+ ///
13
+ /// @example scss
14
+ /// .element {
15
+ /// padding: govuk-spacing(5);
16
+ /// top: govuk-spacing(2) !important; // if `!important` is required
17
+ /// }
18
+ /// @access public
19
+
20
+ @function govuk-spacing($spacing-point) {
21
+
22
+ $actual-input-type: type-of($spacing-point);
23
+ @if $actual-input-type != "number" {
24
+ @error "Expected a number (integer), but got a "
25
+ + "#{$actual-input-type}.";
26
+ }
27
+
28
+ @if not map-has-key($govuk-spacing-points, $spacing-point) {
29
+ @error "Unknown spacing variable `#{$spacing-point}`. Make sure you are using a point from the spacing scale in `_settings/spacing.scss`.";
30
+ }
31
+
32
+ @return map-get($govuk-spacing-points, $spacing-point);
33
+ }
34
+
35
+ /// Responsive spacing
36
+ ///
37
+ /// Adds responsive spacing (either padding or margin, depending on `$property`)
38
+ /// by fetching a 'spacing map' from the responsive spacing scale, which defines
39
+ /// different spacing values at different breakpoints.
40
+ ///
41
+ /// To generate responsive spacing, use 'govuk-responsive-margin' or
42
+ /// 'govuk-responsive-padding' mixins
43
+ ///
44
+ /// @param {Number} $responsive-spacing-point - Point on the responsive spacing
45
+ /// scale, corresponds to a map of breakpoints and spacing values
46
+ /// @param {String} $property - Property to add spacing to (e.g. 'margin')
47
+ /// @param {String} $direction [all] - Direction to add spacing to
48
+ /// (`top`, `right`, `bottom`, `left`, `all`)
49
+ /// @param {Boolean} $important [false] - Whether to mark as `!important`
50
+ /// @param {Number} $adjustment [false] - Offset to adjust spacing by
51
+ ///
52
+ /// @access private
53
+
54
+ @mixin _govuk-responsive-spacing($responsive-spacing-point, $property, $direction: "all", $important: false, $adjustment: false) {
55
+
56
+ $actual-input-type: type-of($responsive-spacing-point);
57
+ @if $actual-input-type != "number" {
58
+ @error "Expected a number (integer), but got a " + "#{$actual-input-type}.";
59
+ }
60
+
61
+ @if not map-has-key($govuk-spacing-responsive-scale, $responsive-spacing-point) {
62
+ @error "Unknown spacing point `#{$responsive-spacing-point}`. Make sure you are using a point from the "
63
+ + "responsive spacing scale in `_settings/spacing.scss`.";
64
+ }
65
+
66
+ // Make sure that the return value from `_settings/spacing.scss` is a map.
67
+ $scale-map: map-get($govuk-spacing-responsive-scale, $responsive-spacing-point);
68
+ $actual-map-type: type-of($scale-map);
69
+ @if $actual-map-type != "map" {
70
+ @error "Expected a number (integer), but got a "
71
+ + "#{$actual-map-type}. Make sure you are using a map to set the responsive spacing in `_settings/spacing.scss`)";
72
+ }
73
+
74
+ // Loop through each breakpoint in the map
75
+ @each $breakpoint, $breakpoint-value in $scale-map {
76
+
77
+ @if ($adjustment) {
78
+ $breakpoint-value: $breakpoint-value + $adjustment;
79
+ }
80
+
81
+ // The 'null' breakpoint is for mobile.
82
+ @if $breakpoint == null {
83
+
84
+ @if $direction == all {
85
+ #{$property}: $breakpoint-value iff($important, !important);
86
+ } @else {
87
+ #{$property}-#{$direction}: $breakpoint-value iff($important, !important);
88
+ }
89
+ } @else {
90
+ @include govuk-media-query($from: $breakpoint) {
91
+ @if $direction == all {
92
+ #{$property}: $breakpoint-value iff($important, !important);
93
+ } @else {
94
+ #{$property}-#{$direction}: $breakpoint-value iff($important, !important);
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ /// Responsive margin
102
+ ///
103
+ /// Adds responsive margin by fetching a 'spacing map' from the responsive
104
+ /// spacing scale, which defines different spacing values at different
105
+ /// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.
106
+ ///
107
+ /// @see {mixin} _govuk-responsive-spacing
108
+ ///
109
+ /// @param {Number} $responsive-spacing-point - Point on the responsive spacing
110
+ /// scale, corresponds to a map of breakpoints and spacing values
111
+ /// @param {String} $direction [all] - Direction to add spacing to
112
+ /// (`top`, `right`, `bottom`, `left`, `all`)
113
+ /// @param {Boolean} $important [false] - Whether to mark as `!important`
114
+ /// @param {Number} $adjustment [false] - Offset to adjust spacing by
115
+ ///
116
+ /// @example scss
117
+ /// .element {
118
+ /// @include govuk-responsive-margin(6, "left", $adjustment: 1px);
119
+ /// }
120
+ ///
121
+ /// @access public
122
+
123
+ @mixin govuk-responsive-margin($responsive-spacing-point, $direction: "all", $important: false, $adjustment: false) {
124
+ @include _govuk-responsive-spacing($responsive-spacing-point, "margin", $direction, $important, $adjustment);
125
+ }
126
+
127
+ /// Responsive padding
128
+ ///
129
+ /// Adds responsive padding by fetching a 'spacing map' from the responsive
130
+ /// spacing scale, which defines different spacing values at different
131
+ /// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.
132
+ ///
133
+ /// @see {mixin} _govuk-responsive-spacing
134
+ ///
135
+ /// @param {Number} $responsive-spacing-point - Point on the responsive spacing
136
+ /// scale, corresponds to a map of breakpoints and spacing values
137
+ /// @param {String} $direction [all] - Direction to add spacing to
138
+ /// (`top`, `right`, `bottom`, `left`, `all`)
139
+ /// @param {Boolean} $important [false] - Whether to mark as `!important`
140
+ /// @param {Number} $adjustment [false] - Offset to adjust spacing
141
+ ///
142
+ /// @example scss
143
+ /// .element {
144
+ /// @include govuk-responsive-padding(6, "left", $adjustment: 1px);
145
+ /// }
146
+ ///
147
+ /// @access public
148
+
149
+
150
+ @mixin govuk-responsive-padding($responsive-spacing-point, $direction: "all", $important: false, $adjustment: false) {
151
+ @include _govuk-responsive-spacing($responsive-spacing-point, "padding", $direction, $important, $adjustment);
152
+ }