dxw_govuk_frontend_rails 2.9.0.pre.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +33 -0
  3. data/.circleci/setup-rubygems.sh +3 -0
  4. data/.gitignore +9 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +91 -0
  9. data/Rakefile +50 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/dxw_govuk_frontend_rails.gemspec +27 -0
  13. data/lib/dxw_govuk_frontend_rails/version.rb +3 -0
  14. data/lib/dxw_govuk_frontend_rails.rb +12 -0
  15. data/package-lock.json +13 -0
  16. data/package.json +26 -0
  17. data/vendor/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
  18. data/vendor/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
  19. data/vendor/assets/fonts/bold-fb2676462a-v1.eot +0 -0
  20. data/vendor/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
  21. data/vendor/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
  22. data/vendor/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
  23. data/vendor/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
  24. data/vendor/assets/fonts/light-458f8ea81c-v1.woff +0 -0
  25. data/vendor/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
  26. data/vendor/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
  27. data/vendor/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
  28. data/vendor/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
  29. data/vendor/assets/images/favicon.ico +0 -0
  30. data/vendor/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
  31. data/vendor/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
  32. data/vendor/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
  33. data/vendor/assets/images/govuk-apple-touch-icon.png +0 -0
  34. data/vendor/assets/images/govuk-crest-2x.png +0 -0
  35. data/vendor/assets/images/govuk-crest.png +0 -0
  36. data/vendor/assets/images/govuk-logotype-crown.png +0 -0
  37. data/vendor/assets/images/govuk-mask-icon.svg +7 -0
  38. data/vendor/assets/images/govuk-opengraph-image.png +0 -0
  39. data/vendor/assets/images/icon-arrow-left.png +0 -0
  40. data/vendor/assets/images/icon-important.png +0 -0
  41. data/vendor/assets/images/icon-pointer-2x.png +0 -0
  42. data/vendor/assets/images/icon-pointer.png +0 -0
  43. data/vendor/assets/javascripts/govuk_frontend_rails.js +2358 -0
  44. data/vendor/assets/stylesheets/all-ie8.scss +6 -0
  45. data/vendor/assets/stylesheets/all.scss +11 -0
  46. data/vendor/assets/stylesheets/components/_all.scss +29 -0
  47. data/vendor/assets/stylesheets/components/accordion/_accordion.scss +188 -0
  48. data/vendor/assets/stylesheets/components/back-link/_back-link.scss +54 -0
  49. data/vendor/assets/stylesheets/components/breadcrumbs/_breadcrumbs.scss +119 -0
  50. data/vendor/assets/stylesheets/components/button/_button.scss +180 -0
  51. data/vendor/assets/stylesheets/components/character-count/_character-count.scss +31 -0
  52. data/vendor/assets/stylesheets/components/checkboxes/_checkboxes.scss +161 -0
  53. data/vendor/assets/stylesheets/components/date-input/_date-input.scss +30 -0
  54. data/vendor/assets/stylesheets/components/details/_details.scss +89 -0
  55. data/vendor/assets/stylesheets/components/error-message/_error-message.scss +15 -0
  56. data/vendor/assets/stylesheets/components/error-summary/_error-summary.scss +72 -0
  57. data/vendor/assets/stylesheets/components/fieldset/_fieldset.scss +60 -0
  58. data/vendor/assets/stylesheets/components/file-upload/_file-upload.scss +19 -0
  59. data/vendor/assets/stylesheets/components/footer/_footer.scss +233 -0
  60. data/vendor/assets/stylesheets/components/header/_header.scss +304 -0
  61. data/vendor/assets/stylesheets/components/hint/_hint.scss +50 -0
  62. data/vendor/assets/stylesheets/components/input/_input.scss +77 -0
  63. data/vendor/assets/stylesheets/components/inset-text/_inset-text.scss +28 -0
  64. data/vendor/assets/stylesheets/components/label/_label.scss +45 -0
  65. data/vendor/assets/stylesheets/components/panel/_panel.scss +44 -0
  66. data/vendor/assets/stylesheets/components/phase-banner/_phase-banner.scss +31 -0
  67. data/vendor/assets/stylesheets/components/radios/_radios.scss +187 -0
  68. data/vendor/assets/stylesheets/components/select/_select.scss +32 -0
  69. data/vendor/assets/stylesheets/components/skip-link/_skip-link.scss +26 -0
  70. data/vendor/assets/stylesheets/components/summary-list/_summary-list.scss +123 -0
  71. data/vendor/assets/stylesheets/components/table/_table.scss +53 -0
  72. data/vendor/assets/stylesheets/components/tabs/_tabs.scss +130 -0
  73. data/vendor/assets/stylesheets/components/tag/_tag.scss +33 -0
  74. data/vendor/assets/stylesheets/components/textarea/_textarea.scss +32 -0
  75. data/vendor/assets/stylesheets/components/warning-text/_warning-text.scss +59 -0
  76. data/vendor/assets/stylesheets/core/_all.scss +6 -0
  77. data/vendor/assets/stylesheets/core/_global-styles.scss +23 -0
  78. data/vendor/assets/stylesheets/core/_links.scss +31 -0
  79. data/vendor/assets/stylesheets/core/_lists.scss +58 -0
  80. data/vendor/assets/stylesheets/core/_section-break.scss +60 -0
  81. data/vendor/assets/stylesheets/core/_template.scss +35 -0
  82. data/vendor/assets/stylesheets/core/_typography.scss +190 -0
  83. data/vendor/assets/stylesheets/govuk-frontend-rails.scss +16 -0
  84. data/vendor/assets/stylesheets/helpers/_all.scss +12 -0
  85. data/vendor/assets/stylesheets/helpers/_clearfix.scss +15 -0
  86. data/vendor/assets/stylesheets/helpers/_colour.scss +51 -0
  87. data/vendor/assets/stylesheets/helpers/_device-pixels.scss +38 -0
  88. data/vendor/assets/stylesheets/helpers/_focusable.scss +34 -0
  89. data/vendor/assets/stylesheets/helpers/_font-faces.scss +67 -0
  90. data/vendor/assets/stylesheets/helpers/_grid.scss +107 -0
  91. data/vendor/assets/stylesheets/helpers/_links.scss +200 -0
  92. data/vendor/assets/stylesheets/helpers/_media-queries.scss +95 -0
  93. data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +80 -0
  94. data/vendor/assets/stylesheets/helpers/_spacing.scss +152 -0
  95. data/vendor/assets/stylesheets/helpers/_typography.scss +188 -0
  96. data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +82 -0
  97. data/vendor/assets/stylesheets/objects/_all.scss +4 -0
  98. data/vendor/assets/stylesheets/objects/_form-group.scss +25 -0
  99. data/vendor/assets/stylesheets/objects/_grid.scss +27 -0
  100. data/vendor/assets/stylesheets/objects/_main-wrapper.scss +53 -0
  101. data/vendor/assets/stylesheets/objects/_width-container.scss +63 -0
  102. data/vendor/assets/stylesheets/overrides/_all.scss +4 -0
  103. data/vendor/assets/stylesheets/overrides/_display.scss +18 -0
  104. data/vendor/assets/stylesheets/overrides/_spacing.scss +62 -0
  105. data/vendor/assets/stylesheets/overrides/_typography.scss +25 -0
  106. data/vendor/assets/stylesheets/overrides/_width.scss +49 -0
  107. data/vendor/assets/stylesheets/settings/_all.scss +21 -0
  108. data/vendor/assets/stylesheets/settings/_assets.scss +82 -0
  109. data/vendor/assets/stylesheets/settings/_colours-applied.scss +140 -0
  110. data/vendor/assets/stylesheets/settings/_colours-organisations.scss +136 -0
  111. data/vendor/assets/stylesheets/settings/_colours-palette.scss +37 -0
  112. data/vendor/assets/stylesheets/settings/_compatibility.scss +51 -0
  113. data/vendor/assets/stylesheets/settings/_global-styles.scss +13 -0
  114. data/vendor/assets/stylesheets/settings/_ie8.scss +18 -0
  115. data/vendor/assets/stylesheets/settings/_measurements.scss +99 -0
  116. data/vendor/assets/stylesheets/settings/_media-queries.scss +23 -0
  117. data/vendor/assets/stylesheets/settings/_spacing.scss +80 -0
  118. data/vendor/assets/stylesheets/settings/_typography-font-families.scss +22 -0
  119. data/vendor/assets/stylesheets/settings/_typography-font.scss +60 -0
  120. data/vendor/assets/stylesheets/settings/_typography-responsive.scss +180 -0
  121. data/vendor/assets/stylesheets/tools/_all.scss +8 -0
  122. data/vendor/assets/stylesheets/tools/_compatibility.scss +36 -0
  123. data/vendor/assets/stylesheets/tools/_exports.scss +33 -0
  124. data/vendor/assets/stylesheets/tools/_font-url.scss +28 -0
  125. data/vendor/assets/stylesheets/tools/_ie8.scss +51 -0
  126. data/vendor/assets/stylesheets/tools/_iff.scss +15 -0
  127. data/vendor/assets/stylesheets/tools/_image-url.scss +28 -0
  128. data/vendor/assets/stylesheets/tools/_px-to-em.scss +20 -0
  129. data/vendor/assets/stylesheets/tools/_px-to-rem.scss +20 -0
  130. data/vendor/assets/stylesheets/utilities/_all.scss +2 -0
  131. data/vendor/assets/stylesheets/utilities/_clearfix.scss +5 -0
  132. data/vendor/assets/stylesheets/utilities/_visually-hidden.scss +10 -0
  133. data/vendor/assets/stylesheets/vendor/_sass-mq.scss +351 -0
  134. metadata +204 -0
@@ -0,0 +1,22 @@
1
+ ////
2
+ /// @group settings/typography
3
+ ////
4
+
5
+ /// List of font families to use if using NTA (the default font 'stack' for
6
+ /// GOV.UK)
7
+ ///
8
+ /// @type List
9
+ /// @access public
10
+
11
+ $govuk-font-family-nta: "nta", Arial, sans-serif;
12
+
13
+ /// List of font families to use if using the 'tabular numbers' subset of NTA
14
+ /// (the default font 'stack' for GOV.UK)
15
+ ///
16
+ /// Because ntatabularnumbers only includes the digits 0-10, all other glyphs
17
+ /// will 'fall-through' the stack to NTA.
18
+ ///
19
+ /// @type List
20
+ /// @access public
21
+
22
+ $govuk-font-family-nta-tabular: "ntatabularnumbers", $govuk-font-family-nta;
@@ -0,0 +1,60 @@
1
+ ////
2
+ /// @group settings/typography
3
+ ////
4
+
5
+
6
+
7
+ // =========================================================
8
+ // Font families
9
+ // =========================================================
10
+
11
+ /// Font families to use for all typography on screen media
12
+ ///
13
+ /// @type List
14
+ /// @access public
15
+
16
+ $govuk-font-family: $govuk-font-family-nta !default;
17
+
18
+ /// Font families to use when displaying tabular numbers
19
+ ///
20
+ /// @type List
21
+ /// @access public
22
+
23
+ $govuk-font-family-tabular: $govuk-font-family-nta-tabular !default;
24
+
25
+ /// Font families to use for print media
26
+ ///
27
+ /// @type List
28
+ /// @access public
29
+
30
+ $govuk-font-family-print: sans-serif !default;
31
+
32
+ /// Include the default @font-face declarations
33
+ ///
34
+ /// If you have set $govuk-font-family to something other than $govuk-font-family-nta this option is disabled by default.
35
+ ///
36
+ /// If you are using $govuk-compatibility-govuktemplate this option is disabled by default.
37
+ ///
38
+ /// @type Boolean
39
+ /// @access public
40
+
41
+ $govuk-include-default-font-face: (
42
+ $govuk-font-family == $govuk-font-family-nta and
43
+ not($govuk-compatibility-govuktemplate)
44
+ ) !default;
45
+
46
+ // =========================================================
47
+ // Font weights
48
+ // =========================================================
49
+
50
+ /// Font weight for regular typography
51
+ ///
52
+ /// @type Number
53
+ /// @access public
54
+ $govuk-font-weight-regular: 400 !default;
55
+
56
+ /// Font weight for bold typography
57
+ ///
58
+ /// @type Number
59
+ /// @access public
60
+ $govuk-font-weight-bold: 700 !default;
@@ -0,0 +1,180 @@
1
+ ////
2
+ /// @group settings/typography
3
+ ////
4
+
5
+ /// Whether or not to define font sizes in rem, improving accessibility by
6
+ /// allowing users to adjust the base font-size. This is currently off by
7
+ /// default, but will be enabled by default for projects that do not use
8
+ /// alphagov/govuk_template in the next major release.
9
+ ///
10
+ /// If this is enabled, you should make sure that $govuk-root-font-size is set
11
+ /// correctly for your project
12
+ ///
13
+ /// If any of the compatibility variables are set, then default
14
+ /// responsive typography to off.
15
+ ///
16
+ /// @type Boolean
17
+ /// @access public
18
+
19
+ $govuk-typography-use-rem: if((
20
+ $govuk-compatibility-govukfrontendtoolkit or
21
+ $govuk-compatibility-govuktemplate or
22
+ $govuk-compatibility-govukelements
23
+ ), false, true) !default;
24
+
25
+ /// Root font size
26
+ ///
27
+ /// This is used to calculate rem sizes for the typography, and should match the
28
+ /// _effective_ font-size of your root (or html) element.
29
+ ///
30
+ /// Ideally you should not be setting the font-size on the html or root element
31
+ /// in order to allow it to scale with user-preference, in which case this
32
+ /// should be set to 16px.
33
+ ///
34
+ /// If you are integrating Frontend into an existing project that also uses
35
+ /// alphagov/govuk_template then you should set this to 10px to match the 62.5%
36
+ /// (10px) base font size that govuk_template sets on the <html> element.
37
+ ///
38
+ /// @type Number
39
+ /// @access public
40
+
41
+ $govuk-root-font-size: 16px !default;
42
+
43
+ /// Responsive typography font map
44
+ ///
45
+ /// This is used to generate responsive typography that adapts according to the
46
+ /// breakpoints.
47
+ ///
48
+ /// Font size and font weight can be defined for each breakpoint. You can define
49
+ /// different behaviour on tablet and desktop. The 'null' breakpoint is for
50
+ /// mobile.
51
+ ///
52
+ /// Line-heights will automatically be converted from pixel measurements into
53
+ /// relative values. For example, with a font-size of 16px and a line-height of
54
+ /// 24px, the line-height will be converted to 1.5 before output.
55
+ ///
56
+ /// You can also specify a separate font size and line height for print media.
57
+ ///
58
+ /// @type Map
59
+ ///
60
+ /// @prop {Number} $point.$breakpoint.font-size - Font size for `$point` at `$breakpoint`
61
+ /// @prop {Number} $point.$breakpoint.line-height - Line height for `$point` at `$breakpoint`
62
+ /// @prop {Number} $point.print.font-size - Font size for `$point` when printing
63
+ /// @prop {Number} $point.print.line-height - Line height for `$point` when printing
64
+ ///
65
+ /// @access public
66
+
67
+ $govuk-typography-scale: (
68
+ 80: (
69
+ null: (
70
+ font-size: 53px,
71
+ line-height: 55px
72
+ ),
73
+ tablet: (
74
+ font-size: 80px,
75
+ line-height: 80px
76
+ ),
77
+ print: (
78
+ font-size: 53pt,
79
+ line-height: 1.1
80
+ )
81
+ ),
82
+ 48: (
83
+ null: (
84
+ font-size: 32px,
85
+ line-height: 35px
86
+ ),
87
+ tablet: (
88
+ font-size: 48px,
89
+ line-height: 50px
90
+ ),
91
+ print: (
92
+ font-size: 32pt,
93
+ line-height: 1.15
94
+ )
95
+ ),
96
+ 36: (
97
+ null: (
98
+ font-size: 24px,
99
+ line-height: 25px
100
+ ),
101
+ tablet: (
102
+ font-size: 36px,
103
+ line-height: 40px
104
+ ),
105
+ print: (
106
+ font-size: 24pt,
107
+ line-height: 1.05
108
+ )
109
+ ),
110
+ 27: (
111
+ null: (
112
+ font-size: 18px,
113
+ line-height: 20px
114
+ ),
115
+ tablet: (
116
+ font-size: 27px,
117
+ line-height: 30px
118
+ ),
119
+ print: (
120
+ font-size: 18pt,
121
+ line-height: 1.15
122
+ )
123
+ ),
124
+ 24: (
125
+ null: (
126
+ font-size: 18px,
127
+ line-height: 20px
128
+ ),
129
+ tablet: (
130
+ font-size: 24px,
131
+ line-height: 30px
132
+ ),
133
+ print: (
134
+ font-size: 18pt,
135
+ line-height: 1.15
136
+ )
137
+ ),
138
+ 19: (
139
+ null: (
140
+ font-size: 16px,
141
+ line-height: 20px
142
+ ),
143
+ tablet: (
144
+ font-size: 19px,
145
+ line-height: 25px
146
+ ),
147
+ print: (
148
+ font-size: 14pt,
149
+ line-height: 1.15
150
+ )
151
+ ),
152
+ 16: (
153
+ null: (
154
+ font-size: 14px,
155
+ line-height: 16px
156
+ ),
157
+ tablet: (
158
+ font-size: 16px,
159
+ line-height: 20px
160
+ ),
161
+ print: (
162
+ font-size: 14pt,
163
+ line-height: 1.2
164
+ )
165
+ ),
166
+ 14: (
167
+ null: (
168
+ font-size: 12px,
169
+ line-height: 15px
170
+ ),
171
+ tablet: (
172
+ font-size: 14px,
173
+ line-height: 20px
174
+ ),
175
+ print: (
176
+ font-size: 12pt,
177
+ line-height: 1.2
178
+ )
179
+ )
180
+ ) !default;
@@ -0,0 +1,8 @@
1
+ @import "compatibility";
2
+ @import "exports";
3
+ @import "font-url";
4
+ @import "ie8";
5
+ @import "iff";
6
+ @import "image-url";
7
+ @import "px-to-em";
8
+ @import "px-to-rem";
@@ -0,0 +1,36 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ /// Conditional Compatibility Mixin
6
+ ///
7
+ /// Selectively output a block (available to the mixin as @content) if a given
8
+ /// $product is also identified as being used in the project.
9
+ ///
10
+ /// This can then be used to include styles that are only needed to override
11
+ /// styles provided by those other products (e.g. where govuk_template has a
12
+ /// very specific link selector that otherwise affects buttons).
13
+ ///
14
+ /// @example scss
15
+ /// // Override .my-class if GOV.UK Template is also being used
16
+ /// @include govuk-compatibility(govuk_template) {
17
+ /// .my-class {
18
+ /// color: inherit;
19
+ /// }
20
+ /// }
21
+ ///
22
+ /// @param {String} $product - Name of product that we are 'defending' against.
23
+ /// @content Passed content is outputted only if Frontend is being used with
24
+ /// this product
25
+ /// @throw Errors if product name is not recognised
26
+ /// @access public
27
+
28
+ @mixin govuk-compatibility($product) {
29
+ @if map-has-key($_govuk-compatibility, $product) {
30
+ @if map-get($_govuk-compatibility, $product) == true {
31
+ @content;
32
+ }
33
+ } @else {
34
+ @error "Non existent product '#{$product}'";
35
+ }
36
+ }
@@ -0,0 +1,33 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ /// List of modules which have already been exported
6
+ ///
7
+ /// @type List
8
+ /// @access private
9
+
10
+ $_govuk-imported-modules: () !default;
11
+
12
+ /// Export module
13
+ ///
14
+ /// Ensure that the modules of CSS that we define throughout Frontend are only
15
+ /// included in the generated CSS once, no matter how many times they are
16
+ /// imported across the individual components.
17
+ ///
18
+ /// @param {String} $name - Name of module - must be unique within the codebase
19
+ /// @content The passed content will only be outputted if a module of the same
20
+ /// $name has not already been outputted
21
+ /// @access public
22
+
23
+ @mixin govuk-exports($name) {
24
+ // If the mixin is not in the list of modules already exported...
25
+ @if (index($_govuk-imported-modules, $name) == null) {
26
+ // ... then add it to the list
27
+ $_govuk-imported-modules: append($_govuk-imported-modules, $name) !global;
28
+ // ... and output the CSS for that module
29
+ @content;
30
+ }
31
+ // The next time exports is called for the module of the same name, it will be
32
+ // found in the list and so nothing will be outputted.
33
+ }
@@ -0,0 +1,28 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ // Disable indentation linting in this file only
6
+ // sass-lint:disable indentation
7
+
8
+ /// Font URL
9
+ ///
10
+ /// If a custom font-url handler is defined ($govuk-font-url-function) then
11
+ /// it will be called, otherwise a url will be returned with the filename
12
+ /// appended to the font path.
13
+ ///
14
+ /// @param {String} $filename - Font filename
15
+ /// @return {String} URL for the filename, wrapped in `url()`
16
+ /// @access public
17
+
18
+ @function govuk-font-url($filename) {
19
+ $use-custom-function: variable-exists("govuk-font-url-function")
20
+ and $govuk-font-url-function
21
+ and function-exists($govuk-font-url-function);
22
+
23
+ @if ($use-custom-function) {
24
+ @return call(get-function($govuk-font-url-function), $filename);
25
+ } @else {
26
+ @return url($govuk-fonts-path + $filename);
27
+ }
28
+ }
@@ -0,0 +1,51 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ /// Conditionally include rules only for IE8
6
+ ///
7
+ /// @content Passed content is only outputted if we're compiling a stylesheet
8
+ /// that targets IE8 (if `$govuk-is-ie8` is true)
9
+ ///
10
+ /// @example scss - Usage
11
+ ///
12
+ /// .foo {
13
+ /// min-width: 100px;
14
+ /// // Specify width for IE8 only
15
+ /// @include govuk-if-ie8 {
16
+ /// width: 100px;
17
+ /// }
18
+ /// }
19
+ ///
20
+ /// @access public
21
+
22
+ @mixin govuk-if-ie8 {
23
+ @if $govuk-is-ie8 {
24
+ @content;
25
+ }
26
+ }
27
+
28
+ /// Conditionally exclude rules for IE8
29
+ ///
30
+ /// @content Passed content is only outputted if we're not compiling a
31
+ /// stylesheet that targets IE8 (if `$govuk-is-ie8` is false)
32
+ ///
33
+ /// @example scss - Usage
34
+ ///
35
+ /// .foo {
36
+ /// font-weight: bold;
37
+ ///
38
+ /// // Enhance foo only for modern browsers (not IE8)
39
+ /// @include govuk-not-ie8 {
40
+ /// font-family: "Comic Sans MS", "Curlz MT" cursive, sans-serif;
41
+ /// color: #FF69B4;
42
+ /// }
43
+ /// }
44
+ ///
45
+ /// @access public
46
+
47
+ @mixin govuk-not-ie8 {
48
+ @if not $govuk-is-ie8 {
49
+ @content;
50
+ }
51
+ }
@@ -0,0 +1,15 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ /// Syntactic sugar around Sass' built-in `if` function that does not require
6
+ /// you to pass a value for `$if-false`.
7
+ ///
8
+ /// @param {Boolean} $condition - Whether to return the value of `$if-true`
9
+ /// @param {Mixed} $if-true - Value to return if `$condition` is truthy
10
+ /// @return {Mixed} Value of `$if-true` if `$condition` is truthy, else null
11
+ /// @access public
12
+
13
+ @function iff($condition, $if-true) {
14
+ @return if($condition, $if-true, null);
15
+ }
@@ -0,0 +1,28 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ // Disable indentation linting in this file only
6
+ // sass-lint:disable indentation
7
+
8
+ /// Image URL
9
+ ///
10
+ /// If a custom image-url handler is defined ($govuk-image-url-function) then
11
+ /// it will be called, otherwise a url will be returned with the filename
12
+ /// appended to the image path.
13
+ ///
14
+ /// @param {String} Filename for the image to load
15
+ /// @return {String} URL for the filename, wrapped in `url()`
16
+ /// @access public
17
+
18
+ @function govuk-image-url($filename) {
19
+ $use-custom-function: variable-exists("govuk-image-url-function")
20
+ and $govuk-image-url-function
21
+ and function-exists($govuk-image-url-function);
22
+
23
+ @if ($use-custom-function) {
24
+ @return call(get-function($govuk-image-url-function), $filename);
25
+ } @else {
26
+ @return url($govuk-images-path + $filename);
27
+ }
28
+ }
@@ -0,0 +1,20 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ /// Convert pixels to em
6
+ ///
7
+ /// @param {Number} $value - Length in pixels
8
+ /// @param {Number} $context-font-size - Font size of element
9
+ /// @return {Number} Length in ems
10
+ /// @access public
11
+
12
+ @function govuk-em($value, $context-font-size) {
13
+ @if (unitless($value)) {
14
+ $value: $value * 1px;
15
+ }
16
+ @if (unitless($context-font-size)) {
17
+ $context-font-size: $context-font-size * 1px;
18
+ }
19
+ @return $value / $context-font-size * 1em;
20
+ }
@@ -0,0 +1,20 @@
1
+ ////
2
+ /// @group tools
3
+ ////
4
+
5
+ /// Convert pixels to rem
6
+ ///
7
+ /// The $govuk-root-font-size (defined in settings/_typography-responsive.scss)
8
+ /// must be configured to match the font-size of your root (html) element
9
+ ///
10
+ /// @param {Number} $value - Length in pixels
11
+ /// @return {Number} Length in rems
12
+ /// @access public
13
+
14
+ @function govuk-px-to-rem($value) {
15
+ @if (unitless($value)) {
16
+ $value: $value * 1px;
17
+ }
18
+
19
+ @return $value / $govuk-root-font-size * 1rem;
20
+ }
@@ -0,0 +1,2 @@
1
+ @import "clearfix";
2
+ @import "visually-hidden";
@@ -0,0 +1,5 @@
1
+ @include govuk-exports("govuk/utilities/clearfix") {
2
+ .govuk-clearfix {
3
+ @include govuk-clearfix;
4
+ }
5
+ }
@@ -0,0 +1,10 @@
1
+ @include govuk-exports("govuk/utilities/visually-hidden") {
2
+ .govuk-visually-hidden {
3
+ @include govuk-visually-hidden;
4
+ }
5
+
6
+ .govuk-visually-hidden-focusable {
7
+ @include govuk-visually-hidden-focusable;
8
+ }
9
+
10
+ }