dxw_govuk_frontend_rails 3.3.1 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -0
  3. data/Gemfile.lock +5 -4
  4. data/README.md +45 -42
  5. data/dxw_govuk_frontend_rails.gemspec +1 -1
  6. data/lib/dxw_govuk_frontend_rails/version.rb +1 -1
  7. data/package-lock.json +3 -3
  8. data/package.json +1 -1
  9. data/vendor/assets/javascripts/govuk_frontend_rails.js +194 -118
  10. data/vendor/assets/stylesheets/_base.scss +3 -0
  11. data/vendor/assets/stylesheets/all.scss +1 -3
  12. data/vendor/assets/stylesheets/components/_all.scss +31 -29
  13. data/vendor/assets/stylesheets/components/accordion/_accordion.scss +2 -208
  14. data/vendor/assets/stylesheets/components/accordion/_index.scss +207 -0
  15. data/vendor/assets/stylesheets/components/back-link/_back-link.scss +2 -62
  16. data/vendor/assets/stylesheets/components/back-link/_index.scss +112 -0
  17. data/vendor/assets/stylesheets/components/breadcrumbs/_breadcrumbs.scss +2 -118
  18. data/vendor/assets/stylesheets/components/breadcrumbs/_index.scss +138 -0
  19. data/vendor/assets/stylesheets/components/button/_button.scss +2 -290
  20. data/vendor/assets/stylesheets/components/button/_index.scss +280 -0
  21. data/vendor/assets/stylesheets/components/character-count/_character-count.scss +2 -31
  22. data/vendor/assets/stylesheets/components/character-count/_index.scss +28 -0
  23. data/vendor/assets/stylesheets/components/checkboxes/_checkboxes.scss +2 -308
  24. data/vendor/assets/stylesheets/components/checkboxes/_index.scss +305 -0
  25. data/vendor/assets/stylesheets/components/date-input/_date-input.scss +2 -30
  26. data/vendor/assets/stylesheets/components/date-input/_index.scss +26 -0
  27. data/vendor/assets/stylesheets/components/details/_details.scss +2 -88
  28. data/vendor/assets/stylesheets/components/details/_index.scss +84 -0
  29. data/vendor/assets/stylesheets/components/error-message/_error-message.scss +2 -15
  30. data/vendor/assets/stylesheets/components/error-message/_index.scss +11 -0
  31. data/vendor/assets/stylesheets/components/error-summary/_error-summary.scss +2 -59
  32. data/vendor/assets/stylesheets/components/error-summary/_index.scss +55 -0
  33. data/vendor/assets/stylesheets/components/fieldset/_fieldset.scss +2 -68
  34. data/vendor/assets/stylesheets/components/fieldset/_index.scss +64 -0
  35. data/vendor/assets/stylesheets/components/file-upload/_file-upload.scss +2 -81
  36. data/vendor/assets/stylesheets/components/file-upload/_index.scss +50 -0
  37. data/vendor/assets/stylesheets/components/footer/_footer.scss +2 -269
  38. data/vendor/assets/stylesheets/components/footer/_index.scss +235 -0
  39. data/vendor/assets/stylesheets/components/header/_header.scss +2 -318
  40. data/vendor/assets/stylesheets/components/header/_index.scss +312 -0
  41. data/vendor/assets/stylesheets/components/hint/_hint.scss +2 -50
  42. data/vendor/assets/stylesheets/components/hint/_index.scss +46 -0
  43. data/vendor/assets/stylesheets/components/input/_index.scss +96 -0
  44. data/vendor/assets/stylesheets/components/input/_input.scss +2 -103
  45. data/vendor/assets/stylesheets/components/inset-text/_index.scss +24 -0
  46. data/vendor/assets/stylesheets/components/inset-text/_inset-text.scss +2 -28
  47. data/vendor/assets/stylesheets/components/label/_index.scss +41 -0
  48. data/vendor/assets/stylesheets/components/label/_label.scss +2 -45
  49. data/vendor/assets/stylesheets/components/panel/_index.scss +40 -0
  50. data/vendor/assets/stylesheets/components/panel/_panel.scss +2 -44
  51. data/vendor/assets/stylesheets/components/phase-banner/_index.scss +27 -0
  52. data/vendor/assets/stylesheets/components/phase-banner/_phase-banner.scss +2 -31
  53. data/vendor/assets/stylesheets/components/radios/_index.scss +342 -0
  54. data/vendor/assets/stylesheets/components/radios/_radios.scss +2 -346
  55. data/vendor/assets/stylesheets/components/select/_index.scss +50 -0
  56. data/vendor/assets/stylesheets/components/select/_select.scss +2 -57
  57. data/vendor/assets/stylesheets/components/skip-link/_index.scss +34 -0
  58. data/vendor/assets/stylesheets/components/skip-link/_skip-link.scss +2 -31
  59. data/vendor/assets/stylesheets/components/summary-list/_index.scss +153 -0
  60. data/vendor/assets/stylesheets/components/summary-list/_summary-list.scss +2 -157
  61. data/vendor/assets/stylesheets/components/table/_index.scss +50 -0
  62. data/vendor/assets/stylesheets/components/table/_table.scss +2 -54
  63. data/vendor/assets/stylesheets/components/tabs/_index.scss +138 -0
  64. data/vendor/assets/stylesheets/components/tabs/_tabs.scss +2 -142
  65. data/vendor/assets/stylesheets/components/tag/_index.scss +87 -0
  66. data/vendor/assets/stylesheets/components/tag/_tag.scss +2 -44
  67. data/vendor/assets/stylesheets/components/textarea/_index.scss +48 -0
  68. data/vendor/assets/stylesheets/components/textarea/_textarea.scss +2 -55
  69. data/vendor/assets/stylesheets/components/warning-text/_index.scss +58 -0
  70. data/vendor/assets/stylesheets/components/warning-text/_warning-text.scss +2 -60
  71. data/vendor/assets/stylesheets/core/_global-styles.scss +5 -3
  72. data/vendor/assets/stylesheets/core/_links.scss +5 -3
  73. data/vendor/assets/stylesheets/core/_lists.scss +17 -3
  74. data/vendor/assets/stylesheets/core/_section-break.scss +5 -3
  75. data/vendor/assets/stylesheets/core/_template.scss +5 -3
  76. data/vendor/assets/stylesheets/core/_typography.scss +5 -3
  77. data/vendor/assets/stylesheets/helpers/_clearfix.scss +1 -1
  78. data/vendor/assets/stylesheets/helpers/_colour.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-applied.scss +2 -2
  96. data/vendor/assets/stylesheets/settings/_colours-palette.scss +1 -1
  97. data/vendor/assets/stylesheets/settings/_ie8.scss +1 -1
  98. data/vendor/assets/stylesheets/settings/_measurements.scss +4 -1
  99. data/vendor/assets/stylesheets/tools/_compatibility.scss +1 -1
  100. data/vendor/assets/stylesheets/tools/_font-url.scss +1 -1
  101. data/vendor/assets/stylesheets/tools/_ie8.scss +1 -1
  102. data/vendor/assets/stylesheets/tools/_iff.scss +3 -1
  103. data/vendor/assets/stylesheets/tools/_image-url.scss +1 -1
  104. data/vendor/assets/stylesheets/tools/_px-to-em.scss +1 -1
  105. data/vendor/assets/stylesheets/tools/_px-to-rem.scss +1 -1
  106. metadata +36 -5
@@ -0,0 +1,305 @@
1
+ @import "../error-message/index";
2
+ @import "../fieldset/index";
3
+ @import "../hint/index";
4
+ @import "../label/index";
5
+
6
+ @include govuk-exports("govuk/component/checkboxes") {
7
+
8
+ $govuk-touch-target-size: 44px;
9
+ $govuk-checkboxes-size: 40px;
10
+ $govuk-small-checkboxes-size: 24px;
11
+ $govuk-checkboxes-label-padding-left-right: govuk-spacing(3);
12
+
13
+ .govuk-checkboxes__item {
14
+ @include govuk-font($size: 19);
15
+
16
+ display: block;
17
+ position: relative;
18
+
19
+ min-height: $govuk-checkboxes-size;
20
+
21
+ margin-bottom: govuk-spacing(2);
22
+ padding-left: $govuk-checkboxes-size;
23
+
24
+ clear: left;
25
+ }
26
+
27
+ .govuk-checkboxes__item:last-child,
28
+ .govuk-checkboxes__item:last-of-type {
29
+ margin-bottom: 0;
30
+ }
31
+
32
+ .govuk-checkboxes__input {
33
+ $input-offset: ($govuk-touch-target-size - $govuk-checkboxes-size) / 2;
34
+
35
+ cursor: pointer;
36
+
37
+ // IE8 doesn’t support pseudo-elements, so we don’t want to hide native
38
+ // elements there.
39
+ @include govuk-not-ie8 {
40
+ position: absolute;
41
+
42
+ z-index: 1;
43
+ top: $input-offset * -1;
44
+ left: $input-offset * -1;
45
+
46
+ width: $govuk-touch-target-size;
47
+ height: $govuk-touch-target-size;
48
+ margin: 0;
49
+
50
+ opacity: 0;
51
+ }
52
+
53
+ @include govuk-if-ie8 {
54
+ margin-top: 10px;
55
+ margin-right: $govuk-checkboxes-size / -2;
56
+ margin-left: $govuk-checkboxes-size / -2;
57
+ float: left;
58
+
59
+ // add focus outline to input
60
+ &:focus {
61
+ outline: $govuk-focus-width solid $govuk-focus-colour;
62
+ }
63
+ }
64
+ }
65
+
66
+ .govuk-checkboxes__label {
67
+ display: inline-block;
68
+ margin-bottom: 0;
69
+ padding: 8px $govuk-checkboxes-label-padding-left-right govuk-spacing(1);
70
+ cursor: pointer;
71
+ // remove 300ms pause on mobile
72
+ -ms-touch-action: manipulation;
73
+ touch-action: manipulation;
74
+ }
75
+
76
+ // [ ] Check box
77
+ .govuk-checkboxes__label::before {
78
+ content: "";
79
+ box-sizing: border-box;
80
+ position: absolute;
81
+ top: 0;
82
+ left: 0;
83
+ width: $govuk-checkboxes-size;
84
+ height: $govuk-checkboxes-size;
85
+ border: $govuk-border-width-form-element solid currentColor;
86
+ background: transparent;
87
+ }
88
+
89
+ // ✔ Check mark
90
+ //
91
+ // The check mark is a box with a border on the left and bottom side (└──),
92
+ // rotated 45 degrees
93
+ .govuk-checkboxes__label::after {
94
+ content: "";
95
+ box-sizing: border-box;
96
+
97
+ position: absolute;
98
+ top: 11px;
99
+ left: 9px;
100
+ width: 23px;
101
+ height: 12px;
102
+
103
+ -webkit-transform: rotate(-45deg);
104
+
105
+ -ms-transform: rotate(-45deg);
106
+
107
+ transform: rotate(-45deg);
108
+ border: solid;
109
+ border-width: 0 0 5px 5px;
110
+ // Fix bug in IE11 caused by transform rotate (-45deg).
111
+ // See: alphagov/govuk_elements/issues/518
112
+ border-top-color: transparent;
113
+
114
+ opacity: 0;
115
+
116
+ background: transparent;
117
+ }
118
+
119
+ .govuk-checkboxes__hint {
120
+ display: block;
121
+ padding-right: $govuk-checkboxes-label-padding-left-right;
122
+ padding-left: $govuk-checkboxes-label-padding-left-right;
123
+ }
124
+
125
+ // Focused state
126
+ .govuk-checkboxes__input:focus + .govuk-checkboxes__label::before {
127
+ border-width: 4px;
128
+ box-shadow: 0 0 0 $govuk-focus-width $govuk-focus-colour;
129
+ }
130
+
131
+ // Selected state
132
+ .govuk-checkboxes__input:checked + .govuk-checkboxes__label::after {
133
+ opacity: 1;
134
+ }
135
+
136
+ // Disabled state
137
+ .govuk-checkboxes__input:disabled,
138
+ .govuk-checkboxes__input:disabled + .govuk-checkboxes__label {
139
+ cursor: default;
140
+ }
141
+
142
+ .govuk-checkboxes__input:disabled + .govuk-checkboxes__label {
143
+ opacity: .5;
144
+ }
145
+
146
+ // =========================================================
147
+ // Conditional reveals
148
+ // =========================================================
149
+
150
+ // The narrow border is used in the conditional reveals because the border has
151
+ // to be an even number in order to be centred under the 40px checkbox or radio.
152
+ $conditional-border-width: $govuk-border-width-narrow;
153
+ // Calculate the amount of padding needed to keep the border centered against the checkbox.
154
+ $conditional-border-padding: ($govuk-checkboxes-size / 2) - ($conditional-border-width / 2);
155
+ // Move the border centered with the checkbox
156
+ $conditional-margin-left: $conditional-border-padding;
157
+ // Move the contents of the conditional inline with the label
158
+ $conditional-padding-left: $conditional-border-padding + $govuk-checkboxes-label-padding-left-right;
159
+
160
+ .govuk-checkboxes__conditional {
161
+ @include govuk-responsive-margin(4, "bottom");
162
+ margin-left: $conditional-margin-left;
163
+ padding-left: $conditional-padding-left;
164
+ border-left: $conditional-border-width solid $govuk-border-colour;
165
+
166
+ .js-enabled &--hidden {
167
+ display: none;
168
+ }
169
+
170
+ & > :last-child {
171
+ margin-bottom: 0;
172
+ }
173
+ }
174
+
175
+ // =========================================================
176
+ // Small checkboxes
177
+ // =========================================================
178
+
179
+ .govuk-checkboxes--small {
180
+
181
+ $input-offset: ($govuk-touch-target-size - $govuk-small-checkboxes-size) / 2;
182
+ $label-offset: $govuk-touch-target-size - $input-offset;
183
+
184
+ .govuk-checkboxes__item {
185
+ @include govuk-clearfix;
186
+ min-height: 0;
187
+ margin-bottom: 0;
188
+ padding-left: $label-offset;
189
+ float: left;
190
+ }
191
+
192
+ // Shift the touch target into the left margin so that the visible edge of
193
+ // the control is aligned
194
+ //
195
+ // ┆What colours do you like?
196
+ // ┌┆───┐
197
+ // │┆[] │ Purple
198
+ // └┆▲──┘
199
+ // ▲┆└─ Check box pseudo element, aligned with margin
200
+ // └─── Touch target (invisible input), shifted into the margin
201
+ .govuk-checkboxes__input {
202
+ @include govuk-not-ie8 {
203
+ left: $input-offset * -1;
204
+ }
205
+
206
+ @include govuk-if-ie8 {
207
+ margin-left: $govuk-small-checkboxes-size * -1;
208
+ }
209
+ }
210
+
211
+ // Adjust the size and position of the label.
212
+ //
213
+ // Unlike larger checkboxes, we also have to float the label in order to
214
+ // 'shrink' it, preventing the hover state from kicking in across the full
215
+ // width of the parent element.
216
+ .govuk-checkboxes__label {
217
+ margin-top: -2px;
218
+ padding: 13px govuk-spacing(3) 13px 1px;
219
+ float: left;
220
+
221
+ @include govuk-media-query($from: tablet) {
222
+ padding: 11px govuk-spacing(3) 10px 1px;
223
+ }
224
+ }
225
+
226
+ // [ ] Check box
227
+ //
228
+ // Reduce the size of the check box [1], vertically center it within the
229
+ // touch target [2]
230
+ .govuk-checkboxes__label::before {
231
+ top: $input-offset - $govuk-border-width-form-element; // 2
232
+ width: $govuk-small-checkboxes-size; // 1
233
+ height: $govuk-small-checkboxes-size; // 1
234
+ }
235
+
236
+ // ✔ Check mark
237
+ //
238
+ // Reduce the size of the check mark and re-align within the checkbox
239
+ .govuk-checkboxes__label::after {
240
+ top: 15px;
241
+ left: 6px;
242
+ width: 12px;
243
+ height: 6.5px;
244
+ border-width: 0 0 3px 3px;
245
+ }
246
+
247
+ // Fix position of hint with small checkboxes
248
+ //
249
+ // Do not use hints with small checkboxes – because they're within the input
250
+ // wrapper they trigger the hover state, but clicking them doesn't actually
251
+ // activate the control.
252
+ //
253
+ // (If you do use them, they won't look completely broken... but seriously,
254
+ // don't use them)
255
+ .govuk-checkboxes__hint {
256
+ padding: 0;
257
+ clear: both;
258
+ }
259
+
260
+ // Align conditional reveals with small checkboxes
261
+ .govuk-checkboxes__conditional {
262
+ $margin-left: ($govuk-small-checkboxes-size / 2) - ($conditional-border-width / 2);
263
+ margin-left: $margin-left;
264
+ padding-left: $label-offset - ($margin-left + $conditional-border-width);
265
+ clear: both;
266
+ }
267
+
268
+ // Hover state for small checkboxes.
269
+ //
270
+ // We use a hover state for small checkboxes because the touch target size
271
+ // is so much larger than their visible size, and so we need to provide
272
+ // feedback to the user as to which checkbox they will select when their
273
+ // cursor is outside of the visible area.
274
+ .govuk-checkboxes__item:hover .govuk-checkboxes__input:not(:disabled) + .govuk-checkboxes__label::before {
275
+ box-shadow: 0 0 0 $govuk-hover-width $govuk-hover-colour;
276
+ }
277
+
278
+ // Because we've overridden the border-shadow provided by the focus state,
279
+ // we need to redefine that too.
280
+ //
281
+ // We use two box shadows, one that restores the original focus state [1]
282
+ // and another that then applies the hover state [2].
283
+ .govuk-checkboxes__item:hover .govuk-checkboxes__input:focus + .govuk-checkboxes__label::before {
284
+ // sass-lint:disable indentation
285
+ box-shadow: 0 0 0 $govuk-focus-width $govuk-focus-colour, // 1
286
+ 0 0 0 $govuk-hover-width $govuk-hover-colour; // 2
287
+ }
288
+
289
+ // For devices that explicitly don't support hover, don't provide a hover
290
+ // state (e.g. on touch devices like iOS).
291
+ //
292
+ // We can't use `@media (hover: hover)` because we wouldn't get the hover
293
+ // state in browsers that don't support `@media (hover)` (like Internet
294
+ // Explorer) – so we have to 'undo' the hover state instead.
295
+ @media (hover: none), (pointer: coarse) {
296
+ .govuk-checkboxes__item:hover .govuk-checkboxes__input:not(:disabled) + .govuk-checkboxes__label::before {
297
+ box-shadow: initial;
298
+ }
299
+
300
+ .govuk-checkboxes__item:hover .govuk-checkboxes__input:focus + .govuk-checkboxes__label::before {
301
+ box-shadow: 0 0 0 $govuk-focus-width $govuk-focus-colour;
302
+ }
303
+ }
304
+ }
305
+ }
@@ -1,30 +1,2 @@
1
- @import "../../settings/all";
2
- @import "../../tools/all";
3
- @import "../../helpers/all";
4
-
5
- @import "../error-message/error-message";
6
- @import "../input/input";
7
- @import "../hint/hint";
8
- @import "../label/label";
9
-
10
- @include govuk-exports("govuk/component/date-input") {
11
- .govuk-date-input {
12
- @include govuk-clearfix;
13
- // font-size: 0 removes whitespace caused by inline-block
14
- font-size: 0;
15
- }
16
-
17
- .govuk-date-input__item {
18
- display: inline-block;
19
- margin-right: govuk-spacing(4);
20
- margin-bottom: 0;
21
- }
22
-
23
- .govuk-date-input__label {
24
- display: block;
25
- }
26
-
27
- .govuk-date-input__input {
28
- margin-bottom: 0;
29
- }
30
- }
1
+ @import "../../base";
2
+ @import "./index";
@@ -0,0 +1,26 @@
1
+ @import "../error-message/index";
2
+ @import "../input/index";
3
+ @import "../hint/index";
4
+ @import "../label/index";
5
+
6
+ @include govuk-exports("govuk/component/date-input") {
7
+ .govuk-date-input {
8
+ @include govuk-clearfix;
9
+ // font-size: 0 removes whitespace caused by inline-block
10
+ font-size: 0;
11
+ }
12
+
13
+ .govuk-date-input__item {
14
+ display: inline-block;
15
+ margin-right: govuk-spacing(4);
16
+ margin-bottom: 0;
17
+ }
18
+
19
+ .govuk-date-input__label {
20
+ display: block;
21
+ }
22
+
23
+ .govuk-date-input__input {
24
+ margin-bottom: 0;
25
+ }
26
+ }
@@ -1,88 +1,2 @@
1
- @import "../../settings/all";
2
- @import "../../tools/all";
3
- @import "../../helpers/all";
4
-
5
- @include govuk-exports("govuk/component/details") {
6
-
7
- .govuk-details {
8
- @include govuk-font($size: 19);
9
- @include govuk-text-colour;
10
- @include govuk-responsive-margin(6, "bottom");
11
-
12
- display: block;
13
- }
14
-
15
- .govuk-details__summary {
16
- // Make the focus outline shrink-wrap the text content of the summary
17
- display: inline-block;
18
-
19
- // Absolutely position the marker against this element
20
- position: relative;
21
-
22
- margin-bottom: govuk-spacing(1);
23
-
24
- // Allow for absolutely positioned marker and align with disclosed text
25
- padding-left: govuk-spacing(4) + $govuk-border-width;
26
-
27
- // Style the summary to look like a link...
28
- color: $govuk-link-colour;
29
- cursor: pointer;
30
-
31
- &:hover {
32
- color: $govuk-link-hover-colour;
33
- }
34
-
35
- &:focus {
36
- @include govuk-focused-text;
37
- }
38
- }
39
-
40
- // ...but only underline the text, not the arrow
41
- .govuk-details__summary-text {
42
- text-decoration: underline;
43
- }
44
-
45
- // Remove the underline when focussed to avoid duplicate borders
46
- .govuk-details__summary:focus .govuk-details__summary-text {
47
- text-decoration: none;
48
- }
49
-
50
- // Remove the default details marker so we can style our own consistently and
51
- // ensure it displays in Firefox (see implementation.md for details)
52
- .govuk-details__summary::-webkit-details-marker {
53
- display: none;
54
- }
55
-
56
- // Append our own open / closed marker using a pseudo-element
57
- .govuk-details__summary:before {
58
- content: "";
59
- position: absolute;
60
-
61
- top: -1px;
62
- bottom: 0;
63
- left: 0;
64
-
65
- margin: auto;
66
-
67
- @include govuk-shape-arrow($direction: right, $base: 14px);
68
-
69
- .govuk-details[open] > & {
70
- @include govuk-shape-arrow($direction: down, $base: 14px);
71
- }
72
- }
73
-
74
- .govuk-details__text {
75
- padding: govuk-spacing(3);
76
- padding-left: govuk-spacing(4);
77
- border-left: $govuk-border-width solid $govuk-border-colour;
78
- }
79
-
80
- .govuk-details__text p {
81
- margin-top: 0;
82
- margin-bottom: govuk-spacing(4);
83
- }
84
-
85
- .govuk-details__text > :last-child {
86
- margin-bottom: 0;
87
- }
88
- }
1
+ @import "../../base";
2
+ @import "./index";