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
|
@@ -6,7 +6,6 @@ export { Checkboxes } from './components/checkboxes/checkboxes.mjs';
|
|
|
6
6
|
export { ErrorSummary } from './components/error-summary/error-summary.mjs';
|
|
7
7
|
export { ExitThisPage } from './components/exit-this-page/exit-this-page.mjs';
|
|
8
8
|
export { FileUpload } from './components/file-upload/file-upload.mjs';
|
|
9
|
-
export { Header } from './components/header/header.mjs';
|
|
10
9
|
export { NotificationBanner } from './components/notification-banner/notification-banner.mjs';
|
|
11
10
|
export { PasswordInput } from './components/password-input/password-input.mjs';
|
|
12
11
|
export { Radios } from './components/radios/radios.mjs';
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#1D70B8" d="M0 0h32v32H0z"/><path fill="#fff" d="m16.88 7.87 2.11 1.1V5.86l-2.11.67c-.06-.08-.13-.15-.2-.21s.85-2.68.85-2.68h-3.04l.85 2.67c-.08.07-.15.14-.2.21s-2.11-.66-2.11-.66v3.11l2.11-1.11c.06.09.14.16.22.22l-1.21 3.66v.01c0 .01 0 0 0 0-.06.18-.09.38-.09.58 0 .99.73 1.81 1.68 1.95h.04c.08.01.16.02.25.02.08 0 .17 0 .25-.02h.04c.95-.14 1.68-.96 1.68-1.95 0-.2-.03-.39-.09-.58s0 0 0-.01L16.7 8.08c.08-.06.16-.13.22-.22M9.16 12.3a1.75 1.75 0 1 0 1.52-3.15c-.86-.41-1.91-.04-2.33.83s-.05 1.91.81 2.32M4.82 15.87c.9.37 1.92-.05 2.29-.94s-.05-1.92-.95-2.29c-.88-.36-1.91.07-2.28.96s.06 1.91.94 2.27M22.86 12.3a1.75 1.75 0 1 1-1.52-3.15c.86-.41 1.91-.04 2.33.83s.05 1.91-.81 2.32M27.18 15.84c-.9.37-1.92-.05-2.29-.94s.05-1.92.95-2.29c.88-.36 1.91.07 2.28.96s-.06 1.91-.94 2.27M16 25.68c3.59 0 6.99.24 10.02.68.86-3.61 1.91-5.68 2.99-7.16l-2.03-.72c.2 1.03.23 1.51 0 2.18-.34-.33-.65-.93-.9-1.85l-.99 3.28c.6-.41 1.06-.68 1.59-.69-.94 2.02-2.11 2.54-2.87 2.4-.93-.17-1.35-1-1.21-1.7.21-.99 1.23-1.25 1.71-.1.91-1.86-.63-2.44-1.63-1.89 1.53-1.52 1.7-2.88.47-4.52-1.72 1.31-1.74 2.61-.97 4.44-1-1.15-2.56-.53-2 1.32.72-1.12 1.68-.42 1.53.65-.13.93-1.35 1.68-2.87 1.54-2.18-.2-2.31-1.71-2.37-2.95.54-.1 1.5.4 2.33 1.56l.3-3.48c-.9.93-1.71 1.11-2.62 1.14.3-.94 1.69-2.48 1.69-2.48h-4.34s1.38 1.54 1.69 2.48c-.91-.03-1.72-.21-2.62-1.14l.3 3.48c.82-1.16 1.79-1.66 2.33-1.56-.05 1.25-.18 2.75-2.37 2.95-1.52.13-2.75-.62-2.87-1.54-.15-1.06.81-1.77 1.53-.65.56-1.85-1-2.47-2-1.32.77-1.83.75-3.13-.97-4.44-1.23 1.64-1.06 2.99.47 4.52-.99-.55-2.54.03-1.63 1.89.48-1.16 1.5-.9 1.71.1.14.7-.28 1.53-1.21 1.7-.76.14-1.93-.38-2.87-2.4.53.01.99.28 1.59.69l-.99-3.28c-.25.92-.57 1.52-.9 1.85-.23-.66-.19-1.14 0-2.18l-2.03.72c1.08 1.47 2.13 3.54 2.99 7.16 3.03-.43 6.42-.68 10.01-.68"/></svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '../component.mjs';
|
|
2
2
|
import { ConfigError } from '../errors/index.mjs';
|
|
3
|
-
import { isObject, formatErrorMessage } from './index.mjs';
|
|
3
|
+
import { isObject, formatErrorMessage, isScope } from './index.mjs';
|
|
4
4
|
|
|
5
5
|
const configOverride = Symbol.for('configOverride');
|
|
6
6
|
class ConfigurableComponent extends Component {
|
|
@@ -70,6 +70,30 @@ function normaliseDataset(Component, dataset) {
|
|
|
70
70
|
}
|
|
71
71
|
return out;
|
|
72
72
|
}
|
|
73
|
+
function normaliseOptions(scopeOrOptions) {
|
|
74
|
+
let $scope = document;
|
|
75
|
+
let onError;
|
|
76
|
+
if (isObject(scopeOrOptions)) {
|
|
77
|
+
const options = scopeOrOptions;
|
|
78
|
+
if (isScope(options.scope) || options.scope === null) {
|
|
79
|
+
$scope = options.scope;
|
|
80
|
+
}
|
|
81
|
+
if (typeof options.onError === 'function') {
|
|
82
|
+
onError = options.onError;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (isScope(scopeOrOptions)) {
|
|
86
|
+
$scope = scopeOrOptions;
|
|
87
|
+
} else if (scopeOrOptions === null) {
|
|
88
|
+
$scope = null;
|
|
89
|
+
} else if (typeof scopeOrOptions === 'function') {
|
|
90
|
+
onError = scopeOrOptions;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
scope: $scope,
|
|
94
|
+
onError
|
|
95
|
+
};
|
|
96
|
+
}
|
|
73
97
|
function mergeConfigs(...configObjects) {
|
|
74
98
|
const formattedConfigObject = {};
|
|
75
99
|
for (const configObject of configObjects) {
|
|
@@ -164,6 +188,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
164
188
|
* @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
|
|
165
189
|
* @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
|
166
190
|
*/
|
|
191
|
+
/**
|
|
192
|
+
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
193
|
+
*/
|
|
167
194
|
|
|
168
|
-
export { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseString, validateConfig };
|
|
195
|
+
export { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseOptions, normaliseString, validateConfig };
|
|
169
196
|
//# sourceMappingURL=configuration.mjs.map
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function getFragmentFromUrl(url) {
|
|
2
|
-
if (!url.includes('#')) {
|
|
3
|
-
return undefined;
|
|
4
|
-
}
|
|
5
|
-
return url.split('#').pop();
|
|
6
|
-
}
|
|
7
1
|
function getBreakpoint(name) {
|
|
8
2
|
const property = `--govuk-breakpoint-${name}`;
|
|
9
3
|
const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);
|
|
@@ -61,6 +55,9 @@ function isArray(option) {
|
|
|
61
55
|
function isObject(option) {
|
|
62
56
|
return !!option && typeof option === 'object' && !isArray(option);
|
|
63
57
|
}
|
|
58
|
+
function isScope($scope) {
|
|
59
|
+
return !!$scope && ($scope instanceof Element || $scope instanceof Document);
|
|
60
|
+
}
|
|
64
61
|
function formatErrorMessage(Component, message) {
|
|
65
62
|
return `${Component.moduleName}: ${message}`;
|
|
66
63
|
}
|
|
@@ -68,9 +65,6 @@ function formatErrorMessage(Component, message) {
|
|
|
68
65
|
* @typedef ComponentWithModuleName
|
|
69
66
|
* @property {string} moduleName - Name of the component
|
|
70
67
|
*/
|
|
71
|
-
/**
|
|
72
|
-
* @import { ObjectNested } from './configuration.mjs'
|
|
73
|
-
*/
|
|
74
68
|
|
|
75
|
-
export { formatErrorMessage, getBreakpoint,
|
|
69
|
+
export { formatErrorMessage, getBreakpoint, isInitialised, isObject, isScope, isSupported, setFocus };
|
|
76
70
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@include govuk-exports("govuk/component/accordion") {
|
|
2
2
|
$govuk-accordion-base-colour: govuk-colour("black");
|
|
3
|
-
$govuk-accordion-hover-colour: govuk-colour("
|
|
4
|
-
$govuk-accordion-icon-focus-colour:
|
|
3
|
+
$govuk-accordion-hover-colour: govuk-colour("black", $variant: "tint-95");
|
|
4
|
+
$govuk-accordion-icon-focus-colour: govuk-functional-colour(focus);
|
|
5
5
|
$govuk-accordion-bottom-border-width: 1px;
|
|
6
6
|
|
|
7
7
|
.govuk-accordion {
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
.govuk-frontend-supported {
|
|
40
40
|
.govuk-accordion {
|
|
41
41
|
// Border at the bottom of the whole accordion
|
|
42
|
-
border-bottom: $govuk-accordion-bottom-border-width solid
|
|
42
|
+
border-bottom: $govuk-accordion-bottom-border-width solid;
|
|
43
|
+
border-bottom-color: govuk-functional-colour(border);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
.govuk-accordion__section {
|
|
@@ -83,13 +84,13 @@
|
|
|
83
84
|
|
|
84
85
|
border-width: 0;
|
|
85
86
|
|
|
86
|
-
color:
|
|
87
|
+
color: govuk-functional-colour(link);
|
|
87
88
|
background: none;
|
|
88
89
|
|
|
89
90
|
cursor: pointer;
|
|
90
91
|
-webkit-appearance: none;
|
|
91
92
|
|
|
92
|
-
@
|
|
93
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
93
94
|
margin-bottom: 14px;
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -188,14 +189,16 @@
|
|
|
188
189
|
|
|
189
190
|
border: 0;
|
|
190
191
|
|
|
191
|
-
border-top: $govuk-accordion-bottom-border-width solid
|
|
192
|
+
border-top: $govuk-accordion-bottom-border-width solid;
|
|
192
193
|
|
|
193
194
|
// Visually separate the section from the one underneath when user changes
|
|
194
195
|
// colours in their browser. See
|
|
195
196
|
// https://github.com/alphagov/govuk-frontend/issues/2321#issuecomment-924201488
|
|
196
197
|
border-bottom: govuk-spacing(2) solid transparent;
|
|
197
198
|
|
|
198
|
-
color:
|
|
199
|
+
border-top-color: govuk-functional-colour(border);
|
|
200
|
+
|
|
201
|
+
color: govuk-functional-colour(text);
|
|
199
202
|
background: none;
|
|
200
203
|
|
|
201
204
|
text-align: left;
|
|
@@ -203,12 +206,12 @@
|
|
|
203
206
|
cursor: pointer;
|
|
204
207
|
-webkit-appearance: none;
|
|
205
208
|
|
|
206
|
-
@
|
|
209
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
207
210
|
padding-bottom: govuk-spacing(2);
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
&:active {
|
|
211
|
-
color:
|
|
214
|
+
color: govuk-functional-colour(link-active);
|
|
212
215
|
background: none;
|
|
213
216
|
}
|
|
214
217
|
|
|
@@ -266,7 +269,7 @@
|
|
|
266
269
|
padding-bottom: govuk-spacing(3);
|
|
267
270
|
border-bottom: 0;
|
|
268
271
|
|
|
269
|
-
@
|
|
272
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
270
273
|
padding-bottom: govuk-spacing(4);
|
|
271
274
|
}
|
|
272
275
|
}
|
|
@@ -276,7 +279,7 @@
|
|
|
276
279
|
.govuk-accordion__section-button:focus .govuk-accordion__section-toggle-focus {
|
|
277
280
|
padding-bottom: 3px;
|
|
278
281
|
|
|
279
|
-
@
|
|
282
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
280
283
|
padding-bottom: 2px;
|
|
281
284
|
}
|
|
282
285
|
}
|
|
@@ -298,7 +301,7 @@
|
|
|
298
301
|
.govuk-accordion__section-toggle {
|
|
299
302
|
@include govuk-font-size($size: 19);
|
|
300
303
|
@include govuk-typography-weight-regular;
|
|
301
|
-
color:
|
|
304
|
+
color: govuk-functional-colour(link);
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
// Add space between the icon and text. Avoid applying spacing directly to
|
|
@@ -355,12 +358,12 @@
|
|
|
355
358
|
// remove hover state as it can be stuck in that state (iOS).
|
|
356
359
|
@media (hover: none) {
|
|
357
360
|
.govuk-accordion__section-header:hover {
|
|
358
|
-
border-top-color:
|
|
361
|
+
border-top-color: govuk-functional-colour(border);
|
|
359
362
|
|
|
360
|
-
box-shadow: inset 0 3px 0 0
|
|
363
|
+
box-shadow: inset 0 3px 0 0 govuk-functional-colour(link);
|
|
361
364
|
|
|
362
365
|
.govuk-accordion__section-button {
|
|
363
|
-
border-top-color:
|
|
366
|
+
border-top-color: govuk-functional-colour(border);
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
369
|
}
|
|
@@ -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
|
class I18n {
|
|
295
297
|
constructor(translations = {}, config = {}) {
|
|
@@ -304,7 +306,7 @@
|
|
|
304
306
|
throw new Error('i18n: lookup key missing');
|
|
305
307
|
}
|
|
306
308
|
let translation = this.translations[lookupKey];
|
|
307
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
309
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
308
310
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
309
311
|
if (translationPluralForm) {
|
|
310
312
|
translation = translationPluralForm;
|
|
@@ -346,8 +348,8 @@
|
|
|
346
348
|
return 'other';
|
|
347
349
|
}
|
|
348
350
|
const translation = this.translations[lookupKey];
|
|
349
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
350
|
-
if (
|
|
351
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
352
|
+
if (isObject(translation)) {
|
|
351
353
|
if (preferredForm in translation) {
|
|
352
354
|
return preferredForm;
|
|
353
355
|
} else if ('other' in translation) {
|
|
@@ -357,132 +359,7 @@
|
|
|
357
359
|
}
|
|
358
360
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
359
361
|
}
|
|
360
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
361
|
-
count = Math.abs(Math.floor(count));
|
|
362
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
363
|
-
if (ruleset) {
|
|
364
|
-
return I18n.pluralRules[ruleset](count);
|
|
365
|
-
}
|
|
366
|
-
return 'other';
|
|
367
|
-
}
|
|
368
|
-
getPluralRulesForLocale() {
|
|
369
|
-
const localeShort = this.locale.split('-')[0];
|
|
370
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
371
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
372
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
373
|
-
return pluralRule;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
362
|
}
|
|
378
|
-
I18n.pluralRulesMap = {
|
|
379
|
-
arabic: ['ar'],
|
|
380
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
381
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
382
|
-
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'],
|
|
383
|
-
irish: ['ga'],
|
|
384
|
-
russian: ['ru', 'uk'],
|
|
385
|
-
scottish: ['gd'],
|
|
386
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
387
|
-
welsh: ['cy']
|
|
388
|
-
};
|
|
389
|
-
I18n.pluralRules = {
|
|
390
|
-
arabic(n) {
|
|
391
|
-
if (n === 0) {
|
|
392
|
-
return 'zero';
|
|
393
|
-
}
|
|
394
|
-
if (n === 1) {
|
|
395
|
-
return 'one';
|
|
396
|
-
}
|
|
397
|
-
if (n === 2) {
|
|
398
|
-
return 'two';
|
|
399
|
-
}
|
|
400
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
401
|
-
return 'few';
|
|
402
|
-
}
|
|
403
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
404
|
-
return 'many';
|
|
405
|
-
}
|
|
406
|
-
return 'other';
|
|
407
|
-
},
|
|
408
|
-
chinese() {
|
|
409
|
-
return 'other';
|
|
410
|
-
},
|
|
411
|
-
french(n) {
|
|
412
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
413
|
-
},
|
|
414
|
-
german(n) {
|
|
415
|
-
return n === 1 ? 'one' : 'other';
|
|
416
|
-
},
|
|
417
|
-
irish(n) {
|
|
418
|
-
if (n === 1) {
|
|
419
|
-
return 'one';
|
|
420
|
-
}
|
|
421
|
-
if (n === 2) {
|
|
422
|
-
return 'two';
|
|
423
|
-
}
|
|
424
|
-
if (n >= 3 && n <= 6) {
|
|
425
|
-
return 'few';
|
|
426
|
-
}
|
|
427
|
-
if (n >= 7 && n <= 10) {
|
|
428
|
-
return 'many';
|
|
429
|
-
}
|
|
430
|
-
return 'other';
|
|
431
|
-
},
|
|
432
|
-
russian(n) {
|
|
433
|
-
const lastTwo = n % 100;
|
|
434
|
-
const last = lastTwo % 10;
|
|
435
|
-
if (last === 1 && lastTwo !== 11) {
|
|
436
|
-
return 'one';
|
|
437
|
-
}
|
|
438
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
439
|
-
return 'few';
|
|
440
|
-
}
|
|
441
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
442
|
-
return 'many';
|
|
443
|
-
}
|
|
444
|
-
return 'other';
|
|
445
|
-
},
|
|
446
|
-
scottish(n) {
|
|
447
|
-
if (n === 1 || n === 11) {
|
|
448
|
-
return 'one';
|
|
449
|
-
}
|
|
450
|
-
if (n === 2 || n === 12) {
|
|
451
|
-
return 'two';
|
|
452
|
-
}
|
|
453
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
454
|
-
return 'few';
|
|
455
|
-
}
|
|
456
|
-
return 'other';
|
|
457
|
-
},
|
|
458
|
-
spanish(n) {
|
|
459
|
-
if (n === 1) {
|
|
460
|
-
return 'one';
|
|
461
|
-
}
|
|
462
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
463
|
-
return 'many';
|
|
464
|
-
}
|
|
465
|
-
return 'other';
|
|
466
|
-
},
|
|
467
|
-
welsh(n) {
|
|
468
|
-
if (n === 0) {
|
|
469
|
-
return 'zero';
|
|
470
|
-
}
|
|
471
|
-
if (n === 1) {
|
|
472
|
-
return 'one';
|
|
473
|
-
}
|
|
474
|
-
if (n === 2) {
|
|
475
|
-
return 'two';
|
|
476
|
-
}
|
|
477
|
-
if (n === 3) {
|
|
478
|
-
return 'few';
|
|
479
|
-
}
|
|
480
|
-
if (n === 6) {
|
|
481
|
-
return 'many';
|
|
482
|
-
}
|
|
483
|
-
return 'other';
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
363
|
|
|
487
364
|
/**
|
|
488
365
|
* Accordion component
|
|
@@ -683,11 +560,11 @@
|
|
|
683
560
|
const ariaLabelParts = [];
|
|
684
561
|
const $headingText = $section.querySelector(`.${this.sectionHeadingTextClass}`);
|
|
685
562
|
if ($headingText) {
|
|
686
|
-
ariaLabelParts.push(
|
|
563
|
+
ariaLabelParts.push($headingText.textContent.trim());
|
|
687
564
|
}
|
|
688
565
|
const $summary = $section.querySelector(`.${this.sectionSummaryClass}`);
|
|
689
566
|
if ($summary) {
|
|
690
|
-
ariaLabelParts.push(
|
|
567
|
+
ariaLabelParts.push($summary.textContent.trim());
|
|
691
568
|
}
|
|
692
569
|
const ariaLabelMessage = expanded ? this.i18n.t('hideSectionAriaLabel') : this.i18n.t('showSectionAriaLabel');
|
|
693
570
|
ariaLabelParts.push(ariaLabelMessage);
|
|
@@ -740,7 +617,7 @@
|
|
|
740
617
|
if (id) {
|
|
741
618
|
try {
|
|
742
619
|
window.sessionStorage.setItem(id, isExpanded.toString());
|
|
743
|
-
} catch (
|
|
620
|
+
} catch (_unused) {}
|
|
744
621
|
}
|
|
745
622
|
}
|
|
746
623
|
setInitialState($section) {
|
|
@@ -754,7 +631,7 @@
|
|
|
754
631
|
if (state !== null) {
|
|
755
632
|
this.setExpanded(state === 'true', $section);
|
|
756
633
|
}
|
|
757
|
-
} catch (
|
|
634
|
+
} catch (_unused2) {}
|
|
758
635
|
}
|
|
759
636
|
}
|
|
760
637
|
getButtonPunctuationEl() {
|
|
@@ -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
|
class I18n {
|
|
289
291
|
constructor(translations = {}, config = {}) {
|
|
@@ -298,7 +300,7 @@ class I18n {
|
|
|
298
300
|
throw new Error('i18n: lookup key missing');
|
|
299
301
|
}
|
|
300
302
|
let translation = this.translations[lookupKey];
|
|
301
|
-
if (typeof (options == null ? void 0 : options.count) === 'number' &&
|
|
303
|
+
if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
|
|
302
304
|
const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
|
|
303
305
|
if (translationPluralForm) {
|
|
304
306
|
translation = translationPluralForm;
|
|
@@ -340,8 +342,8 @@ class I18n {
|
|
|
340
342
|
return 'other';
|
|
341
343
|
}
|
|
342
344
|
const translation = this.translations[lookupKey];
|
|
343
|
-
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) :
|
|
344
|
-
if (
|
|
345
|
+
const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
|
|
346
|
+
if (isObject(translation)) {
|
|
345
347
|
if (preferredForm in translation) {
|
|
346
348
|
return preferredForm;
|
|
347
349
|
} else if ('other' in translation) {
|
|
@@ -351,132 +353,7 @@ class I18n {
|
|
|
351
353
|
}
|
|
352
354
|
throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
|
|
353
355
|
}
|
|
354
|
-
selectPluralFormUsingFallbackRules(count) {
|
|
355
|
-
count = Math.abs(Math.floor(count));
|
|
356
|
-
const ruleset = this.getPluralRulesForLocale();
|
|
357
|
-
if (ruleset) {
|
|
358
|
-
return I18n.pluralRules[ruleset](count);
|
|
359
|
-
}
|
|
360
|
-
return 'other';
|
|
361
|
-
}
|
|
362
|
-
getPluralRulesForLocale() {
|
|
363
|
-
const localeShort = this.locale.split('-')[0];
|
|
364
|
-
for (const pluralRule in I18n.pluralRulesMap) {
|
|
365
|
-
const languages = I18n.pluralRulesMap[pluralRule];
|
|
366
|
-
if (languages.includes(this.locale) || languages.includes(localeShort)) {
|
|
367
|
-
return pluralRule;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
356
|
}
|
|
372
|
-
I18n.pluralRulesMap = {
|
|
373
|
-
arabic: ['ar'],
|
|
374
|
-
chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
|
|
375
|
-
french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
|
|
376
|
-
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'],
|
|
377
|
-
irish: ['ga'],
|
|
378
|
-
russian: ['ru', 'uk'],
|
|
379
|
-
scottish: ['gd'],
|
|
380
|
-
spanish: ['pt-PT', 'it', 'es'],
|
|
381
|
-
welsh: ['cy']
|
|
382
|
-
};
|
|
383
|
-
I18n.pluralRules = {
|
|
384
|
-
arabic(n) {
|
|
385
|
-
if (n === 0) {
|
|
386
|
-
return 'zero';
|
|
387
|
-
}
|
|
388
|
-
if (n === 1) {
|
|
389
|
-
return 'one';
|
|
390
|
-
}
|
|
391
|
-
if (n === 2) {
|
|
392
|
-
return 'two';
|
|
393
|
-
}
|
|
394
|
-
if (n % 100 >= 3 && n % 100 <= 10) {
|
|
395
|
-
return 'few';
|
|
396
|
-
}
|
|
397
|
-
if (n % 100 >= 11 && n % 100 <= 99) {
|
|
398
|
-
return 'many';
|
|
399
|
-
}
|
|
400
|
-
return 'other';
|
|
401
|
-
},
|
|
402
|
-
chinese() {
|
|
403
|
-
return 'other';
|
|
404
|
-
},
|
|
405
|
-
french(n) {
|
|
406
|
-
return n === 0 || n === 1 ? 'one' : 'other';
|
|
407
|
-
},
|
|
408
|
-
german(n) {
|
|
409
|
-
return n === 1 ? 'one' : 'other';
|
|
410
|
-
},
|
|
411
|
-
irish(n) {
|
|
412
|
-
if (n === 1) {
|
|
413
|
-
return 'one';
|
|
414
|
-
}
|
|
415
|
-
if (n === 2) {
|
|
416
|
-
return 'two';
|
|
417
|
-
}
|
|
418
|
-
if (n >= 3 && n <= 6) {
|
|
419
|
-
return 'few';
|
|
420
|
-
}
|
|
421
|
-
if (n >= 7 && n <= 10) {
|
|
422
|
-
return 'many';
|
|
423
|
-
}
|
|
424
|
-
return 'other';
|
|
425
|
-
},
|
|
426
|
-
russian(n) {
|
|
427
|
-
const lastTwo = n % 100;
|
|
428
|
-
const last = lastTwo % 10;
|
|
429
|
-
if (last === 1 && lastTwo !== 11) {
|
|
430
|
-
return 'one';
|
|
431
|
-
}
|
|
432
|
-
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
|
|
433
|
-
return 'few';
|
|
434
|
-
}
|
|
435
|
-
if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
|
|
436
|
-
return 'many';
|
|
437
|
-
}
|
|
438
|
-
return 'other';
|
|
439
|
-
},
|
|
440
|
-
scottish(n) {
|
|
441
|
-
if (n === 1 || n === 11) {
|
|
442
|
-
return 'one';
|
|
443
|
-
}
|
|
444
|
-
if (n === 2 || n === 12) {
|
|
445
|
-
return 'two';
|
|
446
|
-
}
|
|
447
|
-
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
|
|
448
|
-
return 'few';
|
|
449
|
-
}
|
|
450
|
-
return 'other';
|
|
451
|
-
},
|
|
452
|
-
spanish(n) {
|
|
453
|
-
if (n === 1) {
|
|
454
|
-
return 'one';
|
|
455
|
-
}
|
|
456
|
-
if (n % 1000000 === 0 && n !== 0) {
|
|
457
|
-
return 'many';
|
|
458
|
-
}
|
|
459
|
-
return 'other';
|
|
460
|
-
},
|
|
461
|
-
welsh(n) {
|
|
462
|
-
if (n === 0) {
|
|
463
|
-
return 'zero';
|
|
464
|
-
}
|
|
465
|
-
if (n === 1) {
|
|
466
|
-
return 'one';
|
|
467
|
-
}
|
|
468
|
-
if (n === 2) {
|
|
469
|
-
return 'two';
|
|
470
|
-
}
|
|
471
|
-
if (n === 3) {
|
|
472
|
-
return 'few';
|
|
473
|
-
}
|
|
474
|
-
if (n === 6) {
|
|
475
|
-
return 'many';
|
|
476
|
-
}
|
|
477
|
-
return 'other';
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
357
|
|
|
481
358
|
/**
|
|
482
359
|
* Accordion component
|
|
@@ -677,11 +554,11 @@ class Accordion extends ConfigurableComponent {
|
|
|
677
554
|
const ariaLabelParts = [];
|
|
678
555
|
const $headingText = $section.querySelector(`.${this.sectionHeadingTextClass}`);
|
|
679
556
|
if ($headingText) {
|
|
680
|
-
ariaLabelParts.push(
|
|
557
|
+
ariaLabelParts.push($headingText.textContent.trim());
|
|
681
558
|
}
|
|
682
559
|
const $summary = $section.querySelector(`.${this.sectionSummaryClass}`);
|
|
683
560
|
if ($summary) {
|
|
684
|
-
ariaLabelParts.push(
|
|
561
|
+
ariaLabelParts.push($summary.textContent.trim());
|
|
685
562
|
}
|
|
686
563
|
const ariaLabelMessage = expanded ? this.i18n.t('hideSectionAriaLabel') : this.i18n.t('showSectionAriaLabel');
|
|
687
564
|
ariaLabelParts.push(ariaLabelMessage);
|
|
@@ -734,7 +611,7 @@ class Accordion extends ConfigurableComponent {
|
|
|
734
611
|
if (id) {
|
|
735
612
|
try {
|
|
736
613
|
window.sessionStorage.setItem(id, isExpanded.toString());
|
|
737
|
-
} catch (
|
|
614
|
+
} catch (_unused) {}
|
|
738
615
|
}
|
|
739
616
|
}
|
|
740
617
|
setInitialState($section) {
|
|
@@ -748,7 +625,7 @@ class Accordion extends ConfigurableComponent {
|
|
|
748
625
|
if (state !== null) {
|
|
749
626
|
this.setExpanded(state === 'true', $section);
|
|
750
627
|
}
|
|
751
|
-
} catch (
|
|
628
|
+
} catch (_unused2) {}
|
|
752
629
|
}
|
|
753
630
|
}
|
|
754
631
|
getButtonPunctuationEl() {
|