defra_ruby_template 6.4.0 → 6.6.0
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/README.md +73 -19
- data/Rakefile +10 -33
- data/lib/defra_ruby_template/version.rb +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +202 -137
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +202 -137
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +5 -1
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/create-element.mjs +13 -0
- data/node_modules/govuk-frontend/dist/govuk/common/create-element.mjs.map +1 -0
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/component.mjs +2 -1
- data/node_modules/govuk-frontend/dist/govuk/component.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/_index.import.scss +2 -0
- data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +2 -0
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +87 -62
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +87 -62
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +60 -56
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +17 -6
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +17 -6
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/button.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +90 -32
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +90 -32
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +64 -27
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/fixtures.json +173 -6
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/macro-options.json +13 -6
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters-and-error-message.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters-and-threshold.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters-and-value.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-characters.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-length.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words-and-error-message.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words-and-threshold.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words-and-value.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-count-type-words.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-maxwords.html +9 -0
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template.njk +10 -3
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_mixin.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +17 -6
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +17 -6
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +43 -18
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +43 -18
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs +16 -12
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_feedback.import.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_index.import.scss +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_index.scss +5 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/_mixin.scss +48 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/fixtures.json +95 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/macro-options.json +50 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/template-default.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/template-silly-example.html +19 -0
- data/node_modules/govuk-frontend/dist/govuk/components/feedback/template.njk +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +54 -30
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +54 -30
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +27 -24
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_mixin.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/README.md +15 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_index.import.scss +8 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_index.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_language-navigation.import.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/_mixin.scss +68 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/fixtures.json +482 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/macro-options.json +88 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/macro.njk +3 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-default.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-inverse.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-language-description.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-large-amount-of-multiple-languages.html +99 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-mixed-text-directions.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-multiple-languages.html +24 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template-with-translated-navigation-label.html +12 -0
- data/node_modules/govuk-frontend/dist/govuk/components/language-navigation/template.njk +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +17 -6
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +17 -6
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/panel/fixtures.json +13 -11
- data/node_modules/govuk-frontend/dist/govuk/components/panel/template-interruption-with-headings-content-and-lists.html +6 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +32 -9
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +32 -9
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs +5 -3
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_mixin.scss +48 -3
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/fixtures.json +121 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/macro-options.json +20 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-inverse-with-language-navigation.html +72 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-inline-end-slot.html +33 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-language-navigation.html +62 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template-with-right-aligned-language-navigation.html +62 -0
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/template.njk +8 -3
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +14 -6
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +14 -6
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +2 -1
- data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +12 -5
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.mixin.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.mixin.scss +1 -0
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +8 -5
- data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/init.mjs +8 -8
- data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +16 -2
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +9 -1
- data/node_modules/govuk-frontend/package.json +9 -7
- data/vendor/assets/javascripts/defra_ruby_template.js +202 -137
- data/vendor/assets/stylesheets/components/_index.import.scss +2 -0
- data/vendor/assets/stylesheets/components/_index.scss +2 -0
- data/vendor/assets/stylesheets/components/cookie-banner/_mixin.scss +6 -0
- data/vendor/assets/stylesheets/components/feedback/_feedback.import.scss +6 -0
- data/vendor/assets/stylesheets/components/feedback/_index.import.scss +8 -0
- data/vendor/assets/stylesheets/components/feedback/_index.scss +5 -0
- data/vendor/assets/stylesheets/components/feedback/_mixin.scss +48 -0
- data/vendor/assets/stylesheets/components/footer/_mixin.scss +6 -0
- data/vendor/assets/stylesheets/components/language-navigation/_index.import.scss +8 -0
- data/vendor/assets/stylesheets/components/language-navigation/_index.scss +6 -0
- data/vendor/assets/stylesheets/components/language-navigation/_language-navigation.import.scss +6 -0
- data/vendor/assets/stylesheets/components/language-navigation/_mixin.scss +68 -0
- data/vendor/assets/stylesheets/components/service-navigation/_mixin.scss +48 -3
- data/vendor/assets/stylesheets/custom-properties/_frontend-version.mixin.scss +1 -1
- data/vendor/assets/stylesheets/custom-properties/_functional-colours.mixin.scss +1 -0
- data/vendor/assets/stylesheets/defra_ruby_template.scss +8 -30
- data/vendor/assets/stylesheets/govuk-frontend.min.css +2 -2
- data/vendor/assets/stylesheets/helpers/_colour.scss +1 -1
- data/vendor/assets/stylesheets/settings/_colours-organisations.scss +16 -2
- metadata +53 -3
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/template-with-word-count.html +0 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const version = '6.
|
|
1
|
+
const version = '6.6.0';
|
|
2
2
|
|
|
3
3
|
function getBreakpoint(name) {
|
|
4
4
|
const property = `--govuk-breakpoint-${name}`;
|
|
@@ -78,11 +78,14 @@ class SupportError extends GOVUKFrontendError {
|
|
|
78
78
|
/**
|
|
79
79
|
* Checks if GOV.UK Frontend is supported on this page
|
|
80
80
|
*
|
|
81
|
-
* @param {
|
|
81
|
+
* @param {Element | Document | null | string} [scopeOrMessage] - HTML element `<body>` checked for browser support or support error message
|
|
82
82
|
*/
|
|
83
|
-
constructor(
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
constructor(scopeOrMessage = document.body) {
|
|
84
|
+
let supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';
|
|
85
|
+
if (!isScope(scopeOrMessage)) {
|
|
86
|
+
supportMessage = 'GOV.UK Frontend initialised without `<script type="module">`';
|
|
87
|
+
}
|
|
88
|
+
super(typeof scopeOrMessage === 'string' ? scopeOrMessage : supportMessage);
|
|
86
89
|
this.name = 'SupportError';
|
|
87
90
|
}
|
|
88
91
|
}
|
|
@@ -123,6 +126,7 @@ class InitError extends GOVUKFrontendError {
|
|
|
123
126
|
* @import { ComponentWithModuleName } from '../common/index.mjs'
|
|
124
127
|
*/
|
|
125
128
|
|
|
129
|
+
const _self$1 = typeof globalThis !== 'undefined' ? globalThis : self;
|
|
126
130
|
class Component {
|
|
127
131
|
/**
|
|
128
132
|
* Returns the root element of the component
|
|
@@ -176,7 +180,7 @@ class Component {
|
|
|
176
180
|
/**
|
|
177
181
|
* @typedef {typeof Component & ChildClass} ChildClassConstructor
|
|
178
182
|
*/
|
|
179
|
-
Component.elementType = HTMLElement;
|
|
183
|
+
Component.elementType = _self$1.HTMLElement;
|
|
180
184
|
|
|
181
185
|
const configOverride = Symbol.for('configOverride');
|
|
182
186
|
class ConfigurableComponent extends Component {
|
|
@@ -201,10 +205,14 @@ class ConfigurableComponent extends Component {
|
|
|
201
205
|
throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
|
|
202
206
|
}
|
|
203
207
|
const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
|
|
204
|
-
this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}
|
|
208
|
+
this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {});
|
|
209
|
+
this._config = mergeConfigs(this._config, this[configOverride](datasetConfig), datasetConfig);
|
|
205
210
|
}
|
|
206
211
|
}
|
|
207
212
|
function normaliseString(value, property) {
|
|
213
|
+
if (property != null && property.type && !['string', 'number', 'boolean'].includes(property.type)) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
208
216
|
const trimmedValue = value ? value.trim() : '';
|
|
209
217
|
let output;
|
|
210
218
|
let outputType = property == null ? void 0 : property.type;
|
|
@@ -368,6 +376,17 @@ function extractConfigByNamespace(schema, dataset, namespace) {
|
|
|
368
376
|
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
369
377
|
*/
|
|
370
378
|
|
|
379
|
+
function createElement(tagName, attributes = {}, children = []) {
|
|
380
|
+
const $element = document.createElement(tagName);
|
|
381
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
382
|
+
$element.setAttribute(name, value);
|
|
383
|
+
});
|
|
384
|
+
for (const child of children) {
|
|
385
|
+
$element.append(child);
|
|
386
|
+
}
|
|
387
|
+
return $element;
|
|
388
|
+
}
|
|
389
|
+
|
|
371
390
|
class I18n {
|
|
372
391
|
constructor(translations = {}, config = {}) {
|
|
373
392
|
var _config$locale;
|
|
@@ -459,24 +478,16 @@ class Accordion extends ConfigurableComponent {
|
|
|
459
478
|
constructor($root, config = {}) {
|
|
460
479
|
super($root, config);
|
|
461
480
|
this.i18n = void 0;
|
|
462
|
-
this.controlsClass = 'govuk-accordion__controls';
|
|
463
|
-
this.showAllClass = 'govuk-accordion__show-all';
|
|
464
|
-
this.showAllTextClass = 'govuk-accordion__show-all-text';
|
|
465
481
|
this.sectionClass = 'govuk-accordion__section';
|
|
466
|
-
this.
|
|
482
|
+
this.sectionExpandedModifier = 'govuk-accordion__section--expanded';
|
|
467
483
|
this.sectionButtonClass = 'govuk-accordion__section-button';
|
|
468
484
|
this.sectionHeaderClass = 'govuk-accordion__section-header';
|
|
469
485
|
this.sectionHeadingClass = 'govuk-accordion__section-heading';
|
|
470
|
-
this.sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider';
|
|
471
486
|
this.sectionHeadingTextClass = 'govuk-accordion__section-heading-text';
|
|
472
|
-
this.
|
|
473
|
-
this.
|
|
474
|
-
this.
|
|
475
|
-
this.sectionShowHideTextClass = 'govuk-accordion__section-toggle-text';
|
|
476
|
-
this.upChevronIconClass = 'govuk-accordion-nav__chevron';
|
|
477
|
-
this.downChevronIconClass = 'govuk-accordion-nav__chevron--down';
|
|
487
|
+
this.sectionToggleTextClass = 'govuk-accordion__section-toggle-text';
|
|
488
|
+
this.iconClass = 'govuk-accordion-nav__chevron';
|
|
489
|
+
this.iconOpenModifier = 'govuk-accordion-nav__chevron--down';
|
|
478
490
|
this.sectionSummaryClass = 'govuk-accordion__section-summary';
|
|
479
|
-
this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
|
|
480
491
|
this.sectionContentClass = 'govuk-accordion__section-content';
|
|
481
492
|
this.$sections = void 0;
|
|
482
493
|
this.$showAllButton = null;
|
|
@@ -496,19 +507,23 @@ class Accordion extends ConfigurableComponent {
|
|
|
496
507
|
this.updateShowAllButton(this.areAllSectionsOpen());
|
|
497
508
|
}
|
|
498
509
|
initControls() {
|
|
499
|
-
this.$showAllButton =
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
this.$showAllIcon
|
|
510
|
+
this.$showAllButton = createElement('button', {
|
|
511
|
+
type: 'button',
|
|
512
|
+
class: 'govuk-accordion__show-all',
|
|
513
|
+
'aria-expanded': 'false'
|
|
514
|
+
});
|
|
515
|
+
this.$showAllIcon = createElement('span', {
|
|
516
|
+
class: this.iconClass
|
|
517
|
+
});
|
|
505
518
|
this.$showAllButton.appendChild(this.$showAllIcon);
|
|
506
|
-
const $accordionControls =
|
|
507
|
-
|
|
519
|
+
const $accordionControls = createElement('div', {
|
|
520
|
+
class: 'govuk-accordion__controls'
|
|
521
|
+
});
|
|
508
522
|
$accordionControls.appendChild(this.$showAllButton);
|
|
509
523
|
this.$root.insertBefore($accordionControls, this.$root.firstChild);
|
|
510
|
-
this.$showAllText =
|
|
511
|
-
|
|
524
|
+
this.$showAllText = createElement('span', {
|
|
525
|
+
class: 'govuk-accordion__show-all-text'
|
|
526
|
+
});
|
|
512
527
|
this.$showAllButton.appendChild(this.$showAllText);
|
|
513
528
|
this.$showAllButton.addEventListener('click', () => this.onShowOrHideAllToggle());
|
|
514
529
|
if ('onbeforematch' in document) {
|
|
@@ -546,39 +561,45 @@ class Accordion extends ConfigurableComponent {
|
|
|
546
561
|
identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
|
|
547
562
|
});
|
|
548
563
|
}
|
|
549
|
-
const $button =
|
|
550
|
-
|
|
551
|
-
|
|
564
|
+
const $button = createElement('button', {
|
|
565
|
+
type: 'button',
|
|
566
|
+
'aria-controls': `${this.$root.id}-content-${index + 1}`
|
|
567
|
+
});
|
|
552
568
|
for (const attr of Array.from($span.attributes)) {
|
|
553
569
|
if (attr.name !== 'id') {
|
|
554
570
|
$button.setAttribute(attr.name, attr.value);
|
|
555
571
|
}
|
|
556
572
|
}
|
|
557
|
-
const $headingText =
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
$headingTextFocus
|
|
573
|
+
const $headingText = createElement('span', {
|
|
574
|
+
class: this.sectionHeadingTextClass,
|
|
575
|
+
id: $span.id
|
|
576
|
+
});
|
|
577
|
+
const $headingTextFocus = createElement('span', {
|
|
578
|
+
class: 'govuk-accordion__section-heading-text-focus'
|
|
579
|
+
});
|
|
562
580
|
$headingText.appendChild($headingTextFocus);
|
|
563
581
|
Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
|
|
564
|
-
const $showHideToggle =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
$showHideToggleFocus
|
|
582
|
+
const $showHideToggle = createElement('span', {
|
|
583
|
+
class: 'govuk-accordion__section-toggle',
|
|
584
|
+
'data-nosnippet': ''
|
|
585
|
+
});
|
|
586
|
+
const $showHideToggleFocus = createElement('span', {
|
|
587
|
+
class: 'govuk-accordion__section-toggle-focus'
|
|
588
|
+
});
|
|
569
589
|
$showHideToggle.appendChild($showHideToggleFocus);
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
$showHideToggleFocus.appendChild(
|
|
574
|
-
|
|
575
|
-
|
|
590
|
+
$showHideToggleFocus.appendChild(createElement('span', {
|
|
591
|
+
class: this.iconClass
|
|
592
|
+
}));
|
|
593
|
+
$showHideToggleFocus.appendChild(createElement('span', {
|
|
594
|
+
class: this.sectionToggleTextClass
|
|
595
|
+
}));
|
|
576
596
|
$button.appendChild($headingText);
|
|
577
597
|
$button.appendChild(this.getButtonPunctuationEl());
|
|
578
598
|
if ($summary) {
|
|
579
|
-
const $summarySpan =
|
|
580
|
-
const $summarySpanFocus =
|
|
581
|
-
|
|
599
|
+
const $summarySpan = createElement('span');
|
|
600
|
+
const $summarySpanFocus = createElement('span', {
|
|
601
|
+
class: 'govuk-accordion__section-summary-focus'
|
|
602
|
+
});
|
|
582
603
|
$summarySpan.appendChild($summarySpanFocus);
|
|
583
604
|
for (const attr of Array.from($summary.attributes)) {
|
|
584
605
|
$summarySpan.setAttribute(attr.name, attr.value);
|
|
@@ -616,8 +637,8 @@ class Accordion extends ConfigurableComponent {
|
|
|
616
637
|
this.updateShowAllButton(nowExpanded);
|
|
617
638
|
}
|
|
618
639
|
setExpanded(expanded, $section) {
|
|
619
|
-
const $showHideIcon = $section.querySelector(`.${this.
|
|
620
|
-
const $showHideText = $section.querySelector(`.${this.
|
|
640
|
+
const $showHideIcon = $section.querySelector(`.${this.iconClass}`);
|
|
641
|
+
const $showHideText = $section.querySelector(`.${this.sectionToggleTextClass}`);
|
|
621
642
|
const $button = $section.querySelector(`.${this.sectionButtonClass}`);
|
|
622
643
|
const $content = $section.querySelector(`.${this.sectionContentClass}`);
|
|
623
644
|
if (!$content) {
|
|
@@ -646,17 +667,17 @@ class Accordion extends ConfigurableComponent {
|
|
|
646
667
|
$button.setAttribute('aria-label', ariaLabelParts.join(' , '));
|
|
647
668
|
if (expanded) {
|
|
648
669
|
$content.removeAttribute('hidden');
|
|
649
|
-
$section.classList.add(this.
|
|
650
|
-
$showHideIcon.classList.remove(this.
|
|
670
|
+
$section.classList.add(this.sectionExpandedModifier);
|
|
671
|
+
$showHideIcon.classList.remove(this.iconOpenModifier);
|
|
651
672
|
} else {
|
|
652
673
|
$content.setAttribute('hidden', 'until-found');
|
|
653
|
-
$section.classList.remove(this.
|
|
654
|
-
$showHideIcon.classList.add(this.
|
|
674
|
+
$section.classList.remove(this.sectionExpandedModifier);
|
|
675
|
+
$showHideIcon.classList.add(this.iconOpenModifier);
|
|
655
676
|
}
|
|
656
677
|
this.updateShowAllButton(this.areAllSectionsOpen());
|
|
657
678
|
}
|
|
658
679
|
isExpanded($section) {
|
|
659
|
-
return $section.classList.contains(this.
|
|
680
|
+
return $section.classList.contains(this.sectionExpandedModifier);
|
|
660
681
|
}
|
|
661
682
|
areAllSectionsOpen() {
|
|
662
683
|
return Array.from(this.$sections).every($section => this.isExpanded($section));
|
|
@@ -667,7 +688,7 @@ class Accordion extends ConfigurableComponent {
|
|
|
667
688
|
}
|
|
668
689
|
this.$showAllButton.setAttribute('aria-expanded', expanded.toString());
|
|
669
690
|
this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
|
|
670
|
-
this.$showAllIcon.classList.toggle(this.
|
|
691
|
+
this.$showAllIcon.classList.toggle(this.iconOpenModifier, !expanded);
|
|
671
692
|
}
|
|
672
693
|
|
|
673
694
|
/**
|
|
@@ -710,10 +731,11 @@ class Accordion extends ConfigurableComponent {
|
|
|
710
731
|
}
|
|
711
732
|
}
|
|
712
733
|
getButtonPunctuationEl() {
|
|
713
|
-
const $
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
734
|
+
const $element = createElement('span', {
|
|
735
|
+
class: 'govuk-visually-hidden govuk-accordion__section-heading-divider'
|
|
736
|
+
});
|
|
737
|
+
$element.textContent = ', ';
|
|
738
|
+
return $element;
|
|
717
739
|
}
|
|
718
740
|
}
|
|
719
741
|
|
|
@@ -869,6 +891,14 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
869
891
|
maxwords: undefined
|
|
870
892
|
};
|
|
871
893
|
}
|
|
894
|
+
if ('maxwords' in datasetConfig || this.config.maxwords !== undefined) {
|
|
895
|
+
console.warn(formatErrorMessage(CharacterCount, 'Option `maxwords` is deprecated. Use `maxlength` with `countType: "words"` instead.'));
|
|
896
|
+
if (!('maxlength' in datasetConfig)) {
|
|
897
|
+
var _datasetConfig$maxwor;
|
|
898
|
+
configOverrides.maxlength = (_datasetConfig$maxwor = datasetConfig.maxwords) != null ? _datasetConfig$maxwor : this.config.maxwords;
|
|
899
|
+
configOverrides.countType = 'words';
|
|
900
|
+
}
|
|
901
|
+
}
|
|
872
902
|
return configOverrides;
|
|
873
903
|
}
|
|
874
904
|
|
|
@@ -877,10 +907,11 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
877
907
|
* @param {CharacterCountConfig} [config] - Character count config
|
|
878
908
|
*/
|
|
879
909
|
constructor($root, config = {}) {
|
|
880
|
-
var
|
|
910
|
+
var _this$config$maxlengt;
|
|
881
911
|
super($root, config);
|
|
882
912
|
this.$textarea = void 0;
|
|
883
913
|
this.count = 0;
|
|
914
|
+
this.segmenter = null;
|
|
884
915
|
this.$visibleCountMessage = void 0;
|
|
885
916
|
this.$screenReaderCountMessage = void 0;
|
|
886
917
|
this.lastInputTimestamp = null;
|
|
@@ -904,7 +935,15 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
904
935
|
this.i18n = new I18n(this.config.i18n, {
|
|
905
936
|
locale: closestAttributeValue(this.$root, 'lang')
|
|
906
937
|
});
|
|
907
|
-
this.
|
|
938
|
+
if (this.config.countType === 'characters' || this.config.countType === 'words' && this.config.maxwords === undefined) {
|
|
939
|
+
if (!('Segmenter' in Intl)) {
|
|
940
|
+
throw new SupportError(formatErrorMessage(CharacterCount, 'Support for "Intl.Segmenter" required'));
|
|
941
|
+
}
|
|
942
|
+
this.segmenter = new Intl.Segmenter(this.i18n.locale, {
|
|
943
|
+
granularity: this.config.countType === 'words' ? 'word' : 'grapheme'
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
this.maxLength = (_this$config$maxlengt = this.config.maxlength) != null ? _this$config$maxlengt : Infinity;
|
|
908
947
|
this.$textarea = $textarea;
|
|
909
948
|
const textareaDescriptionId = `${this.$textarea.id}-info`;
|
|
910
949
|
const $textareaDescription = document.getElementById(textareaDescriptionId);
|
|
@@ -922,15 +961,16 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
922
961
|
});
|
|
923
962
|
}
|
|
924
963
|
this.$textarea.insertAdjacentElement('afterend', $textareaDescription);
|
|
925
|
-
const $screenReaderCountMessage =
|
|
926
|
-
|
|
927
|
-
|
|
964
|
+
const $screenReaderCountMessage = createElement('div', {
|
|
965
|
+
class: 'govuk-character-count__sr-status govuk-visually-hidden',
|
|
966
|
+
'aria-live': 'polite'
|
|
967
|
+
});
|
|
928
968
|
this.$screenReaderCountMessage = $screenReaderCountMessage;
|
|
929
969
|
$textareaDescription.insertAdjacentElement('afterend', $screenReaderCountMessage);
|
|
930
|
-
const $visibleCountMessage =
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
970
|
+
const $visibleCountMessage = createElement('div', {
|
|
971
|
+
class: `${$textareaDescription.className} govuk-character-count__status`,
|
|
972
|
+
'aria-hidden': 'true'
|
|
973
|
+
});
|
|
934
974
|
this.$visibleCountMessage = $visibleCountMessage;
|
|
935
975
|
$textareaDescription.insertAdjacentElement('afterend', $visibleCountMessage);
|
|
936
976
|
$textareaDescription.classList.add('govuk-visually-hidden');
|
|
@@ -998,26 +1038,38 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
998
1038
|
}
|
|
999
1039
|
updateCount() {
|
|
1000
1040
|
const text = this.$textarea.value;
|
|
1001
|
-
if (this.config.
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1041
|
+
if (this.config.countType === 'characters') {
|
|
1042
|
+
this.count = this.segmenter ? Array.from(this.segmenter.segment(text)).length : 0;
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
if (this.config.countType === 'words') {
|
|
1046
|
+
if (this.config.maxwords !== undefined) {
|
|
1047
|
+
var _text$match$length, _text$match;
|
|
1048
|
+
this.count = (_text$match$length = (_text$match = text.match(/\S+/g)) == null ? void 0 : _text$match.length) != null ? _text$match$length : 0;
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
const segments = this.segmenter ? Array.from(this.segmenter.segment(text)) : [];
|
|
1052
|
+
this.count = segments.filter(segment => segment.isWordLike).length;
|
|
1005
1053
|
return;
|
|
1006
1054
|
}
|
|
1007
1055
|
this.count = text.length;
|
|
1008
1056
|
}
|
|
1009
1057
|
getCountMessage() {
|
|
1010
1058
|
const remainingNumber = this.maxLength - this.count;
|
|
1011
|
-
|
|
1012
|
-
return this.formatCountMessage(remainingNumber, countType);
|
|
1059
|
+
return this.formatCountMessage(remainingNumber);
|
|
1013
1060
|
}
|
|
1014
1061
|
formatCountMessage(remainingNumber, countType) {
|
|
1062
|
+
countType = countType != null ? countType : this.config.countType;
|
|
1063
|
+
let translationKeyPrefix = 'characters';
|
|
1064
|
+
let translationKeySuffix = remainingNumber < 0 ? 'OverLimit' : 'UnderLimit';
|
|
1065
|
+
if (countType === 'words') {
|
|
1066
|
+
translationKeyPrefix = 'words';
|
|
1067
|
+
}
|
|
1015
1068
|
if (remainingNumber === 0) {
|
|
1016
|
-
|
|
1069
|
+
translationKeySuffix = 'AtLimit';
|
|
1017
1070
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
count: Math.abs(remainingNumber)
|
|
1071
|
+
return this.i18n.t(`${translationKeyPrefix}${translationKeySuffix}`, {
|
|
1072
|
+
count: remainingNumber === 0 ? undefined : Math.abs(remainingNumber)
|
|
1021
1073
|
});
|
|
1022
1074
|
}
|
|
1023
1075
|
isOverThreshold() {
|
|
@@ -1036,13 +1088,15 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1036
1088
|
*
|
|
1037
1089
|
* @see {@link CharacterCount.defaults}
|
|
1038
1090
|
* @typedef {object} CharacterCountConfig
|
|
1039
|
-
* @property {number} [maxlength] - The maximum number of characters
|
|
1040
|
-
*
|
|
1041
|
-
* @property {number} [maxwords] -
|
|
1042
|
-
*
|
|
1091
|
+
* @property {number} [maxlength] - The maximum number of characters (or words
|
|
1092
|
+
* if `countType` is set to `"words"`).
|
|
1093
|
+
* @property {number} [maxwords] - Deprecated. Use `maxlength` and
|
|
1094
|
+
* `countType: "words"` instead.
|
|
1043
1095
|
* @property {number} [threshold=0] - The percentage value of the limit at
|
|
1044
1096
|
* which point the count message is displayed. If this attribute is set, the
|
|
1045
1097
|
* count message will be hidden by default.
|
|
1098
|
+
* @property {'characters' | 'length' | 'words'} [countType] - The count type
|
|
1099
|
+
* (`"characters"`, `"length"` or `"words"`) used to count the text.
|
|
1046
1100
|
* @property {CharacterCountTranslations} [i18n=CharacterCount.defaults.i18n] - Character count translations
|
|
1047
1101
|
*/
|
|
1048
1102
|
|
|
@@ -1088,9 +1142,9 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1088
1142
|
* @property {TranslationPluralForms} [textareaDescription] - Message made
|
|
1089
1143
|
* available to assistive technologies, if none is already present in the
|
|
1090
1144
|
* HTML, to describe that the component accepts only a limited amount of
|
|
1091
|
-
* content. It is visible on the page
|
|
1092
|
-
* component will replace the `%{count}`
|
|
1093
|
-
*
|
|
1145
|
+
* content. It is visible on the page if `countType` is not supported or
|
|
1146
|
+
* JavaScript is unavailable. The component will replace the `%{count}`
|
|
1147
|
+
* placeholder with the value of the `maxlength` parameter.
|
|
1094
1148
|
*/
|
|
1095
1149
|
|
|
1096
1150
|
/**
|
|
@@ -1100,6 +1154,7 @@ class CharacterCount extends ConfigurableComponent {
|
|
|
1100
1154
|
CharacterCount.moduleName = 'govuk-character-count';
|
|
1101
1155
|
CharacterCount.defaults = Object.freeze({
|
|
1102
1156
|
threshold: 0,
|
|
1157
|
+
countType: 'length',
|
|
1103
1158
|
i18n: {
|
|
1104
1159
|
charactersUnderLimit: {
|
|
1105
1160
|
one: 'You have %{count} character remaining',
|
|
@@ -1137,6 +1192,9 @@ CharacterCount.schema = Object.freeze({
|
|
|
1137
1192
|
},
|
|
1138
1193
|
threshold: {
|
|
1139
1194
|
type: 'number'
|
|
1195
|
+
},
|
|
1196
|
+
countType: {
|
|
1197
|
+
type: 'string'
|
|
1140
1198
|
}
|
|
1141
1199
|
},
|
|
1142
1200
|
anyOf: [{
|
|
@@ -1399,9 +1457,10 @@ class ExitThisPage extends ConfigurableComponent {
|
|
|
1399
1457
|
window.addEventListener('pageshow', this.resetPage.bind(this));
|
|
1400
1458
|
}
|
|
1401
1459
|
initUpdateSpan() {
|
|
1402
|
-
this.$updateSpan =
|
|
1403
|
-
|
|
1404
|
-
|
|
1460
|
+
this.$updateSpan = createElement('span', {
|
|
1461
|
+
role: 'status',
|
|
1462
|
+
class: 'govuk-visually-hidden'
|
|
1463
|
+
});
|
|
1405
1464
|
this.$root.appendChild(this.$updateSpan);
|
|
1406
1465
|
}
|
|
1407
1466
|
initButtonClickHandler() {
|
|
@@ -1411,13 +1470,14 @@ class ExitThisPage extends ConfigurableComponent {
|
|
|
1411
1470
|
}
|
|
1412
1471
|
}
|
|
1413
1472
|
buildIndicator() {
|
|
1414
|
-
this.$indicatorContainer =
|
|
1415
|
-
|
|
1416
|
-
|
|
1473
|
+
this.$indicatorContainer = createElement('div', {
|
|
1474
|
+
class: 'govuk-exit-this-page__indicator',
|
|
1475
|
+
'aria-hidden': 'true'
|
|
1476
|
+
});
|
|
1417
1477
|
for (let i = 0; i < 3; i++) {
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1478
|
+
this.$indicatorContainer.appendChild(createElement('div', {
|
|
1479
|
+
class: 'govuk-exit-this-page__indicator-light'
|
|
1480
|
+
}));
|
|
1421
1481
|
}
|
|
1422
1482
|
this.$button.appendChild(this.$indicatorContainer);
|
|
1423
1483
|
}
|
|
@@ -1437,9 +1497,10 @@ class ExitThisPage extends ConfigurableComponent {
|
|
|
1437
1497
|
}
|
|
1438
1498
|
this.$updateSpan.textContent = '';
|
|
1439
1499
|
document.body.classList.add('govuk-exit-this-page-hide-content');
|
|
1440
|
-
this.$overlay =
|
|
1441
|
-
|
|
1442
|
-
|
|
1500
|
+
this.$overlay = createElement('div', {
|
|
1501
|
+
class: 'govuk-exit-this-page-overlay',
|
|
1502
|
+
role: 'alert'
|
|
1503
|
+
});
|
|
1443
1504
|
document.body.appendChild(this.$overlay);
|
|
1444
1505
|
this.$overlay.textContent = this.i18n.t('activated');
|
|
1445
1506
|
window.location.href = this.$button.href;
|
|
@@ -1619,46 +1680,48 @@ class FileUpload extends ConfigurableComponent {
|
|
|
1619
1680
|
this.$input.addEventListener('change', this.onChange.bind(this));
|
|
1620
1681
|
this.updateDisabledState();
|
|
1621
1682
|
this.observeDisabledState();
|
|
1622
|
-
this.$announcements =
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1683
|
+
this.$announcements = createElement('span', {
|
|
1684
|
+
class: 'govuk-file-upload-announcements govuk-visually-hidden',
|
|
1685
|
+
'aria-live': 'assertive'
|
|
1686
|
+
});
|
|
1626
1687
|
this.$root.insertAdjacentElement('afterend', this.$announcements);
|
|
1627
1688
|
this.bindDraggingEvents();
|
|
1628
1689
|
}
|
|
1629
1690
|
createStatus() {
|
|
1630
|
-
const $status =
|
|
1631
|
-
|
|
1632
|
-
|
|
1691
|
+
const $status = createElement('span', {
|
|
1692
|
+
class: 'govuk-body govuk-file-upload-button__status',
|
|
1693
|
+
'aria-live': 'polite'
|
|
1694
|
+
});
|
|
1633
1695
|
$status.innerText = this.i18n.t('noFileChosen');
|
|
1634
1696
|
return $status;
|
|
1635
1697
|
}
|
|
1636
1698
|
createButton() {
|
|
1637
|
-
const $button =
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1699
|
+
const $button = createElement('button', {
|
|
1700
|
+
class: 'govuk-file-upload-button govuk-file-upload-button--empty',
|
|
1701
|
+
type: 'button',
|
|
1702
|
+
id: this.id
|
|
1703
|
+
});
|
|
1642
1704
|
const ariaDescribedBy = this.$input.getAttribute('aria-describedby');
|
|
1643
1705
|
if (ariaDescribedBy) {
|
|
1644
1706
|
$button.setAttribute('aria-describedby', ariaDescribedBy);
|
|
1645
1707
|
}
|
|
1646
1708
|
$button.appendChild(this.$status);
|
|
1647
|
-
const commaSpan =
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1709
|
+
const commaSpan = createElement('span', {
|
|
1710
|
+
class: 'govuk-visually-hidden',
|
|
1711
|
+
id: `${this.id}-comma`
|
|
1712
|
+
}, [', ']);
|
|
1651
1713
|
$button.appendChild(commaSpan);
|
|
1652
|
-
const containerSpan =
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
buttonSpan
|
|
1656
|
-
|
|
1714
|
+
const containerSpan = createElement('span', {
|
|
1715
|
+
class: 'govuk-file-upload-button__pseudo-button-container'
|
|
1716
|
+
});
|
|
1717
|
+
const buttonSpan = createElement('span', {
|
|
1718
|
+
class: 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button'
|
|
1719
|
+
}, [this.i18n.t('chooseFilesButton')]);
|
|
1657
1720
|
containerSpan.appendChild(buttonSpan);
|
|
1658
1721
|
containerSpan.insertAdjacentText('beforeend', ' ');
|
|
1659
|
-
const instructionSpan =
|
|
1660
|
-
|
|
1661
|
-
|
|
1722
|
+
const instructionSpan = createElement('span', {
|
|
1723
|
+
class: 'govuk-body govuk-file-upload-button__instruction'
|
|
1724
|
+
}, [this.i18n.t('dropInstruction')]);
|
|
1662
1725
|
containerSpan.appendChild(instructionSpan);
|
|
1663
1726
|
$button.appendChild(containerSpan);
|
|
1664
1727
|
$button.setAttribute('aria-labelledby', `${this.$label.id} ${commaSpan.id} ${$button.id}`);
|
|
@@ -1942,9 +2005,10 @@ class PasswordInput extends ConfigurableComponent {
|
|
|
1942
2005
|
locale: closestAttributeValue(this.$root, 'lang')
|
|
1943
2006
|
});
|
|
1944
2007
|
this.$showHideButton.removeAttribute('hidden');
|
|
1945
|
-
const $screenReaderStatusMessage =
|
|
1946
|
-
|
|
1947
|
-
|
|
2008
|
+
const $screenReaderStatusMessage = createElement('div', {
|
|
2009
|
+
class: 'govuk-password-input__sr-status govuk-visually-hidden',
|
|
2010
|
+
'aria-live': 'polite'
|
|
2011
|
+
});
|
|
1948
2012
|
this.$screenReaderStatusMessage = $screenReaderStatusMessage;
|
|
1949
2013
|
this.$input.insertAdjacentElement('afterend', $screenReaderStatusMessage);
|
|
1950
2014
|
this.$showHideButton.addEventListener('click', this.toggle.bind(this));
|
|
@@ -2228,6 +2292,7 @@ function removeAttributes($element, attributeNames) {
|
|
|
2228
2292
|
}
|
|
2229
2293
|
}
|
|
2230
2294
|
|
|
2295
|
+
const _self = typeof globalThis !== 'undefined' ? globalThis : self;
|
|
2231
2296
|
/**
|
|
2232
2297
|
* Skip link component
|
|
2233
2298
|
*
|
|
@@ -2271,7 +2336,7 @@ class SkipLink extends Component {
|
|
|
2271
2336
|
}));
|
|
2272
2337
|
}
|
|
2273
2338
|
}
|
|
2274
|
-
SkipLink.elementType = HTMLAnchorElement;
|
|
2339
|
+
SkipLink.elementType = _self.HTMLAnchorElement;
|
|
2275
2340
|
SkipLink.moduleName = 'govuk-skip-link';
|
|
2276
2341
|
|
|
2277
2342
|
/**
|
|
@@ -2656,14 +2721,14 @@ function createAll(Component, config, scopeOrOptions) {
|
|
|
2656
2721
|
* @typedef {object} Config
|
|
2657
2722
|
* @property {Element | Document | null} [scope] - Scope of the document to search within
|
|
2658
2723
|
* @property {OnErrorCallback<CompatibleClass>} [onError] - Initialisation error callback
|
|
2659
|
-
* @property {
|
|
2660
|
-
* @property {
|
|
2661
|
-
* @property {
|
|
2662
|
-
* @property {
|
|
2663
|
-
* @property {
|
|
2664
|
-
* @property {
|
|
2665
|
-
* @property {
|
|
2666
|
-
* @property {
|
|
2724
|
+
* @property {ComponentConfig<typeof Accordion>} [accordion] - Accordion config
|
|
2725
|
+
* @property {ComponentConfig<typeof Button>} [button] - Button config
|
|
2726
|
+
* @property {ComponentConfig<typeof CharacterCount>} [characterCount] - Character Count config
|
|
2727
|
+
* @property {ComponentConfig<typeof ErrorSummary>} [errorSummary] - Error Summary config
|
|
2728
|
+
* @property {ComponentConfig<typeof ExitThisPage>} [exitThisPage] - Exit This Page config
|
|
2729
|
+
* @property {ComponentConfig<typeof FileUpload>} [fileUpload] - File Upload config
|
|
2730
|
+
* @property {ComponentConfig<typeof NotificationBanner>} [notificationBanner] - Notification Banner config
|
|
2731
|
+
* @property {ComponentConfig<typeof PasswordInput>} [passwordInput] - Password input config
|
|
2667
2732
|
*/
|
|
2668
2733
|
/**
|
|
2669
2734
|
* Config for individual components
|