govuk_tech_docs 5.2.1 → 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/.github/dependabot.yml +59 -0
- data/.npmrc +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +19 -0
- data/README.md +13 -4
- data/example/config/tech-docs.yml +1 -1
- data/govuk_tech_docs.gemspec +2 -2
- 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 +183 -300
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +184 -300
- 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/configuration.mjs +29 -2
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -10
- 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 +14 -137
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +14 -137
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
- 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/button/button.bundle.js +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +7 -5
- 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 +30 -143
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +30 -143
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +20 -10
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +10 -5
- 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/error-summary/error-summary.bundle.js +8 -12
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +8 -12
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +2 -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 +10 -133
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +10 -133
- 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 +46 -140
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +46 -140
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +36 -7
- 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/notification-banner/notification-banner.bundle.js +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +7 -5
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +16 -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 +10 -133
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +10 -133
- 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/radios/radios.bundle.js +10 -5
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +10 -5
- 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 +58 -74
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +40 -7
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +40 -7
- 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 +8 -4
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +12 -19
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +12 -19
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -9
- 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/tabs/tabs.bundle.js +12 -13
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +12 -13
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +3 -3
- 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/errors/index.mjs +5 -3
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +187 -72
- 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/helpers/_visually-hidden.scss +4 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +5 -128
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +53 -45
- 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 +2461 -1150
- data/package.json +3 -3
- metadata +16 -30
- 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 -233
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -225
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normaliseOptions } from './common/configuration.mjs';
|
|
2
|
+
import { isSupported, isObject } from './common/index.mjs';
|
|
2
3
|
import { Accordion } from './components/accordion/accordion.mjs';
|
|
3
4
|
import { Button } from './components/button/button.mjs';
|
|
4
5
|
import { CharacterCount } from './components/character-count/character-count.mjs';
|
|
@@ -6,14 +7,13 @@ import { Checkboxes } from './components/checkboxes/checkboxes.mjs';
|
|
|
6
7
|
import { ErrorSummary } from './components/error-summary/error-summary.mjs';
|
|
7
8
|
import { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs';
|
|
8
9
|
import { FileUpload } from './components/file-upload/file-upload.mjs';
|
|
9
|
-
import { Header } from './components/header/header.mjs';
|
|
10
10
|
import { NotificationBanner } from './components/notification-banner/notification-banner.mjs';
|
|
11
11
|
import { PasswordInput } from './components/password-input/password-input.mjs';
|
|
12
12
|
import { Radios } from './components/radios/radios.mjs';
|
|
13
13
|
import { ServiceNavigation } from './components/service-navigation/service-navigation.mjs';
|
|
14
14
|
import { SkipLink } from './components/skip-link/skip-link.mjs';
|
|
15
15
|
import { Tabs } from './components/tabs/tabs.mjs';
|
|
16
|
-
import { SupportError } from './errors/index.mjs';
|
|
16
|
+
import { SupportError, ElementError } from './errors/index.mjs';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Initialise all components
|
|
@@ -21,28 +21,34 @@ import { SupportError } from './errors/index.mjs';
|
|
|
21
21
|
* Use the `data-module` attributes to find, instantiate and init all of the
|
|
22
22
|
* components provided as part of GOV.UK Frontend.
|
|
23
23
|
*
|
|
24
|
-
* @param {Config
|
|
24
|
+
* @param {Config | Element | Document | null} [scopeOrConfig] - Scope of the document to search within or config for all components (with optional scope)
|
|
25
25
|
*/
|
|
26
|
-
function initAll(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
26
|
+
function initAll(scopeOrConfig = {}) {
|
|
27
|
+
const config = isObject(scopeOrConfig) ? scopeOrConfig : {};
|
|
28
|
+
const options = normaliseOptions(scopeOrConfig);
|
|
29
|
+
try {
|
|
30
|
+
if (!isSupported()) {
|
|
31
|
+
throw new SupportError();
|
|
32
|
+
}
|
|
33
|
+
if (options.scope === null) {
|
|
34
|
+
throw new ElementError({
|
|
35
|
+
element: options.scope,
|
|
36
|
+
identifier: 'GOV.UK Frontend scope element (`$scope`)'
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (options.onError) {
|
|
41
|
+
options.onError(error, {
|
|
32
42
|
config
|
|
33
43
|
});
|
|
34
44
|
} else {
|
|
35
|
-
console.log(
|
|
45
|
+
console.log(error);
|
|
36
46
|
}
|
|
37
47
|
return;
|
|
38
48
|
}
|
|
39
|
-
const components = [[Accordion, config.accordion], [Button, config.button], [CharacterCount, config.characterCount], [Checkboxes], [ErrorSummary, config.errorSummary], [ExitThisPage, config.exitThisPage], [FileUpload, config.fileUpload], [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onError: config.onError
|
|
43
|
-
};
|
|
44
|
-
components.forEach(([Component, config]) => {
|
|
45
|
-
createAll(Component, config, options);
|
|
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]];
|
|
50
|
+
components.forEach(([Component, componentConfig]) => {
|
|
51
|
+
createAll(Component, componentConfig, options);
|
|
46
52
|
});
|
|
47
53
|
}
|
|
48
54
|
|
|
@@ -58,42 +64,42 @@ function initAll(config) {
|
|
|
58
64
|
* @template {CompatibleClass} ComponentClass
|
|
59
65
|
* @param {ComponentClass} Component - class of the component to create
|
|
60
66
|
* @param {ComponentConfig<ComponentClass>} [config] - Config supplied to component
|
|
61
|
-
* @param {OnErrorCallback<ComponentClass> | Element | Document | CreateAllOptions<ComponentClass>
|
|
67
|
+
* @param {OnErrorCallback<ComponentClass> | Element | Document | null | CreateAllOptions<ComponentClass>} [scopeOrOptions] - options for createAll including scope of the document to search within and callback function if error throw by component on init
|
|
62
68
|
* @returns {Array<InstanceType<ComponentClass>>} - array of instantiated components
|
|
63
69
|
*/
|
|
64
|
-
function createAll(Component, config,
|
|
65
|
-
let $
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (onError) {
|
|
82
|
-
onError(
|
|
70
|
+
function createAll(Component, config, scopeOrOptions) {
|
|
71
|
+
let $elements;
|
|
72
|
+
const options = normaliseOptions(scopeOrOptions);
|
|
73
|
+
try {
|
|
74
|
+
var _options$scope;
|
|
75
|
+
if (!isSupported()) {
|
|
76
|
+
throw new SupportError();
|
|
77
|
+
}
|
|
78
|
+
if (options.scope === null) {
|
|
79
|
+
throw new ElementError({
|
|
80
|
+
element: options.scope,
|
|
81
|
+
component: Component,
|
|
82
|
+
identifier: 'Scope element (`$scope`)'
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
$elements = (_options$scope = options.scope) == null ? void 0 : _options$scope.querySelectorAll(`[data-module="${Component.moduleName}"]`);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (options.onError) {
|
|
88
|
+
options.onError(error, {
|
|
83
89
|
component: Component,
|
|
84
90
|
config
|
|
85
91
|
});
|
|
86
92
|
} else {
|
|
87
|
-
console.log(
|
|
93
|
+
console.log(error);
|
|
88
94
|
}
|
|
89
95
|
return [];
|
|
90
96
|
}
|
|
91
|
-
return Array.from($elements).map($element => {
|
|
97
|
+
return Array.from($elements != null ? $elements : []).map($element => {
|
|
92
98
|
try {
|
|
93
99
|
return typeof config !== 'undefined' ? new Component($element, config) : new Component($element);
|
|
94
100
|
} catch (error) {
|
|
95
|
-
if (onError) {
|
|
96
|
-
onError(error, {
|
|
101
|
+
if (options.onError) {
|
|
102
|
+
options.onError(error, {
|
|
97
103
|
element: $element,
|
|
98
104
|
component: Component,
|
|
99
105
|
config
|
|
@@ -112,6 +118,8 @@ function createAll(Component, config, createAllOptions) {
|
|
|
112
118
|
* Config for all components via `initAll()`
|
|
113
119
|
*
|
|
114
120
|
* @typedef {object} Config
|
|
121
|
+
* @property {Element | Document | null} [scope] - Scope of the document to search within
|
|
122
|
+
* @property {OnErrorCallback<CompatibleClass>} [onError] - Initialisation error callback
|
|
115
123
|
* @property {AccordionConfig} [accordion] - Accordion config
|
|
116
124
|
* @property {ButtonConfig} [button] - Button config
|
|
117
125
|
* @property {CharacterCountConfig} [characterCount] - Character Count config
|
|
@@ -136,7 +144,7 @@ function createAll(Component, config, createAllOptions) {
|
|
|
136
144
|
/**
|
|
137
145
|
* Component config keys, e.g. `accordion` and `characterCount`
|
|
138
146
|
*
|
|
139
|
-
* @typedef {keyof Config} ConfigKey
|
|
147
|
+
* @typedef {keyof Omit<Config, 'scope' | 'onError'>} ConfigKey
|
|
140
148
|
*/
|
|
141
149
|
/**
|
|
142
150
|
* @template {CompatibleClass} ComponentClass
|
|
@@ -147,7 +155,7 @@ function createAll(Component, config, createAllOptions) {
|
|
|
147
155
|
* @typedef {object} ErrorContext
|
|
148
156
|
* @property {Element} [element] - Element used for component module initialisation
|
|
149
157
|
* @property {ComponentClass} [component] - Class of component
|
|
150
|
-
* @property {ComponentConfig<ComponentClass>} config - Config supplied to
|
|
158
|
+
* @property {Config | ComponentConfig<ComponentClass>} [config] - Config supplied to components
|
|
151
159
|
*/
|
|
152
160
|
/**
|
|
153
161
|
* @template {CompatibleClass} ComponentClass
|
|
@@ -158,7 +166,7 @@ function createAll(Component, config, createAllOptions) {
|
|
|
158
166
|
/**
|
|
159
167
|
* @template {CompatibleClass} ComponentClass
|
|
160
168
|
* @typedef {object} CreateAllOptions
|
|
161
|
-
* @property {Element | Document} [scope] - scope of the document to search within
|
|
169
|
+
* @property {Element | Document | null} [scope] - scope of the document to search within
|
|
162
170
|
* @property {OnErrorCallback<ComponentClass>} [onError] - callback function if error throw by component on init
|
|
163
171
|
*/
|
|
164
172
|
|
|
@@ -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
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
padding-top: govuk-spacing(4);
|
|
31
31
|
padding-bottom: govuk-spacing(4);
|
|
32
32
|
|
|
33
|
-
@
|
|
33
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
34
34
|
// This spacing is manually adjusted to replicate the margin of
|
|
35
35
|
// govuk-heading-xl (50px) minus the spacing of back link and
|
|
36
36
|
// breadcrumbs (10px)
|
|
@@ -5,11 +5,7 @@
|
|
|
5
5
|
.govuk-template {
|
|
6
6
|
// Set the overall page background colour to the same colour as used by the
|
|
7
7
|
// footer to give the illusion of a long footer.
|
|
8
|
-
|
|
9
|
-
background-color,
|
|
10
|
-
$from: $govuk-template-background-colour,
|
|
11
|
-
$to: $_govuk-rebrand-template-background-colour
|
|
12
|
-
);
|
|
8
|
+
background-color: govuk-functional-colour(template-background);
|
|
13
9
|
|
|
14
10
|
// Prevent automatic text sizing, as we already cater for small devices and
|
|
15
11
|
// would like the browser to stay on 100% text zoom by default.
|
|
@@ -39,7 +35,7 @@
|
|
|
39
35
|
|
|
40
36
|
// Force the scrollbar to always display in IE, to prevent horizontal page
|
|
41
37
|
// jumps as content height changes (e.g. autocomplete results open).
|
|
42
|
-
@
|
|
38
|
+
@media screen {
|
|
43
39
|
overflow-y: scroll;
|
|
44
40
|
}
|
|
45
41
|
}
|
|
@@ -50,7 +46,7 @@
|
|
|
50
46
|
// own containers.
|
|
51
47
|
margin: 0;
|
|
52
48
|
// Set the overall body of the page back to the typical background colour.
|
|
53
|
-
background-color:
|
|
49
|
+
background-color: govuk-functional-colour(body-background);
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// On tablet, add full width gutters
|
|
40
|
-
@
|
|
40
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
41
41
|
margin-right: $govuk-gutter;
|
|
42
42
|
margin-left: $govuk-gutter;
|
|
43
43
|
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
// As soon as the viewport is greater than the width of the page plus the
|
|
57
57
|
// gutters, just centre the content instead of adding gutters.
|
|
58
|
-
@
|
|
58
|
+
@media (min-width: #{($width + $govuk-gutter * 2)}) {
|
|
59
59
|
margin-right: auto;
|
|
60
60
|
margin-left: auto;
|
|
61
61
|
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
// Generate typography override classes for each responsive font map in the
|
|
5
5
|
// typography scale eg .govuk-\!-font-size-80
|
|
6
|
-
//
|
|
7
|
-
// govuk-!-font-size-14 is deprecated
|
|
8
6
|
@each $size, $font-map in $govuk-typography-scale {
|
|
9
7
|
.govuk-\!-font-size-#{$size} {
|
|
10
8
|
$font-map: map-get($govuk-typography-scale, $size);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
.govuk-\!-width-three-quarters {
|
|
8
8
|
width: 100% !important;
|
|
9
9
|
|
|
10
|
-
@
|
|
10
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
11
11
|
width: 75% !important;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
.govuk-\!-width-two-thirds {
|
|
16
16
|
width: 100% !important;
|
|
17
17
|
|
|
18
|
-
@
|
|
18
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
19
19
|
width: 66.66% !important;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
.govuk-\!-width-one-half {
|
|
24
24
|
width: 100% !important;
|
|
25
25
|
|
|
26
|
-
@
|
|
26
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
27
27
|
width: 50% !important;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
.govuk-\!-width-one-third {
|
|
32
32
|
width: 100% !important;
|
|
33
33
|
|
|
34
|
-
@
|
|
34
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
35
35
|
width: 33.33% !important;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
.govuk-\!-width-one-quarter {
|
|
40
40
|
width: 100% !important;
|
|
41
41
|
|
|
42
|
-
@
|
|
42
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
43
43
|
width: 25% !important;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -2,194 +2,9 @@
|
|
|
2
2
|
/// @group settings/colours
|
|
3
3
|
////
|
|
4
4
|
|
|
5
|
-
@import "
|
|
5
|
+
@warn "The '_colours-applied' file is deprecated. Please import '_colours-functional' instead. "
|
|
6
|
+
+ "See https://github.com/alphagov/govuk-frontend/releases/tag/v6.0.0 for more details.";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
// Generic
|
|
9
|
-
// =========================================================
|
|
10
|
-
|
|
11
|
-
/// Brand colour
|
|
12
|
-
///
|
|
13
|
-
/// @type Colour
|
|
14
|
-
/// @access public
|
|
15
|
-
|
|
16
|
-
$govuk-brand-colour: govuk-colour("blue") !default;
|
|
17
|
-
|
|
18
|
-
/// Text colour
|
|
19
|
-
///
|
|
20
|
-
/// @type Colour
|
|
21
|
-
/// @access public
|
|
22
|
-
|
|
23
|
-
$govuk-text-colour: govuk-colour("black") !default;
|
|
24
|
-
|
|
25
|
-
/// Canvas background colour
|
|
26
|
-
///
|
|
27
|
-
/// Used by the footer component and template to give the illusion of a long
|
|
28
|
-
/// footer.
|
|
29
|
-
///
|
|
30
|
-
/// @type Colour
|
|
31
|
-
/// @access public
|
|
32
|
-
/// @deprecated "$govuk-canvas-background-colour has been deprecated and will be removed in the next major
|
|
33
|
-
/// version. Use `$govuk-template-background-colour` if you want to change the background of
|
|
34
|
-
/// the `<html>` element and background colour of elements that need to match for visual
|
|
35
|
-
/// continuity.
|
|
36
|
-
$govuk-canvas-background-colour: govuk-colour("light-grey") !default;
|
|
37
|
-
|
|
38
|
-
// Output a deprecation warning if $govuk-canvas-background-colour is being overridden
|
|
39
|
-
// Remove in next major version.
|
|
40
|
-
@if $govuk-canvas-background-colour != govuk-colour("light-grey") {
|
|
41
|
-
@include _warning(
|
|
42
|
-
"$govuk-canvas-background-colour",
|
|
43
|
-
"$govuk-canvas-background-colour has been deprecated and will be removed in the next major version."
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// Template background colour
|
|
48
|
-
///
|
|
49
|
-
/// Used by components that want to give the illusion of extending
|
|
50
|
-
/// the template background (such as the footer and cookie banner).
|
|
51
|
-
///
|
|
52
|
-
/// @type Colour
|
|
53
|
-
/// @access public
|
|
54
|
-
|
|
55
|
-
$govuk-template-background-colour: govuk-colour("light-grey") !default;
|
|
56
|
-
|
|
57
|
-
/// Body background colour
|
|
58
|
-
///
|
|
59
|
-
/// @type Colour
|
|
60
|
-
/// @access public
|
|
61
|
-
|
|
62
|
-
$govuk-body-background-colour: govuk-colour("white") !default;
|
|
63
|
-
|
|
64
|
-
/// Text colour for print media
|
|
65
|
-
///
|
|
66
|
-
/// Use 'true black' to avoid printers using colour ink to print body text
|
|
67
|
-
///
|
|
68
|
-
/// @type Colour
|
|
69
|
-
/// @access public
|
|
70
|
-
|
|
71
|
-
$govuk-print-text-colour: #000000 !default;
|
|
72
|
-
|
|
73
|
-
/// Secondary text colour
|
|
74
|
-
///
|
|
75
|
-
/// Used in for example 'muted' text and help text.
|
|
76
|
-
///
|
|
77
|
-
/// @type Colour
|
|
78
|
-
/// @access public
|
|
79
|
-
|
|
80
|
-
$govuk-secondary-text-colour: govuk-colour("dark-grey") !default;
|
|
81
|
-
|
|
82
|
-
/// Focus colour
|
|
83
|
-
///
|
|
84
|
-
/// Used for outline (and background, where appropriate) when interactive
|
|
85
|
-
/// elements (links, form controls) have keyboard focus.
|
|
86
|
-
///
|
|
87
|
-
/// @type Colour
|
|
88
|
-
/// @access public
|
|
89
|
-
|
|
90
|
-
$govuk-focus-colour: govuk-colour("yellow") !default;
|
|
91
|
-
|
|
92
|
-
/// Focused text colour
|
|
93
|
-
///
|
|
94
|
-
/// Ensure that the contrast between the text and background colour passes
|
|
95
|
-
/// WCAG Level AA contrast requirements.
|
|
96
|
-
///
|
|
97
|
-
/// @type Colour
|
|
98
|
-
/// @access public
|
|
99
|
-
|
|
100
|
-
$govuk-focus-text-colour: govuk-colour("black") !default;
|
|
101
|
-
|
|
102
|
-
/// Error colour
|
|
103
|
-
///
|
|
104
|
-
/// Used to highlight error messages and form controls in an error state
|
|
105
|
-
///
|
|
106
|
-
/// @type Colour
|
|
107
|
-
/// @access public
|
|
108
|
-
|
|
109
|
-
$govuk-error-colour: govuk-colour("red") !default;
|
|
110
|
-
|
|
111
|
-
/// Success colour
|
|
112
|
-
///
|
|
113
|
-
/// Used to highlight success messages and banners
|
|
114
|
-
///
|
|
115
|
-
/// @type Colour
|
|
116
|
-
/// @access public
|
|
117
|
-
|
|
118
|
-
$govuk-success-colour: govuk-colour("green") !default;
|
|
119
|
-
|
|
120
|
-
/// Border colour
|
|
121
|
-
///
|
|
122
|
-
/// Used in for example borders, separators, rules and keylines.
|
|
123
|
-
///
|
|
124
|
-
/// @type Colour
|
|
125
|
-
/// @access public
|
|
126
|
-
|
|
127
|
-
$govuk-border-colour: govuk-colour("mid-grey") !default;
|
|
128
|
-
|
|
129
|
-
/// Input border colour
|
|
130
|
-
///
|
|
131
|
-
/// Used for form inputs and controls
|
|
132
|
-
///
|
|
133
|
-
/// @type Colour
|
|
134
|
-
/// @access public
|
|
135
|
-
|
|
136
|
-
$govuk-input-border-colour: govuk-colour("black") !default;
|
|
137
|
-
|
|
138
|
-
/// Input hover colour
|
|
139
|
-
///
|
|
140
|
-
/// Used for hover states on form controls
|
|
141
|
-
///
|
|
142
|
-
/// @type Colour
|
|
143
|
-
/// @access public
|
|
144
|
-
|
|
145
|
-
$govuk-hover-colour: govuk-colour("mid-grey") !default;
|
|
146
|
-
|
|
147
|
-
// =============================================================================
|
|
148
|
-
// Links
|
|
149
|
-
// =============================================================================
|
|
150
|
-
|
|
151
|
-
/// Link colour
|
|
152
|
-
///
|
|
153
|
-
/// @type Colour
|
|
154
|
-
/// @access public
|
|
155
|
-
|
|
156
|
-
$govuk-link-colour: govuk-colour("blue") !default;
|
|
157
|
-
|
|
158
|
-
/// Visited link colour
|
|
159
|
-
///
|
|
160
|
-
/// @type Colour
|
|
161
|
-
/// @access public
|
|
162
|
-
|
|
163
|
-
$govuk-link-visited-colour: govuk-colour("purple") !default;
|
|
164
|
-
|
|
165
|
-
/// Link hover colour
|
|
166
|
-
///
|
|
167
|
-
/// @type Colour
|
|
168
|
-
/// @access public
|
|
169
|
-
|
|
170
|
-
$govuk-link-hover-colour: govuk-colour("dark-blue") !default;
|
|
171
|
-
|
|
172
|
-
/// Active link colour
|
|
173
|
-
///
|
|
174
|
-
/// @type Colour
|
|
175
|
-
/// @access public
|
|
176
|
-
|
|
177
|
-
$govuk-link-active-colour: govuk-colour("black") !default;
|
|
178
|
-
|
|
179
|
-
// =============================================================================
|
|
180
|
-
// Brand refresh
|
|
181
|
-
// =============================================================================
|
|
182
|
-
|
|
183
|
-
/// Updated template background colour
|
|
184
|
-
///
|
|
185
|
-
/// @type Colour
|
|
186
|
-
/// @access private
|
|
187
|
-
$_govuk-rebrand-template-background-colour: govuk-tint($govuk-brand-colour, 95%);
|
|
188
|
-
|
|
189
|
-
/// Border colour for areas on a light-blue background
|
|
190
|
-
///
|
|
191
|
-
/// @type Colour
|
|
192
|
-
/// @access private
|
|
193
|
-
$_govuk-rebrand-border-colour-on-blue-tint-95: govuk-tint($govuk-brand-colour, 50%);
|
|
8
|
+
@import "./colours-functional";
|
|
194
9
|
|
|
195
10
|
/*# sourceMappingURL=_colours-applied.scss.map */
|