dxw_govuk_frontend_rails 3.3.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gempush.yml +2 -2
  3. data/.github/workflows/test.yml +19 -0
  4. data/Gemfile.lock +3 -3
  5. data/dxw_govuk_frontend_rails.gemspec +1 -1
  6. data/lib/dxw_govuk_frontend_rails.rb +12 -1
  7. data/lib/dxw_govuk_frontend_rails/version.rb +1 -1
  8. data/package-lock.json +3 -3
  9. data/package.json +1 -1
  10. data/vendor/assets/javascripts/govuk_frontend_rails.js +41 -68
  11. data/vendor/assets/stylesheets/_base.scss +3 -0
  12. data/vendor/assets/stylesheets/all.scss +1 -3
  13. data/vendor/assets/stylesheets/components/_all.scss +31 -29
  14. data/vendor/assets/stylesheets/components/accordion/_accordion.scss +2 -208
  15. data/vendor/assets/stylesheets/components/accordion/_index.scss +207 -0
  16. data/vendor/assets/stylesheets/components/back-link/_back-link.scss +2 -62
  17. data/vendor/assets/stylesheets/components/back-link/_index.scss +112 -0
  18. data/vendor/assets/stylesheets/components/breadcrumbs/_breadcrumbs.scss +2 -118
  19. data/vendor/assets/stylesheets/components/breadcrumbs/_index.scss +138 -0
  20. data/vendor/assets/stylesheets/components/button/_button.scss +2 -290
  21. data/vendor/assets/stylesheets/components/button/_index.scss +280 -0
  22. data/vendor/assets/stylesheets/components/character-count/_character-count.scss +2 -31
  23. data/vendor/assets/stylesheets/components/character-count/_index.scss +28 -0
  24. data/vendor/assets/stylesheets/components/checkboxes/_checkboxes.scss +2 -308
  25. data/vendor/assets/stylesheets/components/checkboxes/_index.scss +304 -0
  26. data/vendor/assets/stylesheets/components/date-input/_date-input.scss +2 -30
  27. data/vendor/assets/stylesheets/components/date-input/_index.scss +26 -0
  28. data/vendor/assets/stylesheets/components/details/_details.scss +2 -88
  29. data/vendor/assets/stylesheets/components/details/_index.scss +84 -0
  30. data/vendor/assets/stylesheets/components/error-message/_error-message.scss +2 -15
  31. data/vendor/assets/stylesheets/components/error-message/_index.scss +11 -0
  32. data/vendor/assets/stylesheets/components/error-summary/_error-summary.scss +2 -59
  33. data/vendor/assets/stylesheets/components/error-summary/_index.scss +55 -0
  34. data/vendor/assets/stylesheets/components/fieldset/_fieldset.scss +2 -68
  35. data/vendor/assets/stylesheets/components/fieldset/_index.scss +64 -0
  36. data/vendor/assets/stylesheets/components/file-upload/_file-upload.scss +2 -81
  37. data/vendor/assets/stylesheets/components/file-upload/_index.scss +77 -0
  38. data/vendor/assets/stylesheets/components/footer/_footer.scss +2 -269
  39. data/vendor/assets/stylesheets/components/footer/_index.scss +238 -0
  40. data/vendor/assets/stylesheets/components/header/_header.scss +2 -318
  41. data/vendor/assets/stylesheets/components/header/_index.scss +312 -0
  42. data/vendor/assets/stylesheets/components/hint/_hint.scss +2 -50
  43. data/vendor/assets/stylesheets/components/hint/_index.scss +46 -0
  44. data/vendor/assets/stylesheets/components/input/_index.scss +99 -0
  45. data/vendor/assets/stylesheets/components/input/_input.scss +2 -103
  46. data/vendor/assets/stylesheets/components/inset-text/_index.scss +24 -0
  47. data/vendor/assets/stylesheets/components/inset-text/_inset-text.scss +2 -28
  48. data/vendor/assets/stylesheets/components/label/_index.scss +41 -0
  49. data/vendor/assets/stylesheets/components/label/_label.scss +2 -45
  50. data/vendor/assets/stylesheets/components/panel/_index.scss +40 -0
  51. data/vendor/assets/stylesheets/components/panel/_panel.scss +2 -44
  52. data/vendor/assets/stylesheets/components/phase-banner/_index.scss +27 -0
  53. data/vendor/assets/stylesheets/components/phase-banner/_phase-banner.scss +2 -31
  54. data/vendor/assets/stylesheets/components/radios/_index.scss +342 -0
  55. data/vendor/assets/stylesheets/components/radios/_radios.scss +2 -346
  56. data/vendor/assets/stylesheets/components/select/_index.scss +53 -0
  57. data/vendor/assets/stylesheets/components/select/_select.scss +2 -57
  58. data/vendor/assets/stylesheets/components/skip-link/_index.scss +33 -0
  59. data/vendor/assets/stylesheets/components/skip-link/_skip-link.scss +2 -31
  60. data/vendor/assets/stylesheets/components/summary-list/_index.scss +153 -0
  61. data/vendor/assets/stylesheets/components/summary-list/_summary-list.scss +2 -157
  62. data/vendor/assets/stylesheets/components/table/_index.scss +50 -0
  63. data/vendor/assets/stylesheets/components/table/_table.scss +2 -54
  64. data/vendor/assets/stylesheets/components/tabs/_index.scss +138 -0
  65. data/vendor/assets/stylesheets/components/tabs/_tabs.scss +2 -142
  66. data/vendor/assets/stylesheets/components/tag/_index.scss +87 -0
  67. data/vendor/assets/stylesheets/components/tag/_tag.scss +2 -44
  68. data/vendor/assets/stylesheets/components/textarea/_index.scss +51 -0
  69. data/vendor/assets/stylesheets/components/textarea/_textarea.scss +2 -55
  70. data/vendor/assets/stylesheets/components/warning-text/_index.scss +56 -0
  71. data/vendor/assets/stylesheets/components/warning-text/_warning-text.scss +2 -60
  72. data/vendor/assets/stylesheets/core/_global-styles.scss +5 -3
  73. data/vendor/assets/stylesheets/core/_links.scss +5 -3
  74. data/vendor/assets/stylesheets/core/_lists.scss +17 -3
  75. data/vendor/assets/stylesheets/core/_section-break.scss +5 -3
  76. data/vendor/assets/stylesheets/core/_template.scss +5 -3
  77. data/vendor/assets/stylesheets/core/_typography.scss +5 -3
  78. data/vendor/assets/stylesheets/helpers/_clearfix.scss +1 -1
  79. data/vendor/assets/stylesheets/helpers/_focused.scss +1 -1
  80. data/vendor/assets/stylesheets/helpers/_grid.scss +2 -1
  81. data/vendor/assets/stylesheets/helpers/_links.scss +1 -1
  82. data/vendor/assets/stylesheets/helpers/_media-queries.scss +1 -1
  83. data/vendor/assets/stylesheets/helpers/_shape-arrow.scss +1 -1
  84. data/vendor/assets/stylesheets/helpers/_spacing.scss +5 -5
  85. data/vendor/assets/stylesheets/helpers/_typography.scss +6 -6
  86. data/vendor/assets/stylesheets/helpers/_visually-hidden.scss +30 -30
  87. data/vendor/assets/stylesheets/objects/_form-group.scss +1 -3
  88. data/vendor/assets/stylesheets/objects/_grid.scss +1 -3
  89. data/vendor/assets/stylesheets/objects/_main-wrapper.scss +5 -3
  90. data/vendor/assets/stylesheets/objects/_width-container.scss +34 -13
  91. data/vendor/assets/stylesheets/overrides/_display.scss +11 -3
  92. data/vendor/assets/stylesheets/overrides/_spacing.scss +5 -3
  93. data/vendor/assets/stylesheets/overrides/_typography.scss +5 -3
  94. data/vendor/assets/stylesheets/overrides/_width.scss +5 -3
  95. data/vendor/assets/stylesheets/settings/_colours-palette.scss +1 -1
  96. data/vendor/assets/stylesheets/settings/_ie8.scss +1 -1
  97. data/vendor/assets/stylesheets/tools/_compatibility.scss +1 -1
  98. data/vendor/assets/stylesheets/tools/_font-url.scss +1 -1
  99. data/vendor/assets/stylesheets/tools/_ie8.scss +1 -1
  100. data/vendor/assets/stylesheets/tools/_iff.scss +3 -1
  101. data/vendor/assets/stylesheets/tools/_image-url.scss +1 -1
  102. data/vendor/assets/stylesheets/tools/_px-to-em.scss +1 -1
  103. data/vendor/assets/stylesheets/tools/_px-to-rem.scss +1 -1
  104. metadata +36 -5
@@ -0,0 +1,138 @@
1
+ @include govuk-exports("govuk/component/breadcrumbs") {
2
+
3
+ // Size of chevron (excluding border)
4
+ $chevron-size: 7px;
5
+
6
+ // Size of chevron border
7
+ $chevron-border-width: 1px;
8
+
9
+ // Colour of chevron
10
+ $chevron-border-colour: $govuk-secondary-text-colour;
11
+
12
+ // Calculated altitude (△↕) of the right-angled isosceles chevron with sides
13
+ // of length 8 (7px + 1px border):
14
+ //
15
+ // √(8² + 8²) * 0.5 ≅ 5.655
16
+ $chevron-altitude-calculated: 5.655px;
17
+
18
+ .govuk-breadcrumbs {
19
+ @include govuk-font($size: 16);
20
+ @include govuk-text-colour;
21
+
22
+ margin-top: govuk-spacing(3);
23
+ margin-bottom: govuk-spacing(2);
24
+ }
25
+
26
+ .govuk-breadcrumbs__list {
27
+ @include govuk-clearfix;
28
+
29
+ margin: 0;
30
+ padding: 0;
31
+ list-style-type: none;
32
+ }
33
+
34
+ .govuk-breadcrumbs__list-item {
35
+
36
+ display: inline-block;
37
+ position: relative;
38
+
39
+ margin-bottom: govuk-spacing(1);
40
+
41
+ // Add both margin and padding such that the chevron appears centrally
42
+ // between each breadcrumb item
43
+ margin-left: govuk-spacing(2);
44
+ padding-left: govuk-spacing(2) + $chevron-altitude-calculated;
45
+
46
+ float: left;
47
+
48
+ // Create a chevron using a box with borders on two sides, rotated 45deg.
49
+ &:before {
50
+ content: "";
51
+ display: block;
52
+
53
+ position: absolute;
54
+
55
+ @if $govuk-use-legacy-font {
56
+ // Begin adjustments for font baseline offset
57
+ // These should be removed when legacy font support is dropped
58
+ top: -1px;
59
+ bottom: 1px;
60
+
61
+ } @else {
62
+ top: 0;
63
+ bottom: 0;
64
+ }
65
+
66
+ // Offset by the difference between the width of the non-rotated square
67
+ // and its width when rotated
68
+ left: (($chevron-altitude-calculated * -2) + $chevron-size + $chevron-border-width);
69
+
70
+ width: $chevron-size;
71
+ height: $chevron-size;
72
+
73
+ margin: auto 0;
74
+
75
+ -webkit-transform: rotate(45deg);
76
+
77
+ -ms-transform: rotate(45deg);
78
+
79
+ transform: rotate(45deg);
80
+
81
+ border: solid;
82
+ border-width: $chevron-border-width $chevron-border-width 0 0;
83
+ border-color: $chevron-border-colour;
84
+
85
+ // Fall back to a greater than sign for IE8
86
+ @include govuk-if-ie8 {
87
+ content: "\003e"; // Greater than sign (>)
88
+ width: auto;
89
+ height: auto;
90
+ border: 0;
91
+ color: $chevron-border-colour;
92
+
93
+ // IE8 doesn't seem to like rendering pseudo-elements using @font-faces,
94
+ // so fall back to using another sans-serif font to render the chevron.
95
+ font-family: Arial, sans-serif;
96
+ }
97
+ }
98
+
99
+ &:first-child {
100
+ margin-left: 0;
101
+ padding-left: 0;
102
+
103
+ &:before {
104
+ content: none;
105
+ display: none;
106
+ }
107
+ }
108
+ }
109
+
110
+ .govuk-breadcrumbs__link {
111
+ @include govuk-link-common;
112
+ @include govuk-link-style-text;
113
+ }
114
+
115
+ .govuk-breadcrumbs--collapse-on-mobile {
116
+ @include govuk-media-query($until: tablet) {
117
+ .govuk-breadcrumbs__list-item {
118
+ display: none;
119
+
120
+ &:first-child,
121
+ &:last-child {
122
+ display: inline-block;
123
+ }
124
+
125
+ &:before {
126
+ top: 6px;
127
+ margin: 0;
128
+ }
129
+ }
130
+
131
+ .govuk-breadcrumbs__list {
132
+ display: -webkit-box;
133
+ display: -ms-flexbox;
134
+ display: flex;
135
+ }
136
+ }
137
+ }
138
+ }
@@ -1,290 +1,2 @@
1
- @import "../../settings/all";
2
- @import "../../tools/all";
3
- @import "../../helpers/all";
4
-
5
- @include govuk-exports("govuk/component/button") {
6
- $govuk-button-colour: govuk-colour("green", $legacy: #00823b); // sass-lint:disable no-color-literals
7
- $govuk-button-hover-colour: govuk-shade($govuk-button-colour, 20%);
8
- $govuk-button-shadow-colour: govuk-shade($govuk-button-colour, 60%);
9
- $govuk-button-text-colour: govuk-colour("white");
10
-
11
- // Secondary button variables
12
- $govuk-secondary-button-colour: govuk-colour("light-grey", $legacy: "grey-3");
13
- $govuk-secondary-button-hover-colour: govuk-shade($govuk-secondary-button-colour, 10%);
14
- $govuk-secondary-button-shadow-colour: govuk-shade($govuk-secondary-button-colour, 40%);
15
- $govuk-secondary-button-text-colour: govuk-colour("black");
16
-
17
- // Warning button variables
18
- $govuk-warning-button-colour: govuk-colour("red");
19
- $govuk-warning-button-hover-colour: govuk-shade($govuk-warning-button-colour, 20%);
20
- $govuk-warning-button-shadow-colour: govuk-shade($govuk-warning-button-colour, 60%);
21
- $govuk-warning-button-text-colour: govuk-colour("white");
22
-
23
- // Because the shadow (s0) is visually 'part of' the button, we need to reduce
24
- // the height of the button to compensate by adjusting its padding (s1) and
25
- // increase the bottom margin to include it (s2).
26
- $button-shadow-size: $govuk-border-width-form-element;
27
-
28
- .govuk-button {
29
- @include govuk-font($size: 19, $line-height: 19px);
30
-
31
- box-sizing: border-box;
32
- display: inline-block;
33
- position: relative;
34
- width: 100%;
35
- margin-top: 0;
36
- @include govuk-responsive-margin(6, "bottom", $adjustment: $button-shadow-size); // s2
37
- padding: (govuk-spacing(2) - $govuk-border-width-form-element) govuk-spacing(2) (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2)); // s1
38
- border: $govuk-border-width-form-element solid transparent;
39
- border-radius: 0;
40
- color: $govuk-button-text-colour;
41
- background-color: $govuk-button-colour;
42
- box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
43
- text-align: center;
44
- vertical-align: top;
45
- cursor: pointer;
46
- -webkit-appearance: none;
47
-
48
- @include govuk-if-ie8 {
49
- border-bottom: $button-shadow-size solid $govuk-button-shadow-colour;
50
- }
51
-
52
- @include govuk-media-query($from: tablet) {
53
- width: auto;
54
- }
55
-
56
- // Ensure that any global link styles are overridden
57
- &:link,
58
- &:visited,
59
- &:active,
60
- &:hover {
61
- color: $govuk-button-text-colour;
62
- text-decoration: none;
63
- }
64
-
65
- // Fix unwanted button padding in Firefox
66
- &::-moz-focus-inner {
67
- padding: 0;
68
- border: 0;
69
- }
70
-
71
- &:hover {
72
- background-color: $govuk-button-hover-colour;
73
- }
74
-
75
- &:active {
76
- // Bump the button down so it looks like its being pressed in
77
- top: $button-shadow-size;
78
-
79
- @include govuk-if-ie8 {
80
- border-bottom-width: 0;
81
- }
82
- }
83
-
84
- &:focus {
85
- border-color: $govuk-focus-colour;
86
- // When colours are overridden, for example when users have a dark mode,
87
- // backgrounds and box-shadows disappear, so we need to ensure there's a
88
- // transparent outline which will be set to a visible colour.
89
- // Since Internet Explorer 8 does not support box-shadow, we want to force the user-agent outlines
90
- @include govuk-not-ie8 {
91
- outline: $govuk-focus-width solid transparent;
92
- }
93
- // Since Internet Explorer does not support `:not()` we set a clearer focus style to match user-agent outlines.
94
- @include govuk-if-ie8 {
95
- color: $govuk-focus-text-colour;
96
- background-color: $govuk-focus-colour;
97
- }
98
- box-shadow: inset 0 0 0 1px $govuk-focus-colour;
99
- }
100
-
101
- // alphagov/govuk_template includes a specific a:link:focus selector
102
- // designed to make unvisited links a slightly darker blue when focussed, so
103
- // we need to override the text colour for that combination of selectors so
104
- // so that unvisited links styled as buttons do not end up with dark blue
105
- // text when focussed.
106
- @include govuk-compatibility(govuk_template) {
107
- &:link:focus {
108
- color: $govuk-button-text-colour;
109
- }
110
- }
111
-
112
- &:focus:not(:active):not(:hover) {
113
- border-color: $govuk-focus-colour;
114
- color: $govuk-focus-text-colour;
115
- background-color: $govuk-focus-colour;
116
- box-shadow: 0 2px 0 $govuk-focus-text-colour;
117
- }
118
-
119
- // The following adjustments do not work for <input type="button"> as
120
- // non-container elements cannot include pseudo elements (i.e. ::before).
121
-
122
- // Use a pseudo element to expand the click target area to include the
123
- // button's shadow as well, in case users try to click it.
124
- &::before {
125
- content: "";
126
- display: block;
127
-
128
- position: absolute;
129
-
130
- top: -$govuk-border-width-form-element;
131
- right: -$govuk-border-width-form-element;
132
- bottom: -($govuk-border-width-form-element + $button-shadow-size);
133
- left: -$govuk-border-width-form-element;
134
-
135
- background: transparent;
136
- }
137
-
138
- // When the button is active it is shifted down by $button-shadow-size to
139
- // denote a 'pressed' state. If the user happened to click at the very top
140
- // of the button, their mouse is no longer over the button (because it has
141
- // 'moved beneath them') and so the click event is not fired.
142
- //
143
- // This corrects that by shifting the top of the pseudo element so that it
144
- // continues to cover the area that the user originally clicked, which means
145
- // the click event is still fired.
146
- //
147
- // 🎉
148
- &:active::before {
149
- top: -($govuk-border-width-form-element + $button-shadow-size);
150
- }
151
- }
152
-
153
- .govuk-button--disabled,
154
- .govuk-button[disabled="disabled"],
155
- .govuk-button[disabled] {
156
- opacity: (.5);
157
-
158
- &:hover {
159
- background-color: $govuk-button-colour;
160
- cursor: default;
161
- }
162
-
163
- &:focus {
164
- outline: none;
165
- }
166
-
167
- &:active {
168
- top: 0;
169
- box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
170
- @include govuk-if-ie8 {
171
- border-bottom: $button-shadow-size solid $govuk-button-shadow-colour; // s0
172
- }
173
- }
174
- }
175
-
176
- .govuk-button--secondary {
177
- background-color: $govuk-secondary-button-colour;
178
- box-shadow: 0 $button-shadow-size 0 $govuk-secondary-button-shadow-colour;
179
-
180
- &,
181
- &:link,
182
- &:visited,
183
- &:active,
184
- &:hover {
185
- color: $govuk-secondary-button-text-colour;
186
- }
187
-
188
- // alphagov/govuk_template includes a specific a:link:focus selector
189
- // designed to make unvisited links a slightly darker blue when focussed, so
190
- // we need to override the text colour for that combination of selectors so
191
- // so that unvisited links styled as buttons do not end up with dark blue
192
- // text when focussed.
193
- @include govuk-compatibility(govuk_template) {
194
- &:link:focus {
195
- color: $govuk-secondary-button-text-colour;
196
- }
197
- }
198
-
199
- &:hover {
200
- background-color: $govuk-secondary-button-hover-colour;
201
-
202
- &[disabled] {
203
- background-color: $govuk-secondary-button-colour;
204
- }
205
- }
206
- }
207
-
208
- .govuk-button--warning {
209
- background-color: $govuk-warning-button-colour;
210
- box-shadow: 0 $button-shadow-size 0 $govuk-warning-button-shadow-colour;
211
-
212
- &,
213
- &:link,
214
- &:visited,
215
- &:active,
216
- &:hover {
217
- color: $govuk-warning-button-text-colour;
218
- }
219
-
220
- // alphagov/govuk_template includes a specific a:link:focus selector
221
- // designed to make unvisited links a slightly darker blue when focussed, so
222
- // we need to override the text colour for that combination of selectors so
223
- // so that unvisited links styled as buttons do not end up with dark blue
224
- // text when focussed.
225
- @include govuk-compatibility(govuk_template) {
226
- &:link:focus {
227
- color: $govuk-warning-button-text-colour;
228
- }
229
- }
230
-
231
- &:hover {
232
- background-color: $govuk-warning-button-hover-colour;
233
-
234
- &[disabled] {
235
- background-color: $govuk-warning-button-colour;
236
- }
237
- }
238
- }
239
-
240
- .govuk-button--start {
241
- @include govuk-typography-weight-bold;
242
- @include govuk-typography-responsive($size: 24, $override-line-height: 1);
243
-
244
- display: -webkit-inline-box;
245
-
246
- display: -webkit-inline-flex;
247
-
248
- display: -ms-inline-flexbox;
249
-
250
- display: inline-flex;
251
- min-height: auto;
252
-
253
- -webkit-box-pack: center;
254
-
255
- -webkit-justify-content: center;
256
-
257
- -ms-flex-pack: center;
258
-
259
- justify-content: center;
260
- }
261
-
262
- .govuk-button__start-icon {
263
- margin-left: govuk-spacing(1);
264
-
265
- @include govuk-media-query($from: desktop) {
266
- margin-left: govuk-spacing(2);
267
- }
268
- vertical-align: middle;
269
- -webkit-flex-shrink: 0;
270
- -ms-flex-negative: 0;
271
- flex-shrink: 0;
272
- -webkit-align-self: center;
273
- -ms-flex-item-align: center;
274
- align-self: center;
275
- }
276
-
277
- @if $govuk-use-legacy-font {
278
- // Begin adjustments for font baseline offset when using v1 of nta
279
- $offset: 2;
280
-
281
- .govuk-button {
282
- padding-top: (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2) + $offset); // s1
283
- padding-bottom: (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2) - $offset + 1); // s1
284
- }
285
-
286
- .govuk-button__start-icon {
287
- margin-top: -3px;
288
- }
289
- }
290
- }
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,280 @@
1
+ @include govuk-exports("govuk/component/button") {
2
+ $govuk-button-colour: govuk-colour("green", $legacy: #00823b); // sass-lint:disable no-color-literals
3
+ $govuk-button-hover-colour: govuk-shade($govuk-button-colour, 20%);
4
+ $govuk-button-shadow-colour: govuk-shade($govuk-button-colour, 60%);
5
+ $govuk-button-text-colour: govuk-colour("white");
6
+
7
+ // Secondary button variables
8
+ $govuk-secondary-button-colour: govuk-colour("light-grey", $legacy: "grey-3");
9
+ $govuk-secondary-button-hover-colour: govuk-shade($govuk-secondary-button-colour, 10%);
10
+ $govuk-secondary-button-shadow-colour: govuk-shade($govuk-secondary-button-colour, 40%);
11
+ $govuk-secondary-button-text-colour: govuk-colour("black");
12
+
13
+ // Warning button variables
14
+ $govuk-warning-button-colour: govuk-colour("red");
15
+ $govuk-warning-button-hover-colour: govuk-shade($govuk-warning-button-colour, 20%);
16
+ $govuk-warning-button-shadow-colour: govuk-shade($govuk-warning-button-colour, 60%);
17
+ $govuk-warning-button-text-colour: govuk-colour("white");
18
+
19
+ // Because the shadow (s0) is visually 'part of' the button, we need to reduce
20
+ // the height of the button to compensate by adjusting its padding (s1) and
21
+ // increase the bottom margin to include it (s2).
22
+ $button-shadow-size: $govuk-border-width-form-element;
23
+
24
+ .govuk-button {
25
+ @include govuk-font($size: 19, $line-height: 19px);
26
+
27
+ box-sizing: border-box;
28
+ display: inline-block;
29
+ position: relative;
30
+ width: 100%;
31
+ margin-top: 0;
32
+ @include govuk-responsive-margin(6, "bottom", $adjustment: $button-shadow-size); // s2
33
+ padding: (govuk-spacing(2) - $govuk-border-width-form-element) govuk-spacing(2) (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2)); // s1
34
+ border: $govuk-border-width-form-element solid transparent;
35
+ border-radius: 0;
36
+ color: $govuk-button-text-colour;
37
+ background-color: $govuk-button-colour;
38
+ box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
39
+ text-align: center;
40
+ vertical-align: top;
41
+ cursor: pointer;
42
+ -webkit-appearance: none;
43
+
44
+ @include govuk-if-ie8 {
45
+ border-bottom: $button-shadow-size solid $govuk-button-shadow-colour;
46
+ }
47
+
48
+ @include govuk-media-query($from: tablet) {
49
+ width: auto;
50
+ }
51
+
52
+ // Ensure that any global link styles are overridden
53
+ &:link,
54
+ &:visited,
55
+ &:active,
56
+ &:hover {
57
+ color: $govuk-button-text-colour;
58
+ text-decoration: none;
59
+ }
60
+
61
+ // Fix unwanted button padding in Firefox
62
+ &::-moz-focus-inner {
63
+ padding: 0;
64
+ border: 0;
65
+ }
66
+
67
+ &:hover {
68
+ background-color: $govuk-button-hover-colour;
69
+ }
70
+
71
+ &:active {
72
+ // Bump the button down so it looks like its being pressed in
73
+ top: $button-shadow-size;
74
+
75
+ @include govuk-if-ie8 {
76
+ border-bottom-width: 0;
77
+ }
78
+ }
79
+
80
+ &:focus {
81
+ border-color: $govuk-focus-colour;
82
+ // When colours are overridden, for example when users have a dark mode,
83
+ // backgrounds and box-shadows disappear, so we need to ensure there's a
84
+ // transparent outline which will be set to a visible colour.
85
+ // Since Internet Explorer 8 does not support box-shadow, we want to force the user-agent outlines
86
+ @include govuk-not-ie8 {
87
+ outline: $govuk-focus-width solid transparent;
88
+ }
89
+ // Since Internet Explorer does not support `:not()` we set a clearer focus style to match user-agent outlines.
90
+ @include govuk-if-ie8 {
91
+ color: $govuk-focus-text-colour;
92
+ background-color: $govuk-focus-colour;
93
+ }
94
+ box-shadow: inset 0 0 0 1px $govuk-focus-colour;
95
+ }
96
+
97
+ // alphagov/govuk_template includes a specific a:link:focus selector
98
+ // designed to make unvisited links a slightly darker blue when focussed, so
99
+ // we need to override the text colour for that combination of selectors so
100
+ // so that unvisited links styled as buttons do not end up with dark blue
101
+ // text when focussed.
102
+ @include govuk-compatibility(govuk_template) {
103
+ &:link:focus {
104
+ color: $govuk-button-text-colour;
105
+ }
106
+ }
107
+
108
+ &:focus:not(:active):not(:hover) {
109
+ border-color: $govuk-focus-colour;
110
+ color: $govuk-focus-text-colour;
111
+ background-color: $govuk-focus-colour;
112
+ box-shadow: 0 2px 0 $govuk-focus-text-colour;
113
+ }
114
+
115
+ // The following adjustments do not work for <input type="button"> as
116
+ // non-container elements cannot include pseudo elements (i.e. ::before).
117
+
118
+ // Use a pseudo element to expand the click target area to include the
119
+ // button's shadow as well, in case users try to click it.
120
+ &::before {
121
+ content: "";
122
+ display: block;
123
+
124
+ position: absolute;
125
+
126
+ top: -$govuk-border-width-form-element;
127
+ right: -$govuk-border-width-form-element;
128
+ bottom: -($govuk-border-width-form-element + $button-shadow-size);
129
+ left: -$govuk-border-width-form-element;
130
+
131
+ background: transparent;
132
+ }
133
+
134
+ // When the button is active it is shifted down by $button-shadow-size to
135
+ // denote a 'pressed' state. If the user happened to click at the very top
136
+ // of the button, their mouse is no longer over the button (because it has
137
+ // 'moved beneath them') and so the click event is not fired.
138
+ //
139
+ // This corrects that by shifting the top of the pseudo element so that it
140
+ // continues to cover the area that the user originally clicked, which means
141
+ // the click event is still fired.
142
+ //
143
+ // 🎉
144
+ &:active::before {
145
+ top: -($govuk-border-width-form-element + $button-shadow-size);
146
+ }
147
+ }
148
+
149
+ .govuk-button--disabled,
150
+ .govuk-button[disabled="disabled"],
151
+ .govuk-button[disabled] {
152
+ opacity: (.5);
153
+
154
+ &:hover {
155
+ background-color: $govuk-button-colour;
156
+ cursor: default;
157
+ }
158
+
159
+ &:focus {
160
+ outline: none;
161
+ }
162
+
163
+ &:active {
164
+ top: 0;
165
+ box-shadow: 0 $button-shadow-size 0 $govuk-button-shadow-colour; // s0
166
+ @include govuk-if-ie8 {
167
+ border-bottom: $button-shadow-size solid $govuk-button-shadow-colour; // s0
168
+ }
169
+ }
170
+ }
171
+
172
+ .govuk-button--secondary {
173
+ background-color: $govuk-secondary-button-colour;
174
+ box-shadow: 0 $button-shadow-size 0 $govuk-secondary-button-shadow-colour;
175
+
176
+ &,
177
+ &:link,
178
+ &:visited,
179
+ &:active,
180
+ &:hover {
181
+ color: $govuk-secondary-button-text-colour;
182
+ }
183
+
184
+ // alphagov/govuk_template includes a specific a:link:focus selector
185
+ // designed to make unvisited links a slightly darker blue when focussed, so
186
+ // we need to override the text colour for that combination of selectors so
187
+ // so that unvisited links styled as buttons do not end up with dark blue
188
+ // text when focussed.
189
+ @include govuk-compatibility(govuk_template) {
190
+ &:link:focus {
191
+ color: $govuk-secondary-button-text-colour;
192
+ }
193
+ }
194
+
195
+ &:hover {
196
+ background-color: $govuk-secondary-button-hover-colour;
197
+
198
+ &[disabled] {
199
+ background-color: $govuk-secondary-button-colour;
200
+ }
201
+ }
202
+ }
203
+
204
+ .govuk-button--warning {
205
+ background-color: $govuk-warning-button-colour;
206
+ box-shadow: 0 $button-shadow-size 0 $govuk-warning-button-shadow-colour;
207
+
208
+ &,
209
+ &:link,
210
+ &:visited,
211
+ &:active,
212
+ &:hover {
213
+ color: $govuk-warning-button-text-colour;
214
+ }
215
+
216
+ // alphagov/govuk_template includes a specific a:link:focus selector
217
+ // designed to make unvisited links a slightly darker blue when focussed, so
218
+ // we need to override the text colour for that combination of selectors so
219
+ // so that unvisited links styled as buttons do not end up with dark blue
220
+ // text when focussed.
221
+ @include govuk-compatibility(govuk_template) {
222
+ &:link:focus {
223
+ color: $govuk-warning-button-text-colour;
224
+ }
225
+ }
226
+
227
+ &:hover {
228
+ background-color: $govuk-warning-button-hover-colour;
229
+
230
+ &[disabled] {
231
+ background-color: $govuk-warning-button-colour;
232
+ }
233
+ }
234
+ }
235
+
236
+ .govuk-button--start {
237
+ @include govuk-typography-weight-bold;
238
+ @include govuk-typography-responsive($size: 24, $override-line-height: 1);
239
+
240
+ display: -webkit-inline-box;
241
+
242
+ display: -ms-inline-flexbox;
243
+
244
+ display: inline-flex;
245
+ min-height: auto;
246
+
247
+ -webkit-box-pack: center;
248
+
249
+ -ms-flex-pack: center;
250
+
251
+ justify-content: center;
252
+ }
253
+
254
+ .govuk-button__start-icon {
255
+ margin-left: govuk-spacing(1);
256
+
257
+ @include govuk-media-query($from: desktop) {
258
+ margin-left: govuk-spacing(2);
259
+ }
260
+ vertical-align: middle;
261
+ -ms-flex-negative: 0;
262
+ flex-shrink: 0;
263
+ -ms-flex-item-align: center;
264
+ align-self: center;
265
+ }
266
+
267
+ @if $govuk-use-legacy-font {
268
+ // Begin adjustments for font baseline offset when using v1 of nta
269
+ $offset: 2;
270
+
271
+ .govuk-button {
272
+ padding-top: (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2) + $offset); // s1
273
+ padding-bottom: (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2) - $offset + 1); // s1
274
+ }
275
+
276
+ .govuk-button__start-icon {
277
+ margin-top: -3px;
278
+ }
279
+ }
280
+ }