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
|
@@ -201,11 +201,11 @@ class Accordion extends ConfigurableComponent {
|
|
|
201
201
|
const ariaLabelParts = [];
|
|
202
202
|
const $headingText = $section.querySelector(`.${this.sectionHeadingTextClass}`);
|
|
203
203
|
if ($headingText) {
|
|
204
|
-
ariaLabelParts.push(
|
|
204
|
+
ariaLabelParts.push($headingText.textContent.trim());
|
|
205
205
|
}
|
|
206
206
|
const $summary = $section.querySelector(`.${this.sectionSummaryClass}`);
|
|
207
207
|
if ($summary) {
|
|
208
|
-
ariaLabelParts.push(
|
|
208
|
+
ariaLabelParts.push($summary.textContent.trim());
|
|
209
209
|
}
|
|
210
210
|
const ariaLabelMessage = expanded ? this.i18n.t('hideSectionAriaLabel') : this.i18n.t('showSectionAriaLabel');
|
|
211
211
|
ariaLabelParts.push(ariaLabelMessage);
|
|
@@ -258,7 +258,7 @@ class Accordion extends ConfigurableComponent {
|
|
|
258
258
|
if (id) {
|
|
259
259
|
try {
|
|
260
260
|
window.sessionStorage.setItem(id, isExpanded.toString());
|
|
261
|
-
} catch (
|
|
261
|
+
} catch (_unused) {}
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
setInitialState($section) {
|
|
@@ -272,7 +272,7 @@ class Accordion extends ConfigurableComponent {
|
|
|
272
272
|
if (state !== null) {
|
|
273
273
|
this.setExpanded(state === 'true', $section);
|
|
274
274
|
}
|
|
275
|
-
} catch (
|
|
275
|
+
} catch (_unused2) {}
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
getButtonPunctuationEl() {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
$chevron-border-width: govuk-em($chevron-border-min-width, $font-size);
|
|
11
11
|
|
|
12
12
|
// Colour of chevron
|
|
13
|
-
$chevron-border-colour:
|
|
13
|
+
$chevron-border-colour: govuk-functional-colour(secondary-text);
|
|
14
14
|
|
|
15
15
|
.govuk-back-link {
|
|
16
16
|
@include govuk-font-size($size: $font-size);
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.govuk-back-link:focus::before {
|
|
62
|
-
border-color:
|
|
62
|
+
border-color: govuk-functional-colour(focus-text);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.govuk-back-link::after {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
$chevron-border-width: govuk-em($chevron-border-min-width, $font-size);
|
|
11
11
|
|
|
12
12
|
// Colour of chevron
|
|
13
|
-
$chevron-border-colour:
|
|
13
|
+
$chevron-border-colour: govuk-functional-colour(secondary-text);
|
|
14
14
|
|
|
15
15
|
// Calculated altitude (△↕) of the right-angled isosceles chevron with sides
|
|
16
16
|
// of length 8 (7px + 1px border):
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.govuk-breadcrumbs--collapse-on-mobile {
|
|
100
|
-
@
|
|
100
|
+
@media #{govuk-until-breakpoint(tablet)} {
|
|
101
101
|
.govuk-breadcrumbs__list-item {
|
|
102
102
|
display: none;
|
|
103
103
|
|
|
@@ -28,31 +28,31 @@ $govuk-inverse-button-background-colour: govuk-colour("white") !default;
|
|
|
28
28
|
/// @type Colour
|
|
29
29
|
/// @access public
|
|
30
30
|
|
|
31
|
-
$govuk-inverse-button-text-colour:
|
|
31
|
+
$govuk-inverse-button-text-colour: govuk-functional-colour(brand) !default;
|
|
32
32
|
|
|
33
33
|
@include govuk-exports("govuk/component/button") {
|
|
34
34
|
$govuk-button-colour: $govuk-button-background-colour;
|
|
35
35
|
$govuk-button-text-colour: $govuk-button-text-colour;
|
|
36
|
-
$govuk-button-hover-colour: govuk-
|
|
37
|
-
$govuk-button-shadow-colour: govuk-
|
|
36
|
+
$govuk-button-hover-colour: govuk-colour("green", $variant: "shade-25");
|
|
37
|
+
$govuk-button-shadow-colour: govuk-colour("green", $variant: "shade-50");
|
|
38
38
|
|
|
39
39
|
// Secondary button variables
|
|
40
|
-
$govuk-secondary-button-colour: govuk-colour("
|
|
40
|
+
$govuk-secondary-button-colour: govuk-colour("black", $variant: "tint-95");
|
|
41
41
|
$govuk-secondary-button-text-colour: govuk-colour("black");
|
|
42
|
-
$govuk-secondary-button-hover-colour: govuk-
|
|
43
|
-
$govuk-secondary-button-shadow-colour: govuk-
|
|
42
|
+
$govuk-secondary-button-hover-colour: govuk-colour("black", $variant: "tint-80");
|
|
43
|
+
$govuk-secondary-button-shadow-colour: govuk-colour("black", $variant: "tint-50");
|
|
44
44
|
|
|
45
45
|
// Warning button variables
|
|
46
46
|
$govuk-warning-button-colour: govuk-colour("red");
|
|
47
47
|
$govuk-warning-button-text-colour: govuk-colour("white");
|
|
48
|
-
$govuk-warning-button-hover-colour: govuk-
|
|
49
|
-
$govuk-warning-button-shadow-colour: govuk-
|
|
48
|
+
$govuk-warning-button-hover-colour: govuk-colour("red", $variant: "shade-25");
|
|
49
|
+
$govuk-warning-button-shadow-colour: govuk-colour("red", $variant: "shade-50");
|
|
50
50
|
|
|
51
51
|
// Inverse button variables
|
|
52
52
|
$govuk-inverse-button-colour: $govuk-inverse-button-background-colour;
|
|
53
53
|
$govuk-inverse-button-text-colour: $govuk-inverse-button-text-colour;
|
|
54
|
-
$govuk-inverse-button-hover-colour: govuk-
|
|
55
|
-
$govuk-inverse-button-shadow-colour: govuk-
|
|
54
|
+
$govuk-inverse-button-hover-colour: govuk-colour("blue", $variant: "tint-95");
|
|
55
|
+
$govuk-inverse-button-shadow-colour: govuk-colour("blue", $variant: "shade-50");
|
|
56
56
|
|
|
57
57
|
// Because the shadow (s0) is visually 'part of' the button, we need to reduce
|
|
58
58
|
// the height of the button to compensate by adjusting its padding (s1) and
|
|
@@ -82,7 +82,7 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
|
|
|
82
82
|
cursor: pointer;
|
|
83
83
|
-webkit-appearance: none;
|
|
84
84
|
|
|
85
|
-
@
|
|
85
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
86
86
|
width: auto;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -111,21 +111,18 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
&:focus {
|
|
114
|
-
border-color:
|
|
114
|
+
border-color: govuk-functional-colour(focus);
|
|
115
115
|
outline: $govuk-focus-width solid transparent;
|
|
116
|
-
box-shadow: inset 0 0 0 1px
|
|
116
|
+
box-shadow: inset 0 0 0 1px govuk-functional-colour(focus);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
&:focus:not(:active):not(:hover) {
|
|
120
|
-
border-color:
|
|
121
|
-
color:
|
|
122
|
-
background-color:
|
|
123
|
-
box-shadow: 0 2px 0
|
|
120
|
+
border-color: govuk-functional-colour(focus);
|
|
121
|
+
color: govuk-functional-colour(focus-text);
|
|
122
|
+
background-color: govuk-functional-colour(focus);
|
|
123
|
+
box-shadow: 0 2px 0 govuk-functional-colour(focus-text);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
// The following adjustments do not work for <input type="button"> as
|
|
127
|
-
// non-container elements cannot include pseudo elements (i.e. ::before).
|
|
128
|
-
|
|
129
126
|
// Use a pseudo element to expand the click target area to include the
|
|
130
127
|
// button's shadow as well, in case users try to click it.
|
|
131
128
|
&::before {
|
|
@@ -247,7 +244,7 @@ $govuk-inverse-button-text-colour: $govuk-brand-colour !default;
|
|
|
247
244
|
.govuk-button__start-icon {
|
|
248
245
|
margin-left: govuk-spacing(1);
|
|
249
246
|
|
|
250
|
-
@
|
|
247
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
251
248
|
margin-left: govuk-spacing(2);
|
|
252
249
|
}
|
|
253
250
|
vertical-align: middle;
|
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
* @typedef ComponentWithModuleName
|
|
37
37
|
* @property {string} moduleName - Name of the component
|
|
38
38
|
*/
|
|
39
|
-
/**
|
|
40
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
41
|
-
*/
|
|
42
39
|
|
|
43
40
|
class GOVUKFrontendError extends Error {
|
|
44
41
|
constructor(...args) {
|
|
@@ -67,7 +64,7 @@
|
|
|
67
64
|
class ElementError extends GOVUKFrontendError {
|
|
68
65
|
constructor(messageOrOptions) {
|
|
69
66
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
70
|
-
if (
|
|
67
|
+
if (isObject(messageOrOptions)) {
|
|
71
68
|
const {
|
|
72
69
|
component,
|
|
73
70
|
identifier,
|
|
@@ -76,7 +73,9 @@
|
|
|
76
73
|
} = messageOrOptions;
|
|
77
74
|
message = identifier;
|
|
78
75
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
79
|
-
|
|
76
|
+
if (component) {
|
|
77
|
+
message = formatErrorMessage(component, message);
|
|
78
|
+
}
|
|
80
79
|
}
|
|
81
80
|
super(message);
|
|
82
81
|
this.name = 'ElementError';
|
|
@@ -290,6 +289,9 @@
|
|
|
290
289
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
291
290
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
292
291
|
*/
|
|
292
|
+
/**
|
|
293
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
294
|
+
*/
|
|
293
295
|
|
|
294
296
|
const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
295
297
|
|
|
@@ -30,9 +30,6 @@ function formatErrorMessage(Component, message) {
|
|
|
30
30
|
* @typedef ComponentWithModuleName
|
|
31
31
|
* @property {string} moduleName - Name of the component
|
|
32
32
|
*/
|
|
33
|
-
/**
|
|
34
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
35
|
-
*/
|
|
36
33
|
|
|
37
34
|
class GOVUKFrontendError extends Error {
|
|
38
35
|
constructor(...args) {
|
|
@@ -61,7 +58,7 @@ class ConfigError extends GOVUKFrontendError {
|
|
|
61
58
|
class ElementError extends GOVUKFrontendError {
|
|
62
59
|
constructor(messageOrOptions) {
|
|
63
60
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
64
|
-
if (
|
|
61
|
+
if (isObject(messageOrOptions)) {
|
|
65
62
|
const {
|
|
66
63
|
component,
|
|
67
64
|
identifier,
|
|
@@ -70,7 +67,9 @@ class ElementError extends GOVUKFrontendError {
|
|
|
70
67
|
} = messageOrOptions;
|
|
71
68
|
message = identifier;
|
|
72
69
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
73
|
-
|
|
70
|
+
if (component) {
|
|
71
|
+
message = formatErrorMessage(component, message);
|
|
72
|
+
}
|
|
74
73
|
}
|
|
75
74
|
super(message);
|
|
76
75
|
this.name = 'ElementError';
|
|
@@ -284,6 +283,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
284
283
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
285
284
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
286
285
|
*/
|
|
286
|
+
/**
|
|
287
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
288
|
+
*/
|
|
287
289
|
|
|
288
290
|
const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
289
291
|
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
// show the error state. This presents feedback to the user that the value
|
|
17
17
|
// has become invalid without needing to see the counter.
|
|
18
18
|
.govuk-textarea--error:focus {
|
|
19
|
-
border-color:
|
|
20
|
-
box-shadow: inset 0 0 0 $govuk-border-width-form-element
|
|
19
|
+
border-color: govuk-functional-colour(error);
|
|
20
|
+
box-shadow: inset 0 0 0 $govuk-border-width-form-element govuk-functional-colour(error);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js
CHANGED
|
@@ -41,9 +41,6 @@
|
|
|
41
41
|
* @typedef ComponentWithModuleName
|
|
42
42
|
* @property {string} moduleName - Name of the component
|
|
43
43
|
*/
|
|
44
|
-
/**
|
|
45
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
46
|
-
*/
|
|
47
44
|
|
|
48
45
|
class GOVUKFrontendError extends Error {
|
|
49
46
|
constructor(...args) {
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
class ElementError extends GOVUKFrontendError {
|
|
73
70
|
constructor(messageOrOptions) {
|
|
74
71
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
75
|
-
if (
|
|
72
|
+
if (isObject(messageOrOptions)) {
|
|
76
73
|
const {
|
|
77
74
|
component,
|
|
78
75
|
identifier,
|
|
@@ -81,7 +78,9 @@
|
|
|
81
78
|
} = messageOrOptions;
|
|
82
79
|
message = identifier;
|
|
83
80
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
84
|
-
|
|
81
|
+
if (component) {
|
|
82
|
+
message = formatErrorMessage(component, message);
|
|
83
|
+
}
|
|
85
84
|
}
|
|
86
85
|
super(message);
|
|
87
86
|
this.name = 'ElementError';
|
|
@@ -315,6 +314,9 @@
|
|
|
315
314
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
316
315
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
317
316
|
*/
|
|
317
|
+
/**
|
|
318
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
319
|
+
*/
|
|
318
320
|
|
|
319
321
|
class I18n {
|
|
320
322
|
constructor(translations = {}, config = {}) {
|
|
@@ -329,7 +331,7 @@
|
|
|
329
331
|
throw new Error('i18n: lookup key missing');
|
|
330
332
|
}
|
|
331
333
|
let translation = this.translations[lookupKey];
|
|
332
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
334
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
333
335
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
334
336
|
if (translationPluralForm) {
|
|
335
337
|
translation = translationPluralForm;
|
|
@@ -371,8 +373,8 @@
|
|
|
371
373
|
return 'other';
|
|
372
374
|
}
|
|
373
375
|
const translation = this.translations[lookupKey];
|
|
374
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
375
|
-
if (
|
|
376
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
377
|
+
if (isObject(translation)) {
|
|
376
378
|
if (preferredForm in translation) {
|
|
377
379
|
return preferredForm;
|
|
378
380
|
} else if ('other' in translation) {
|
|
@@ -382,132 +384,7 @@
|
|
|
382
384
|
}
|
|
383
385
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
384
386
|
}
|
|
385
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
386
|
-
count = Math.abs(Math.floor(count));
|
|
387
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
388
|
-
if (ruleset) {
|
|
389
|
-
return I18n.pluralRules[ruleset](count);
|
|
390
|
-
}
|
|
391
|
-
return 'other';
|
|
392
|
-
}
|
|
393
|
-
getPluralRulesForLocale() {
|
|
394
|
-
const localeShort = this.locale.split('-')[0];
|
|
395
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
396
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
397
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
398
|
-
return pluralRule;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
387
|
}
|
|
403
|
-
I18n.pluralRulesMap = {
|
|
404
|
-
arabic: ['ar'],
|
|
405
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
406
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
407
|
-
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'],
|
|
408
|
-
irish: ['ga'],
|
|
409
|
-
russian: ['ru', 'uk'],
|
|
410
|
-
scottish: ['gd'],
|
|
411
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
412
|
-
welsh: ['cy']
|
|
413
|
-
};
|
|
414
|
-
I18n.pluralRules = {
|
|
415
|
-
arabic(n) {
|
|
416
|
-
if (n === 0) {
|
|
417
|
-
return 'zero';
|
|
418
|
-
}
|
|
419
|
-
if (n === 1) {
|
|
420
|
-
return 'one';
|
|
421
|
-
}
|
|
422
|
-
if (n === 2) {
|
|
423
|
-
return 'two';
|
|
424
|
-
}
|
|
425
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
426
|
-
return 'few';
|
|
427
|
-
}
|
|
428
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
429
|
-
return 'many';
|
|
430
|
-
}
|
|
431
|
-
return 'other';
|
|
432
|
-
},
|
|
433
|
-
chinese() {
|
|
434
|
-
return 'other';
|
|
435
|
-
},
|
|
436
|
-
french(n) {
|
|
437
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
438
|
-
},
|
|
439
|
-
german(n) {
|
|
440
|
-
return n === 1 ? 'one' : 'other';
|
|
441
|
-
},
|
|
442
|
-
irish(n) {
|
|
443
|
-
if (n === 1) {
|
|
444
|
-
return 'one';
|
|
445
|
-
}
|
|
446
|
-
if (n === 2) {
|
|
447
|
-
return 'two';
|
|
448
|
-
}
|
|
449
|
-
if (n >= 3 && n <= 6) {
|
|
450
|
-
return 'few';
|
|
451
|
-
}
|
|
452
|
-
if (n >= 7 && n <= 10) {
|
|
453
|
-
return 'many';
|
|
454
|
-
}
|
|
455
|
-
return 'other';
|
|
456
|
-
},
|
|
457
|
-
russian(n) {
|
|
458
|
-
const lastTwo = n % 100;
|
|
459
|
-
const last = lastTwo % 10;
|
|
460
|
-
if (last === 1 && lastTwo !== 11) {
|
|
461
|
-
return 'one';
|
|
462
|
-
}
|
|
463
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
464
|
-
return 'few';
|
|
465
|
-
}
|
|
466
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
467
|
-
return 'many';
|
|
468
|
-
}
|
|
469
|
-
return 'other';
|
|
470
|
-
},
|
|
471
|
-
scottish(n) {
|
|
472
|
-
if (n === 1 || n === 11) {
|
|
473
|
-
return 'one';
|
|
474
|
-
}
|
|
475
|
-
if (n === 2 || n === 12) {
|
|
476
|
-
return 'two';
|
|
477
|
-
}
|
|
478
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
479
|
-
return 'few';
|
|
480
|
-
}
|
|
481
|
-
return 'other';
|
|
482
|
-
},
|
|
483
|
-
spanish(n) {
|
|
484
|
-
if (n === 1) {
|
|
485
|
-
return 'one';
|
|
486
|
-
}
|
|
487
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
488
|
-
return 'many';
|
|
489
|
-
}
|
|
490
|
-
return 'other';
|
|
491
|
-
},
|
|
492
|
-
welsh(n) {
|
|
493
|
-
if (n === 0) {
|
|
494
|
-
return 'zero';
|
|
495
|
-
}
|
|
496
|
-
if (n === 1) {
|
|
497
|
-
return 'one';
|
|
498
|
-
}
|
|
499
|
-
if (n === 2) {
|
|
500
|
-
return 'two';
|
|
501
|
-
}
|
|
502
|
-
if (n === 3) {
|
|
503
|
-
return 'few';
|
|
504
|
-
}
|
|
505
|
-
if (n === 6) {
|
|
506
|
-
return 'many';
|
|
507
|
-
}
|
|
508
|
-
return 'other';
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
388
|
|
|
512
389
|
/**
|
|
513
390
|
* Character count component
|
|
@@ -542,6 +419,7 @@
|
|
|
542
419
|
var _ref, _this$config$maxwords;
|
|
543
420
|
super($root, config);
|
|
544
421
|
this.$textarea = void 0;
|
|
422
|
+
this.count = 0;
|
|
545
423
|
this.$visibleCountMessage = void 0;
|
|
546
424
|
this.$screenReaderCountMessage = void 0;
|
|
547
425
|
this.lastInputTimestamp = null;
|
|
@@ -577,7 +455,7 @@
|
|
|
577
455
|
});
|
|
578
456
|
}
|
|
579
457
|
this.$errorMessage = this.$root.querySelector('.govuk-error-message');
|
|
580
|
-
if (
|
|
458
|
+
if ($textareaDescription.textContent.match(/^\s*$/)) {
|
|
581
459
|
$textareaDescription.textContent = this.i18n.t('textareaDescription', {
|
|
582
460
|
count: this.maxLength
|
|
583
461
|
});
|
|
@@ -597,15 +475,22 @@
|
|
|
597
475
|
$textareaDescription.classList.add('govuk-visually-hidden');
|
|
598
476
|
this.$textarea.removeAttribute('maxlength');
|
|
599
477
|
this.bindChangeEvents();
|
|
600
|
-
window.addEventListener('pageshow', () =>
|
|
478
|
+
window.addEventListener('pageshow', () => {
|
|
479
|
+
if (this.$textarea.value !== this.$textarea.textContent) {
|
|
480
|
+
this.updateCount();
|
|
481
|
+
this.updateCountMessage();
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
this.updateCount();
|
|
601
485
|
this.updateCountMessage();
|
|
602
486
|
}
|
|
603
487
|
bindChangeEvents() {
|
|
604
|
-
this.$textarea.addEventListener('
|
|
488
|
+
this.$textarea.addEventListener('input', () => this.handleInput());
|
|
605
489
|
this.$textarea.addEventListener('focus', () => this.handleFocus());
|
|
606
490
|
this.$textarea.addEventListener('blur', () => this.handleBlur());
|
|
607
491
|
}
|
|
608
|
-
|
|
492
|
+
handleInput() {
|
|
493
|
+
this.updateCount();
|
|
609
494
|
this.updateVisibleCountMessage();
|
|
610
495
|
this.lastInputTimestamp = Date.now();
|
|
611
496
|
}
|
|
@@ -632,7 +517,7 @@
|
|
|
632
517
|
this.updateScreenReaderCountMessage();
|
|
633
518
|
}
|
|
634
519
|
updateVisibleCountMessage() {
|
|
635
|
-
const remainingNumber = this.maxLength - this.count
|
|
520
|
+
const remainingNumber = this.maxLength - this.count;
|
|
636
521
|
const isError = remainingNumber < 0;
|
|
637
522
|
this.$visibleCountMessage.classList.toggle('govuk-character-count__message--disabled', !this.isOverThreshold());
|
|
638
523
|
if (!this.$errorMessage) {
|
|
@@ -650,16 +535,18 @@
|
|
|
650
535
|
}
|
|
651
536
|
this.$screenReaderCountMessage.textContent = this.getCountMessage();
|
|
652
537
|
}
|
|
653
|
-
|
|
538
|
+
updateCount() {
|
|
539
|
+
const text = this.$textarea.value;
|
|
654
540
|
if (this.config.maxwords) {
|
|
655
541
|
var _text$match;
|
|
656
542
|
const tokens = (_text$match = text.match(/\S+/g)) != null ? _text$match : [];
|
|
657
|
-
|
|
543
|
+
this.count = tokens.length;
|
|
544
|
+
return;
|
|
658
545
|
}
|
|
659
|
-
|
|
546
|
+
this.count = text.length;
|
|
660
547
|
}
|
|
661
548
|
getCountMessage() {
|
|
662
|
-
const remainingNumber = this.maxLength - this.count
|
|
549
|
+
const remainingNumber = this.maxLength - this.count;
|
|
663
550
|
const countType = this.config.maxwords ? 'words' : 'characters';
|
|
664
551
|
return this.formatCountMessage(remainingNumber, countType);
|
|
665
552
|
}
|
|
@@ -676,7 +563,7 @@
|
|
|
676
563
|
if (!this.config.threshold) {
|
|
677
564
|
return true;
|
|
678
565
|
}
|
|
679
|
-
const currentLength = this.count
|
|
566
|
+
const currentLength = this.count;
|
|
680
567
|
const maxLength = this.maxLength;
|
|
681
568
|
const thresholdValue = maxLength * this.config.threshold / 100;
|
|
682
569
|
return thresholdValue <= currentLength;
|