govuk_tech_docs 5.2.2 → 6.0.0.beta
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +15 -0
- data/README.md +11 -3
- data/example/config/tech-docs.yml +1 -1
- data/govuk_tech_docs.gemspec +1 -1
- data/lib/assets/stylesheets/_core.scss +1 -0
- data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -15
- data/lib/assets/stylesheets/modules/_app-pane.scss +3 -3
- data/lib/assets/stylesheets/modules/_page-review.scss +4 -4
- data/lib/assets/stylesheets/modules/_search.scss +3 -3
- data/lib/assets/stylesheets/modules/_service-navigation.scss +5 -0
- data/lib/assets/stylesheets/modules/_technical-documentation.scss +7 -7
- data/lib/assets/stylesheets/modules/_toc.scss +13 -13
- data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +9 -7
- data/lib/govuk_tech_docs/meta_tags.rb +1 -1
- data/lib/govuk_tech_docs/version.rb +1 -1
- data/lib/source/layouts/_header.erb +2 -16
- data/lib/source/layouts/_service_navigation.erb +27 -0
- data/lib/source/layouts/core.erb +7 -7
- data/node_modules/govuk-frontend/dist/govuk/_base.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +87 -229
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +88 -229
- data/node_modules/govuk-frontend/dist/govuk/all.mjs +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.svg +1 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-180.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-192.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-512.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +18 -15
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +18 -21
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +20 -135
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +20 -135
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +19 -9
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -5
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +6 -4
- data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +30 -38
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +35 -6
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +30 -27
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +89 -449
- data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +14 -20
- data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +10 -8
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +12 -11
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +12 -6
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +8 -7
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +6 -11
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +55 -76
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +30 -2
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +30 -2
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +30 -2
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +7 -2
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +25 -21
- data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +7 -8
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +9 -6
- data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +66 -31
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +5 -10
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +5 -4
- data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +0 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +6 -20
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_breakpoints.scss +17 -0
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +15 -0
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +17 -0
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_index.scss +5 -0
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +168 -82
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +41 -6
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +24 -40
- data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
- data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +6 -30
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +1 -2
- data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_form-group.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +3 -7
- data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +0 -2
- data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +3 -188
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +366 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +9 -255
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-palette.scss +117 -25
- data/node_modules/govuk-frontend/dist/govuk/settings/_custom-properties.scss +18 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +3 -14
- data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +0 -9
- data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +12 -189
- data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +0 -1
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +2 -0
- data/package-lock.json +3228 -4
- data/package.json +1 -1
- metadata +10 -26
- data/node_modules/govuk-frontend/dist/govuk/all.scss +0 -9
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +0 -1
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +0 -39
- data/node_modules/govuk-frontend/dist/govuk/components/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +0 -238
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -230
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +0 -89
- data/node_modules/govuk-frontend/dist/govuk/core/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +0 -15
- data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss +0 -9
- data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +0 -65
- data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss +0 -10
- data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
- data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +0 -25
|
@@ -76,25 +76,25 @@
|
|
|
76
76
|
|
|
77
77
|
@mixin govuk-link-style-default {
|
|
78
78
|
&:link {
|
|
79
|
-
color:
|
|
79
|
+
color: govuk-functional-colour(link);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
&:visited {
|
|
83
|
-
color:
|
|
83
|
+
color: govuk-functional-colour(link-visited);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
&:hover {
|
|
87
|
-
color:
|
|
87
|
+
color: govuk-functional-colour(link-hover);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
&:active {
|
|
91
|
-
color:
|
|
91
|
+
color: govuk-functional-colour(link-active);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// When focussed, the text colour needs to be darker to ensure that colour
|
|
95
95
|
// contrast is still acceptable
|
|
96
96
|
&:focus {
|
|
97
|
-
color:
|
|
97
|
+
color: govuk-functional-colour(focus-text);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -117,21 +117,21 @@
|
|
|
117
117
|
@mixin govuk-link-style-error {
|
|
118
118
|
&:link,
|
|
119
119
|
&:visited {
|
|
120
|
-
color:
|
|
120
|
+
color: govuk-functional-colour(error);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
&:hover {
|
|
124
|
-
color:
|
|
124
|
+
color: govuk-colour("red", $variant: "shade-50");
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
&:active {
|
|
128
|
-
color:
|
|
128
|
+
color: govuk-functional-colour(error);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// When focussed, the text colour needs to be darker to ensure that colour
|
|
132
132
|
// contrast is still acceptable
|
|
133
133
|
&:focus {
|
|
134
|
-
color:
|
|
134
|
+
color: govuk-functional-colour(focus-text);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -154,21 +154,21 @@
|
|
|
154
154
|
@mixin govuk-link-style-success {
|
|
155
155
|
&:link,
|
|
156
156
|
&:visited {
|
|
157
|
-
color:
|
|
157
|
+
color: govuk-functional-colour(success);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
&:hover {
|
|
161
|
-
color:
|
|
161
|
+
color: govuk-colour("green", $variant: "shade-50");
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
&:active {
|
|
165
|
-
color:
|
|
165
|
+
color: govuk-functional-colour(success);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
// When focussed, the text colour needs to be darker to ensure that colour
|
|
169
169
|
// contrast is still acceptable
|
|
170
170
|
&:focus {
|
|
171
|
-
color:
|
|
171
|
+
color: govuk-functional-colour(focus-text);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -191,18 +191,18 @@
|
|
|
191
191
|
@mixin govuk-link-style-muted {
|
|
192
192
|
&:link,
|
|
193
193
|
&:visited {
|
|
194
|
-
color:
|
|
194
|
+
color: govuk-functional-colour(secondary-text);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
&:hover,
|
|
198
198
|
&:active {
|
|
199
|
-
color:
|
|
199
|
+
color: govuk-functional-colour(text);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
// When focussed, the text colour needs to be darker to ensure that colour
|
|
203
203
|
// contrast is still acceptable
|
|
204
204
|
&:focus {
|
|
205
|
-
color:
|
|
205
|
+
color: govuk-functional-colour(focus-text);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -228,14 +228,6 @@
|
|
|
228
228
|
@include govuk-text-colour;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
// Force a colour change on hover to work around a bug in Safari
|
|
232
|
-
// https://webkit.org/b/224483
|
|
233
|
-
&:hover {
|
|
234
|
-
@if type-of($govuk-text-colour) == color {
|
|
235
|
-
color: rgba($govuk-text-colour, 0.99);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
231
|
&:active,
|
|
240
232
|
&:focus {
|
|
241
233
|
@include govuk-text-colour;
|
|
@@ -264,15 +256,8 @@
|
|
|
264
256
|
color: govuk-colour("white");
|
|
265
257
|
}
|
|
266
258
|
|
|
267
|
-
// Force a colour change on hover to work around a bug in Safari
|
|
268
|
-
// https://webkit.org/b/224483
|
|
269
|
-
&:hover,
|
|
270
|
-
&:active {
|
|
271
|
-
color: rgba(govuk-colour("white"), 0.99);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
259
|
&:focus {
|
|
275
|
-
color:
|
|
260
|
+
color: govuk-functional-colour(focus-text);
|
|
276
261
|
}
|
|
277
262
|
}
|
|
278
263
|
|
|
@@ -298,25 +283,25 @@
|
|
|
298
283
|
|
|
299
284
|
@mixin govuk-link-style-no-visited-state {
|
|
300
285
|
&:link {
|
|
301
|
-
color:
|
|
286
|
+
color: govuk-functional-colour(link);
|
|
302
287
|
}
|
|
303
288
|
|
|
304
289
|
&:visited {
|
|
305
|
-
color:
|
|
290
|
+
color: govuk-functional-colour(link);
|
|
306
291
|
}
|
|
307
292
|
|
|
308
293
|
&:hover {
|
|
309
|
-
color:
|
|
294
|
+
color: govuk-functional-colour(link-hover);
|
|
310
295
|
}
|
|
311
296
|
|
|
312
297
|
&:active {
|
|
313
|
-
color:
|
|
298
|
+
color: govuk-functional-colour(link-active);
|
|
314
299
|
}
|
|
315
300
|
|
|
316
301
|
// When focussed, the text colour needs to be darker to ensure that colour
|
|
317
302
|
// contrast is still acceptable
|
|
318
303
|
&:focus {
|
|
319
|
-
color:
|
|
304
|
+
color: govuk-functional-colour(focus-text);
|
|
320
305
|
}
|
|
321
306
|
}
|
|
322
307
|
|
|
@@ -348,11 +333,10 @@
|
|
|
348
333
|
/// @access public
|
|
349
334
|
|
|
350
335
|
@mixin govuk-link-print-friendly {
|
|
351
|
-
@
|
|
336
|
+
@media print {
|
|
352
337
|
&[href^="/"],
|
|
353
338
|
&[href^="http://"],
|
|
354
|
-
&[href^="https://"]
|
|
355
|
-
{
|
|
339
|
+
&[href^="https://"] {
|
|
356
340
|
&::after {
|
|
357
341
|
content: " (" attr(href) ")";
|
|
358
342
|
font-size: 90%;
|
|
@@ -2,52 +2,168 @@
|
|
|
2
2
|
/// @group helpers/layout
|
|
3
3
|
////
|
|
4
4
|
|
|
5
|
+
@import "../settings/media-queries";
|
|
6
|
+
@import "../tools/px-to-em";
|
|
7
|
+
|
|
5
8
|
// =========================================================
|
|
6
|
-
//
|
|
9
|
+
// Helpers
|
|
7
10
|
// =========================================================
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
/// Get the value of a breakpoint by name.
|
|
13
|
+
///
|
|
14
|
+
/// @param {String | Number} $value - If a string, the name of a breakpoint
|
|
15
|
+
/// in $breakpoints. If a number without units, it will convert to px. If a
|
|
16
|
+
/// number with units, it will return the value unaltered.
|
|
17
|
+
/// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $value.
|
|
18
|
+
/// @returns {Number} - The set (minimum) value of the breakpoint
|
|
19
|
+
///
|
|
20
|
+
/// @example scss
|
|
21
|
+
/// .element {
|
|
22
|
+
/// width: govuk-breakpoint-value(tablet);
|
|
23
|
+
/// @media (min-width: #{govuk-breakpoint-value(desktop)}) {
|
|
24
|
+
/// color: red;
|
|
25
|
+
/// }
|
|
26
|
+
/// @media (min-width: #{govuk-breakpoint-value(400px)}) {
|
|
27
|
+
/// color: green;
|
|
28
|
+
/// }
|
|
29
|
+
/// $custom-breakpoint-map: (
|
|
30
|
+
/// small: 350px,
|
|
31
|
+
/// medium: 769px,
|
|
32
|
+
/// large: 1100px,
|
|
33
|
+
/// extra-large: 1600px
|
|
34
|
+
/// );
|
|
35
|
+
/// @media (orientation: landscape) and (min-width: #{govuk-breakpoint-value(extra-large, $custom-breakpoint-map)}) {
|
|
36
|
+
/// color: blue;
|
|
37
|
+
/// }
|
|
38
|
+
/// }
|
|
39
|
+
///
|
|
40
|
+
/// @access public
|
|
11
41
|
|
|
12
|
-
|
|
42
|
+
@function govuk-breakpoint-value($value, $breakpoints: $govuk-breakpoints) {
|
|
43
|
+
// If $value is a number
|
|
44
|
+
@if type-of($value) == "number" {
|
|
45
|
+
// If the number is unitless, coerce it into a pixel value
|
|
46
|
+
@if unitless($value) {
|
|
47
|
+
$value: $value * 1px;
|
|
48
|
+
}
|
|
13
49
|
|
|
14
|
-
@
|
|
15
|
-
|
|
16
|
-
}
|
|
50
|
+
@return $value;
|
|
51
|
+
}
|
|
17
52
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$sass-mq-already-included: false !default;
|
|
53
|
+
// If $value is a string and exists as a key in in $breakpoints,
|
|
54
|
+
// look up and use the value of it
|
|
55
|
+
@if type-of($value) == "string" and map-has-key($breakpoints, $value) {
|
|
56
|
+
@return map-get($breakpoints, $value);
|
|
57
|
+
}
|
|
24
58
|
|
|
25
|
-
|
|
26
|
-
$
|
|
59
|
+
// If we get this far, we can't use the value, so return an error
|
|
60
|
+
@error "Could not find a breakpoint given `#{$value}`.";
|
|
27
61
|
}
|
|
28
62
|
|
|
29
|
-
|
|
63
|
+
/// Generate the `min-width` segment of a media query given a breakpoint key
|
|
64
|
+
///
|
|
65
|
+
/// Pixel values are converted to ems for backwards compatibility with
|
|
66
|
+
/// sass-mq. Unlike sass-mq, non-px and em values can be used as well.
|
|
67
|
+
///
|
|
68
|
+
/// @param {String | Number} $from - If a string, expects the name of a
|
|
69
|
+
/// breakpoint in $breakpoints. If a number, it will use that number.
|
|
70
|
+
/// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $from.
|
|
71
|
+
/// @returns {String} - A `min-width` media query segment
|
|
72
|
+
///
|
|
73
|
+
/// @example scss
|
|
74
|
+
/// .example {
|
|
75
|
+
/// @media #{govuk-from-breakpoint(tablet)} {
|
|
76
|
+
/// color: red;
|
|
77
|
+
/// }
|
|
78
|
+
/// @media #{govuk-from-breakpoint(30em)} {
|
|
79
|
+
/// color: green;
|
|
80
|
+
/// }
|
|
81
|
+
/// @media #{govuk-from-breakpoint(tablet)} and (orientation: landscape) {
|
|
82
|
+
/// color: blue;
|
|
83
|
+
/// }
|
|
84
|
+
/// $custom-breakpoint-map: (
|
|
85
|
+
/// small: 350px,
|
|
86
|
+
/// medium: 769px,
|
|
87
|
+
/// large: 1100px,
|
|
88
|
+
/// extra-large: 1600px
|
|
89
|
+
/// );
|
|
90
|
+
/// @media #{govuk-from-breakpoint(extra-large, $custom-breakpoint-map)} {
|
|
91
|
+
/// color: cyan;
|
|
92
|
+
/// }
|
|
93
|
+
/// }
|
|
94
|
+
///
|
|
95
|
+
/// @access public
|
|
30
96
|
|
|
31
|
-
|
|
97
|
+
@function govuk-from-breakpoint($from, $breakpoints: $govuk-breakpoints) {
|
|
98
|
+
$value: govuk-breakpoint-value($from, $breakpoints);
|
|
32
99
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
100
|
+
@if type-of($value) == "number" and unit($value) == "px" {
|
|
101
|
+
$value: govuk-em($value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@return "(min-width: #{$value})";
|
|
105
|
+
}
|
|
36
106
|
|
|
37
|
-
///
|
|
107
|
+
/// Generate the `max-width` segment of a media query given a breakpoint key
|
|
38
108
|
///
|
|
39
|
-
///
|
|
40
|
-
///
|
|
109
|
+
/// sass-mq converted pixel values to ems, and only performed subtractions on
|
|
110
|
+
/// named breakpoints. These have been retained for backwards compatibility,
|
|
111
|
+
/// though unlike sass-mq, this also supports using non-px and em values.
|
|
41
112
|
///
|
|
42
|
-
/// @param {String |
|
|
43
|
-
///
|
|
44
|
-
/// @param {
|
|
45
|
-
/// @
|
|
113
|
+
/// @param {String | Number} $until - If a string, expects the name of a
|
|
114
|
+
/// breakpoint in $breakpoints. If a number, it will use that number.
|
|
115
|
+
/// @param {Map} $breakpoints [$govuk-breakpoints] - The map to look for $until.
|
|
116
|
+
/// @returns {String} - A `max-width` media query segment
|
|
117
|
+
///
|
|
118
|
+
/// @example scss
|
|
119
|
+
/// .example {
|
|
120
|
+
/// @media #{govuk-until-breakpoint(desktop)} {
|
|
121
|
+
/// color: red;
|
|
122
|
+
/// }
|
|
123
|
+
/// @media #{govuk-until-breakpoint(40em)} {
|
|
124
|
+
/// color: green;
|
|
125
|
+
/// }
|
|
126
|
+
/// @media #{govuk-until-breakpoint(tablet)} and (orientation: landscape) {
|
|
127
|
+
/// color: blue;
|
|
128
|
+
/// }
|
|
129
|
+
/// $custom-breakpoint-map: (
|
|
130
|
+
/// small: 350px,
|
|
131
|
+
/// medium: 769px,
|
|
132
|
+
/// large: 1100px,
|
|
133
|
+
/// extra-large: 1600px
|
|
134
|
+
/// );
|
|
135
|
+
/// @media #{govuk-until-breakpoint(extra-large, $custom-breakpoint-map)} {
|
|
136
|
+
/// color: cyan;
|
|
137
|
+
/// }
|
|
138
|
+
/// }
|
|
139
|
+
///
|
|
140
|
+
/// @access public
|
|
141
|
+
|
|
142
|
+
@function govuk-until-breakpoint($until, $breakpoints: $govuk-breakpoints) {
|
|
143
|
+
$value: govuk-breakpoint-value($until, $breakpoints);
|
|
144
|
+
|
|
145
|
+
@if type-of($value) == "number" and unit($value) == "px" {
|
|
146
|
+
// If it's a pixel value, convert it to ems.
|
|
147
|
+
$value: govuk-em($value);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// If $value derives from a named breakpoint, additionally subtract .01em
|
|
151
|
+
@if type-of($until) != "number" and unit($value) == "em" {
|
|
152
|
+
$value: $value - 0.01em;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@return "(max-width: #{$value})";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/// Media query
|
|
46
159
|
///
|
|
47
|
-
/// @
|
|
48
|
-
/// @
|
|
160
|
+
/// @param {String | Boolean} $from [false] - One of $breakpoints
|
|
161
|
+
/// @param {String | Boolean} $until [false] - One of $breakpoints
|
|
162
|
+
/// @param {String | Boolean} $and [false] - Additional media query parameters
|
|
163
|
+
/// @param {String} $media-type [all] - Override media type: screen, print…
|
|
164
|
+
/// @param {Map} $breakpoints [$govuk-breakpoints] - Map of breakpoints to use
|
|
49
165
|
///
|
|
50
|
-
/// @content styling rules
|
|
166
|
+
/// @content styling rules to use for the given media query range
|
|
51
167
|
///
|
|
52
168
|
/// @example scss
|
|
53
169
|
/// .element {
|
|
@@ -67,14 +183,37 @@ $sass-mq-already-included: true;
|
|
|
67
183
|
/// color: hotpink;
|
|
68
184
|
/// }
|
|
69
185
|
/// @include govuk-media-query(tablet, $media-type: screen) {
|
|
70
|
-
/// color:
|
|
186
|
+
/// color: rebeccapurple;
|
|
71
187
|
/// }
|
|
72
188
|
/// }
|
|
73
189
|
///
|
|
74
190
|
/// @access public
|
|
75
191
|
|
|
76
|
-
@mixin govuk-media-query($
|
|
77
|
-
|
|
192
|
+
@mixin govuk-media-query($from: null, $until: null, $and: null, $media-type: "all", $breakpoints: $govuk-breakpoints) {
|
|
193
|
+
$media-query: "";
|
|
194
|
+
$min-width: if($from, govuk-from-breakpoint($from, $breakpoints), null);
|
|
195
|
+
$max-width: if($until, govuk-until-breakpoint($until, $breakpoints), null);
|
|
196
|
+
|
|
197
|
+
// Assemble the media query string
|
|
198
|
+
@if $media-type != "all" {
|
|
199
|
+
$media-query: "#{$media-type}";
|
|
200
|
+
}
|
|
201
|
+
@if $min-width {
|
|
202
|
+
$media-query: "#{$media-query} and #{$min-width}";
|
|
203
|
+
}
|
|
204
|
+
@if $max-width {
|
|
205
|
+
$media-query: "#{$media-query} and #{$max-width}";
|
|
206
|
+
}
|
|
207
|
+
@if $and {
|
|
208
|
+
$media-query: "#{$media-query} and #{$and}";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// If $media-query currently begins with an orphaned ' and ', remove it.
|
|
212
|
+
@if str-index($media-query, " and ") == 1 {
|
|
213
|
+
$media-query: str-slice($media-query, 6);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@media #{$media-query} {
|
|
78
217
|
@content;
|
|
79
218
|
}
|
|
80
219
|
}
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
#{$property}-#{$direction}: $breakpoint-value if($important, !important, null);
|
|
108
108
|
}
|
|
109
109
|
} @else {
|
|
110
|
-
@
|
|
110
|
+
@media #{govuk-from-breakpoint($breakpoint)} {
|
|
111
111
|
@if $direction == all {
|
|
112
112
|
#{$property}: $breakpoint-value if($important, !important, null);
|
|
113
113
|
} @else {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
@include _govuk-font-face-gds-transport;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
@
|
|
26
|
+
@media print {
|
|
27
27
|
font-family: $govuk-font-family-print;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
/// @access public
|
|
36
36
|
|
|
37
37
|
@mixin govuk-text-colour {
|
|
38
|
-
color:
|
|
38
|
+
color: govuk-functional-colour(text);
|
|
39
39
|
|
|
40
|
-
@
|
|
41
|
-
color:
|
|
40
|
+
@media print {
|
|
41
|
+
color: govuk-functional-colour(print-text);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -114,30 +114,6 @@
|
|
|
114
114
|
@return $line-height;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/// Font size and line height helper
|
|
118
|
-
///
|
|
119
|
-
/// @param {Number} $size - Point from the type scale (the size as it would
|
|
120
|
-
/// appear on tablet and above)
|
|
121
|
-
/// @param {Number} $override-line-height [false] - Non responsive custom line
|
|
122
|
-
/// height. Omit to use the line height from the font map.
|
|
123
|
-
/// @param {Boolean} $important [false] - Whether to mark declarations as
|
|
124
|
-
/// `!important`.
|
|
125
|
-
///
|
|
126
|
-
/// @throw if `$size` is not a valid point from the type scale
|
|
127
|
-
///
|
|
128
|
-
/// @access public
|
|
129
|
-
///
|
|
130
|
-
/// @alias govuk-font-size
|
|
131
|
-
/// @deprecated Use `govuk-font-size` instead
|
|
132
|
-
|
|
133
|
-
@mixin govuk-typography-responsive($size, $override-line-height: false, $important: false) {
|
|
134
|
-
@include _warning(
|
|
135
|
-
"govuk-typography-responsive",
|
|
136
|
-
"govuk-typography-responsive is deprecated. Use govuk-font-size instead."
|
|
137
|
-
);
|
|
138
|
-
@include govuk-font-size($size, $override-line-height, $important);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
117
|
/// Font size and line height helper
|
|
142
118
|
///
|
|
143
119
|
/// Takes a point from the responsive 'font map' as an argument (the size as it
|
|
@@ -240,12 +216,12 @@
|
|
|
240
216
|
font-size: $font-size-rem;
|
|
241
217
|
line-height: $calculated-line-height;
|
|
242
218
|
} @else if $breakpoint == "print" {
|
|
243
|
-
@
|
|
219
|
+
@media print {
|
|
244
220
|
font-size: $font-size;
|
|
245
221
|
line-height: $calculated-line-height;
|
|
246
222
|
}
|
|
247
223
|
} @else {
|
|
248
|
-
@
|
|
224
|
+
@media #{govuk-from-breakpoint($breakpoint)} {
|
|
249
225
|
font-size: $font-size-rem;
|
|
250
226
|
line-height: $calculated-line-height;
|
|
251
227
|
}
|
|
@@ -55,7 +55,7 @@ class I18n {
|
|
|
55
55
|
return 'other';
|
|
56
56
|
}
|
|
57
57
|
const translation = this.translations[lookupKey];
|
|
58
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
58
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
59
59
|
if (isObject(translation)) {
|
|
60
60
|
if (preferredForm in translation) {
|
|
61
61
|
return preferredForm;
|
|
@@ -66,132 +66,7 @@ class I18n {
|
|
|
66
66
|
}
|
|
67
67
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
68
68
|
}
|
|
69
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
70
|
-
count = Math.abs(Math.floor(count));
|
|
71
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
72
|
-
if (ruleset) {
|
|
73
|
-
return I18n.pluralRules[ruleset](count);
|
|
74
|
-
}
|
|
75
|
-
return 'other';
|
|
76
|
-
}
|
|
77
|
-
getPluralRulesForLocale() {
|
|
78
|
-
const localeShort = this.locale.split('-')[0];
|
|
79
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
80
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
81
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
82
|
-
return pluralRule;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
69
|
}
|
|
87
|
-
I18n.pluralRulesMap = {
|
|
88
|
-
arabic: ['ar'],
|
|
89
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
90
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
91
|
-
german: ['af', 'sq', 'az', 'eu', 'bg', 'ca', 'da', 'nl', 'en', 'et', 'fi', 'ka', 'de', 'el', 'hu', 'lb', 'no', 'so', 'sw', 'sv', 'ta', 'te', 'tr', 'ur'],
|
|
92
|
-
irish: ['ga'],
|
|
93
|
-
russian: ['ru', 'uk'],
|
|
94
|
-
scottish: ['gd'],
|
|
95
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
96
|
-
welsh: ['cy']
|
|
97
|
-
};
|
|
98
|
-
I18n.pluralRules = {
|
|
99
|
-
arabic(n) {
|
|
100
|
-
if (n === 0) {
|
|
101
|
-
return 'zero';
|
|
102
|
-
}
|
|
103
|
-
if (n === 1) {
|
|
104
|
-
return 'one';
|
|
105
|
-
}
|
|
106
|
-
if (n === 2) {
|
|
107
|
-
return 'two';
|
|
108
|
-
}
|
|
109
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
110
|
-
return 'few';
|
|
111
|
-
}
|
|
112
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
113
|
-
return 'many';
|
|
114
|
-
}
|
|
115
|
-
return 'other';
|
|
116
|
-
},
|
|
117
|
-
chinese() {
|
|
118
|
-
return 'other';
|
|
119
|
-
},
|
|
120
|
-
french(n) {
|
|
121
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
122
|
-
},
|
|
123
|
-
german(n) {
|
|
124
|
-
return n === 1 ? 'one' : 'other';
|
|
125
|
-
},
|
|
126
|
-
irish(n) {
|
|
127
|
-
if (n === 1) {
|
|
128
|
-
return 'one';
|
|
129
|
-
}
|
|
130
|
-
if (n === 2) {
|
|
131
|
-
return 'two';
|
|
132
|
-
}
|
|
133
|
-
if (n >= 3 && n <= 6) {
|
|
134
|
-
return 'few';
|
|
135
|
-
}
|
|
136
|
-
if (n >= 7 && n <= 10) {
|
|
137
|
-
return 'many';
|
|
138
|
-
}
|
|
139
|
-
return 'other';
|
|
140
|
-
},
|
|
141
|
-
russian(n) {
|
|
142
|
-
const lastTwo = n % 100;
|
|
143
|
-
const last = lastTwo % 10;
|
|
144
|
-
if (last === 1 && lastTwo !== 11) {
|
|
145
|
-
return 'one';
|
|
146
|
-
}
|
|
147
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
148
|
-
return 'few';
|
|
149
|
-
}
|
|
150
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
151
|
-
return 'many';
|
|
152
|
-
}
|
|
153
|
-
return 'other';
|
|
154
|
-
},
|
|
155
|
-
scottish(n) {
|
|
156
|
-
if (n === 1 || n === 11) {
|
|
157
|
-
return 'one';
|
|
158
|
-
}
|
|
159
|
-
if (n === 2 || n === 12) {
|
|
160
|
-
return 'two';
|
|
161
|
-
}
|
|
162
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
163
|
-
return 'few';
|
|
164
|
-
}
|
|
165
|
-
return 'other';
|
|
166
|
-
},
|
|
167
|
-
spanish(n) {
|
|
168
|
-
if (n === 1) {
|
|
169
|
-
return 'one';
|
|
170
|
-
}
|
|
171
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
172
|
-
return 'many';
|
|
173
|
-
}
|
|
174
|
-
return 'other';
|
|
175
|
-
},
|
|
176
|
-
welsh(n) {
|
|
177
|
-
if (n === 0) {
|
|
178
|
-
return 'zero';
|
|
179
|
-
}
|
|
180
|
-
if (n === 1) {
|
|
181
|
-
return 'one';
|
|
182
|
-
}
|
|
183
|
-
if (n === 2) {
|
|
184
|
-
return 'two';
|
|
185
|
-
}
|
|
186
|
-
if (n === 3) {
|
|
187
|
-
return 'few';
|
|
188
|
-
}
|
|
189
|
-
if (n === 6) {
|
|
190
|
-
return 'many';
|
|
191
|
-
}
|
|
192
|
-
return 'other';
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
70
|
|
|
196
71
|
export { I18n };
|
|
197
72
|
//# sourceMappingURL=i18n.mjs.map
|
|
@@ -7,7 +7,6 @@ import { Checkboxes } from './components/checkboxes/checkboxes.mjs';
|
|
|
7
7
|
import { ErrorSummary } from './components/error-summary/error-summary.mjs';
|
|
8
8
|
import { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs';
|
|
9
9
|
import { FileUpload } from './components/file-upload/file-upload.mjs';
|
|
10
|
-
import { Header } from './components/header/header.mjs';
|
|
11
10
|
import { NotificationBanner } from './components/notification-banner/notification-banner.mjs';
|
|
12
11
|
import { PasswordInput } from './components/password-input/password-input.mjs';
|
|
13
12
|
import { Radios } from './components/radios/radios.mjs';
|
|
@@ -47,7 +46,7 @@ function initAll(scopeOrConfig = {}) {
|
|
|
47
46
|
}
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
|
-
const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [FileUpload, config.fileUpload], [
|
|
49
|
+
const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [FileUpload, config.fileUpload], [NotificationBanner, config.notificationBanner], [PasswordInput, config.passwordInput], [Radios], [ServiceNavigation], [SkipLink], [Tabs]];
|
|
51
50
|
components.forEach(([Component, componentConfig]) => {
|
|
52
51
|
createAll(Component, componentConfig, options);
|
|
53
52
|
});
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
|
|
58
58
|
// On tablet and above, we also introduce a 'column gap' between the
|
|
59
59
|
// buttons and links in each row and left align links
|
|
60
|
-
@
|
|
60
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
61
61
|
// Cancel out the column gap for the last item in each row
|
|
62
62
|
margin-right: ($horizontal-gap * -1);
|
|
63
63
|
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
.govuk-form-group--error {
|
|
14
14
|
padding-left: govuk-spacing(3);
|
|
15
|
-
border-left: $govuk-border-width-form-group-error solid
|
|
15
|
+
border-left: $govuk-border-width-form-group-error solid;
|
|
16
|
+
border-left-color: govuk-functional-colour(error);
|
|
16
17
|
|
|
17
18
|
.govuk-form-group {
|
|
18
19
|
// Reset error styles in nested form groups that might have error class
|