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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.GOVUKFrontend = global.GOVUKFrontend || {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
const version = '6.
|
|
7
|
+
const version = '6.6.0';
|
|
8
8
|
|
|
9
9
|
function getBreakpoint(name) {
|
|
10
10
|
const property = `--govuk-breakpoint-${name}`;
|
|
@@ -84,11 +84,14 @@
|
|
|
84
84
|
/**
|
|
85
85
|
* Checks if GOV.UK Frontend is supported on this page
|
|
86
86
|
*
|
|
87
|
-
* @param {
|
|
87
|
+
* @param {Element | Document | null | string} [scopeOrMessage] - HTML element `<body>` checked for browser support or support error message
|
|
88
88
|
*/
|
|
89
|
-
constructor(
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
constructor(scopeOrMessage = document.body) {
|
|
90
|
+
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';
|
|
91
|
+
if (!isScope(scopeOrMessage)) {
|
|
92
|
+
supportMessage = 'GOV.UK Frontend initialised without `<script type="module">`';
|
|
93
|
+
}
|
|
94
|
+
super(typeof scopeOrMessage === 'string' ? scopeOrMessage : supportMessage);
|
|
92
95
|
this.name = 'SupportError';
|
|
93
96
|
}
|
|
94
97
|
}
|
|
@@ -129,6 +132,7 @@
|
|
|
129
132
|
* @import { ComponentWithModuleName } from '../common/index.mjs'
|
|
130
133
|
*/
|
|
131
134
|
|
|
135
|
+
const _self$1 = typeof globalThis !== 'undefined' ? globalThis : self;
|
|
132
136
|
class Component {
|
|
133
137
|
/**
|
|
134
138
|
* Returns the root element of the component
|
|
@@ -182,7 +186,7 @@
|
|
|
182
186
|
/**
|
|
183
187
|
* @typedef {typeof Component & ChildClass} ChildClassConstructor
|
|
184
188
|
*/
|
|
185
|
-
Component.elementType = HTMLElement;
|
|
189
|
+
Component.elementType = _self$1.HTMLElement;
|
|
186
190
|
|
|
187
191
|
const configOverride = Symbol.for('configOverride');
|
|
188
192
|
class ConfigurableComponent extends Component {
|
|
@@ -207,10 +211,14 @@
|
|
|
207
211
|
throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
|
|
208
212
|
}
|
|
209
213
|
const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
|
|
210
|
-
this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}
|
|
214
|
+
this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {});
|
|
215
|
+
this._config = mergeConfigs(this._config, this[configOverride](datasetConfig), datasetConfig);
|
|
211
216
|
}
|
|
212
217
|
}
|
|
213
218
|
function normaliseString(value, property) {
|
|
219
|
+
if (property != null && property.type && !['string', 'number', 'boolean'].includes(property.type)) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
214
222
|
const trimmedValue = value ? value.trim() : '';
|
|
215
223
|
let output;
|
|
216
224
|
let outputType = property == null ? void 0 : property.type;
|
|
@@ -374,6 +382,17 @@
|
|
|
374
382
|
* @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
|
|
375
383
|
*/
|
|
376
384
|
|
|
385
|
+
function createElement(tagName, attributes = {}, children = []) {
|
|
386
|
+
const $element = document.createElement(tagName);
|
|
387
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
388
|
+
$element.setAttribute(name, value);
|
|
389
|
+
});
|
|
390
|
+
for (const child of children) {
|
|
391
|
+
$element.append(child);
|
|
392
|
+
}
|
|
393
|
+
return $element;
|
|
394
|
+
}
|
|
395
|
+
|
|
377
396
|
class I18n {
|
|
378
397
|
constructor(translations = {}, config = {}) {
|
|
379
398
|
var _config$locale;
|
|
@@ -465,24 +484,16 @@
|
|
|
465
484
|
constructor($root, config = {}) {
|
|
466
485
|
super($root, config);
|
|
467
486
|
this.i18n = void 0;
|
|
468
|
-
this.controlsClass = 'govuk-accordion__controls';
|
|
469
|
-
this.showAllClass = 'govuk-accordion__show-all';
|
|
470
|
-
this.showAllTextClass = 'govuk-accordion__show-all-text';
|
|
471
487
|
this.sectionClass = 'govuk-accordion__section';
|
|
472
|
-
this.
|
|
488
|
+
this.sectionExpandedModifier = 'govuk-accordion__section--expanded';
|
|
473
489
|
this.sectionButtonClass = 'govuk-accordion__section-button';
|
|
474
490
|
this.sectionHeaderClass = 'govuk-accordion__section-header';
|
|
475
491
|
this.sectionHeadingClass = 'govuk-accordion__section-heading';
|
|
476
|
-
this.sectionHeadingDividerClass = 'govuk-accordion__section-heading-divider';
|
|
477
492
|
this.sectionHeadingTextClass = 'govuk-accordion__section-heading-text';
|
|
478
|
-
this.
|
|
479
|
-
this.
|
|
480
|
-
this.
|
|
481
|
-
this.sectionShowHideTextClass = 'govuk-accordion__section-toggle-text';
|
|
482
|
-
this.upChevronIconClass = 'govuk-accordion-nav__chevron';
|
|
483
|
-
this.downChevronIconClass = 'govuk-accordion-nav__chevron--down';
|
|
493
|
+
this.sectionToggleTextClass = 'govuk-accordion__section-toggle-text';
|
|
494
|
+
this.iconClass = 'govuk-accordion-nav__chevron';
|
|
495
|
+
this.iconOpenModifier = 'govuk-accordion-nav__chevron--down';
|
|
484
496
|
this.sectionSummaryClass = 'govuk-accordion__section-summary';
|
|
485
|
-
this.sectionSummaryFocusClass = 'govuk-accordion__section-summary-focus';
|
|
486
497
|
this.sectionContentClass = 'govuk-accordion__section-content';
|
|
487
498
|
this.$sections = void 0;
|
|
488
499
|
this.$showAllButton = null;
|
|
@@ -502,19 +513,23 @@
|
|
|
502
513
|
this.updateShowAllButton(this.areAllSectionsOpen());
|
|
503
514
|
}
|
|
504
515
|
initControls() {
|
|
505
|
-
this.$showAllButton =
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
this.$showAllIcon
|
|
516
|
+
this.$showAllButton = createElement('button', {
|
|
517
|
+
type: 'button',
|
|
518
|
+
class: 'govuk-accordion__show-all',
|
|
519
|
+
'aria-expanded': 'false'
|
|
520
|
+
});
|
|
521
|
+
this.$showAllIcon = createElement('span', {
|
|
522
|
+
class: this.iconClass
|
|
523
|
+
});
|
|
511
524
|
this.$showAllButton.appendChild(this.$showAllIcon);
|
|
512
|
-
const $accordionControls =
|
|
513
|
-
|
|
525
|
+
const $accordionControls = createElement('div', {
|
|
526
|
+
class: 'govuk-accordion__controls'
|
|
527
|
+
});
|
|
514
528
|
$accordionControls.appendChild(this.$showAllButton);
|
|
515
529
|
this.$root.insertBefore($accordionControls, this.$root.firstChild);
|
|
516
|
-
this.$showAllText =
|
|
517
|
-
|
|
530
|
+
this.$showAllText = createElement('span', {
|
|
531
|
+
class: 'govuk-accordion__show-all-text'
|
|
532
|
+
});
|
|
518
533
|
this.$showAllButton.appendChild(this.$showAllText);
|
|
519
534
|
this.$showAllButton.addEventListener('click', () => this.onShowOrHideAllToggle());
|
|
520
535
|
if ('onbeforematch' in document) {
|
|
@@ -552,39 +567,45 @@
|
|
|
552
567
|
identifier: `Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`
|
|
553
568
|
});
|
|
554
569
|
}
|
|
555
|
-
const $button =
|
|
556
|
-
|
|
557
|
-
|
|
570
|
+
const $button = createElement('button', {
|
|
571
|
+
type: 'button',
|
|
572
|
+
'aria-controls': `${this.$root.id}-content-${index + 1}`
|
|
573
|
+
});
|
|
558
574
|
for (const attr of Array.from($span.attributes)) {
|
|
559
575
|
if (attr.name !== 'id') {
|
|
560
576
|
$button.setAttribute(attr.name, attr.value);
|
|
561
577
|
}
|
|
562
578
|
}
|
|
563
|
-
const $headingText =
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
$headingTextFocus
|
|
579
|
+
const $headingText = createElement('span', {
|
|
580
|
+
class: this.sectionHeadingTextClass,
|
|
581
|
+
id: $span.id
|
|
582
|
+
});
|
|
583
|
+
const $headingTextFocus = createElement('span', {
|
|
584
|
+
class: 'govuk-accordion__section-heading-text-focus'
|
|
585
|
+
});
|
|
568
586
|
$headingText.appendChild($headingTextFocus);
|
|
569
587
|
Array.from($span.childNodes).forEach($child => $headingTextFocus.appendChild($child));
|
|
570
|
-
const $showHideToggle =
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
$showHideToggleFocus
|
|
588
|
+
const $showHideToggle = createElement('span', {
|
|
589
|
+
class: 'govuk-accordion__section-toggle',
|
|
590
|
+
'data-nosnippet': ''
|
|
591
|
+
});
|
|
592
|
+
const $showHideToggleFocus = createElement('span', {
|
|
593
|
+
class: 'govuk-accordion__section-toggle-focus'
|
|
594
|
+
});
|
|
575
595
|
$showHideToggle.appendChild($showHideToggleFocus);
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
$showHideToggleFocus.appendChild(
|
|
580
|
-
|
|
581
|
-
|
|
596
|
+
$showHideToggleFocus.appendChild(createElement('span', {
|
|
597
|
+
class: this.iconClass
|
|
598
|
+
}));
|
|
599
|
+
$showHideToggleFocus.appendChild(createElement('span', {
|
|
600
|
+
class: this.sectionToggleTextClass
|
|
601
|
+
}));
|
|
582
602
|
$button.appendChild($headingText);
|
|
583
603
|
$button.appendChild(this.getButtonPunctuationEl());
|
|
584
604
|
if ($summary) {
|
|
585
|
-
const $summarySpan =
|
|
586
|
-
const $summarySpanFocus =
|
|
587
|
-
|
|
605
|
+
const $summarySpan = createElement('span');
|
|
606
|
+
const $summarySpanFocus = createElement('span', {
|
|
607
|
+
class: 'govuk-accordion__section-summary-focus'
|
|
608
|
+
});
|
|
588
609
|
$summarySpan.appendChild($summarySpanFocus);
|
|
589
610
|
for (const attr of Array.from($summary.attributes)) {
|
|
590
611
|
$summarySpan.setAttribute(attr.name, attr.value);
|
|
@@ -622,8 +643,8 @@
|
|
|
622
643
|
this.updateShowAllButton(nowExpanded);
|
|
623
644
|
}
|
|
624
645
|
setExpanded(expanded, $section) {
|
|
625
|
-
const $showHideIcon = $section.querySelector(`.${this.
|
|
626
|
-
const $showHideText = $section.querySelector(`.${this.
|
|
646
|
+
const $showHideIcon = $section.querySelector(`.${this.iconClass}`);
|
|
647
|
+
const $showHideText = $section.querySelector(`.${this.sectionToggleTextClass}`);
|
|
627
648
|
const $button = $section.querySelector(`.${this.sectionButtonClass}`);
|
|
628
649
|
const $content = $section.querySelector(`.${this.sectionContentClass}`);
|
|
629
650
|
if (!$content) {
|
|
@@ -652,17 +673,17 @@
|
|
|
652
673
|
$button.setAttribute('aria-label', ariaLabelParts.join(' , '));
|
|
653
674
|
if (expanded) {
|
|
654
675
|
$content.removeAttribute('hidden');
|
|
655
|
-
$section.classList.add(this.
|
|
656
|
-
$showHideIcon.classList.remove(this.
|
|
676
|
+
$section.classList.add(this.sectionExpandedModifier);
|
|
677
|
+
$showHideIcon.classList.remove(this.iconOpenModifier);
|
|
657
678
|
} else {
|
|
658
679
|
$content.setAttribute('hidden', 'until-found');
|
|
659
|
-
$section.classList.remove(this.
|
|
660
|
-
$showHideIcon.classList.add(this.
|
|
680
|
+
$section.classList.remove(this.sectionExpandedModifier);
|
|
681
|
+
$showHideIcon.classList.add(this.iconOpenModifier);
|
|
661
682
|
}
|
|
662
683
|
this.updateShowAllButton(this.areAllSectionsOpen());
|
|
663
684
|
}
|
|
664
685
|
isExpanded($section) {
|
|
665
|
-
return $section.classList.contains(this.
|
|
686
|
+
return $section.classList.contains(this.sectionExpandedModifier);
|
|
666
687
|
}
|
|
667
688
|
areAllSectionsOpen() {
|
|
668
689
|
return Array.from(this.$sections).every($section => this.isExpanded($section));
|
|
@@ -673,7 +694,7 @@
|
|
|
673
694
|
}
|
|
674
695
|
this.$showAllButton.setAttribute('aria-expanded', expanded.toString());
|
|
675
696
|
this.$showAllText.textContent = expanded ? this.i18n.t('hideAllSections') : this.i18n.t('showAllSections');
|
|
676
|
-
this.$showAllIcon.classList.toggle(this.
|
|
697
|
+
this.$showAllIcon.classList.toggle(this.iconOpenModifier, !expanded);
|
|
677
698
|
}
|
|
678
699
|
|
|
679
700
|
/**
|
|
@@ -716,10 +737,11 @@
|
|
|
716
737
|
}
|
|
717
738
|
}
|
|
718
739
|
getButtonPunctuationEl() {
|
|
719
|
-
const $
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
740
|
+
const $element = createElement('span', {
|
|
741
|
+
class: 'govuk-visually-hidden govuk-accordion__section-heading-divider'
|
|
742
|
+
});
|
|
743
|
+
$element.textContent = ', ';
|
|
744
|
+
return $element;
|
|
723
745
|
}
|
|
724
746
|
}
|
|
725
747
|
|
|
@@ -875,6 +897,14 @@
|
|
|
875
897
|
maxwords: undefined
|
|
876
898
|
};
|
|
877
899
|
}
|
|
900
|
+
if ('maxwords' in datasetConfig || this.config.maxwords !== undefined) {
|
|
901
|
+
console.warn(formatErrorMessage(CharacterCount, 'Option `maxwords` is deprecated. Use `maxlength` with `countType: "words"` instead.'));
|
|
902
|
+
if (!('maxlength' in datasetConfig)) {
|
|
903
|
+
var _datasetConfig$maxwor;
|
|
904
|
+
configOverrides.maxlength = (_datasetConfig$maxwor = datasetConfig.maxwords) != null ? _datasetConfig$maxwor : this.config.maxwords;
|
|
905
|
+
configOverrides.countType = 'words';
|
|
906
|
+
}
|
|
907
|
+
}
|
|
878
908
|
return configOverrides;
|
|
879
909
|
}
|
|
880
910
|
|
|
@@ -883,10 +913,11 @@
|
|
|
883
913
|
* @param {CharacterCountConfig} [config] - Character count config
|
|
884
914
|
*/
|
|
885
915
|
constructor($root, config = {}) {
|
|
886
|
-
var
|
|
916
|
+
var _this$config$maxlengt;
|
|
887
917
|
super($root, config);
|
|
888
918
|
this.$textarea = void 0;
|
|
889
919
|
this.count = 0;
|
|
920
|
+
this.segmenter = null;
|
|
890
921
|
this.$visibleCountMessage = void 0;
|
|
891
922
|
this.$screenReaderCountMessage = void 0;
|
|
892
923
|
this.lastInputTimestamp = null;
|
|
@@ -910,7 +941,15 @@
|
|
|
910
941
|
this.i18n = new I18n(this.config.i18n, {
|
|
911
942
|
locale: closestAttributeValue(this.$root, 'lang')
|
|
912
943
|
});
|
|
913
|
-
this.
|
|
944
|
+
if (this.config.countType === 'characters' || this.config.countType === 'words' && this.config.maxwords === undefined) {
|
|
945
|
+
if (!('Segmenter' in Intl)) {
|
|
946
|
+
throw new SupportError(formatErrorMessage(CharacterCount, 'Support for "Intl.Segmenter" required'));
|
|
947
|
+
}
|
|
948
|
+
this.segmenter = new Intl.Segmenter(this.i18n.locale, {
|
|
949
|
+
granularity: this.config.countType === 'words' ? 'word' : 'grapheme'
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
this.maxLength = (_this$config$maxlengt = this.config.maxlength) != null ? _this$config$maxlengt : Infinity;
|
|
914
953
|
this.$textarea = $textarea;
|
|
915
954
|
const textareaDescriptionId = `${this.$textarea.id}-info`;
|
|
916
955
|
const $textareaDescription = document.getElementById(textareaDescriptionId);
|
|
@@ -928,15 +967,16 @@
|
|
|
928
967
|
});
|
|
929
968
|
}
|
|
930
969
|
this.$textarea.insertAdjacentElement('afterend', $textareaDescription);
|
|
931
|
-
const $screenReaderCountMessage =
|
|
932
|
-
|
|
933
|
-
|
|
970
|
+
const $screenReaderCountMessage = createElement('div', {
|
|
971
|
+
class: 'govuk-character-count__sr-status govuk-visually-hidden',
|
|
972
|
+
'aria-live': 'polite'
|
|
973
|
+
});
|
|
934
974
|
this.$screenReaderCountMessage = $screenReaderCountMessage;
|
|
935
975
|
$textareaDescription.insertAdjacentElement('afterend', $screenReaderCountMessage);
|
|
936
|
-
const $visibleCountMessage =
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
976
|
+
const $visibleCountMessage = createElement('div', {
|
|
977
|
+
class: `${$textareaDescription.className} govuk-character-count__status`,
|
|
978
|
+
'aria-hidden': 'true'
|
|
979
|
+
});
|
|
940
980
|
this.$visibleCountMessage = $visibleCountMessage;
|
|
941
981
|
$textareaDescription.insertAdjacentElement('afterend', $visibleCountMessage);
|
|
942
982
|
$textareaDescription.classList.add('govuk-visually-hidden');
|
|
@@ -1004,26 +1044,38 @@
|
|
|
1004
1044
|
}
|
|
1005
1045
|
updateCount() {
|
|
1006
1046
|
const text = this.$textarea.value;
|
|
1007
|
-
if (this.config.
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1047
|
+
if (this.config.countType === 'characters') {
|
|
1048
|
+
this.count = this.segmenter ? Array.from(this.segmenter.segment(text)).length : 0;
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (this.config.countType === 'words') {
|
|
1052
|
+
if (this.config.maxwords !== undefined) {
|
|
1053
|
+
var _text$match$length, _text$match;
|
|
1054
|
+
this.count = (_text$match$length = (_text$match = text.match(/\S+/g)) == null ? void 0 : _text$match.length) != null ? _text$match$length : 0;
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
const segments = this.segmenter ? Array.from(this.segmenter.segment(text)) : [];
|
|
1058
|
+
this.count = segments.filter(segment => segment.isWordLike).length;
|
|
1011
1059
|
return;
|
|
1012
1060
|
}
|
|
1013
1061
|
this.count = text.length;
|
|
1014
1062
|
}
|
|
1015
1063
|
getCountMessage() {
|
|
1016
1064
|
const remainingNumber = this.maxLength - this.count;
|
|
1017
|
-
|
|
1018
|
-
return this.formatCountMessage(remainingNumber, countType);
|
|
1065
|
+
return this.formatCountMessage(remainingNumber);
|
|
1019
1066
|
}
|
|
1020
1067
|
formatCountMessage(remainingNumber, countType) {
|
|
1068
|
+
countType = countType != null ? countType : this.config.countType;
|
|
1069
|
+
let translationKeyPrefix = 'characters';
|
|
1070
|
+
let translationKeySuffix = remainingNumber < 0 ? 'OverLimit' : 'UnderLimit';
|
|
1071
|
+
if (countType === 'words') {
|
|
1072
|
+
translationKeyPrefix = 'words';
|
|
1073
|
+
}
|
|
1021
1074
|
if (remainingNumber === 0) {
|
|
1022
|
-
|
|
1075
|
+
translationKeySuffix = 'AtLimit';
|
|
1023
1076
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
count: Math.abs(remainingNumber)
|
|
1077
|
+
return this.i18n.t(`${translationKeyPrefix}${translationKeySuffix}`, {
|
|
1078
|
+
count: remainingNumber === 0 ? undefined : Math.abs(remainingNumber)
|
|
1027
1079
|
});
|
|
1028
1080
|
}
|
|
1029
1081
|
isOverThreshold() {
|
|
@@ -1042,13 +1094,15 @@
|
|
|
1042
1094
|
*
|
|
1043
1095
|
* @see {@link CharacterCount.defaults}
|
|
1044
1096
|
* @typedef {object} CharacterCountConfig
|
|
1045
|
-
* @property {number} [maxlength] - The maximum number of characters
|
|
1046
|
-
*
|
|
1047
|
-
* @property {number} [maxwords] -
|
|
1048
|
-
*
|
|
1097
|
+
* @property {number} [maxlength] - The maximum number of characters (or words
|
|
1098
|
+
* if `countType` is set to `"words"`).
|
|
1099
|
+
* @property {number} [maxwords] - Deprecated. Use `maxlength` and
|
|
1100
|
+
* `countType: "words"` instead.
|
|
1049
1101
|
* @property {number} [threshold=0] - The percentage value of the limit at
|
|
1050
1102
|
* which point the count message is displayed. If this attribute is set, the
|
|
1051
1103
|
* count message will be hidden by default.
|
|
1104
|
+
* @property {'characters' | 'length' | 'words'} [countType] - The count type
|
|
1105
|
+
* (`"characters"`, `"length"` or `"words"`) used to count the text.
|
|
1052
1106
|
* @property {CharacterCountTranslations} [i18n=CharacterCount.defaults.i18n] - Character count translations
|
|
1053
1107
|
*/
|
|
1054
1108
|
|
|
@@ -1094,9 +1148,9 @@
|
|
|
1094
1148
|
* @property {TranslationPluralForms} [textareaDescription] - Message made
|
|
1095
1149
|
* available to assistive technologies, if none is already present in the
|
|
1096
1150
|
* HTML, to describe that the component accepts only a limited amount of
|
|
1097
|
-
* content. It is visible on the page
|
|
1098
|
-
* component will replace the `%{count}`
|
|
1099
|
-
*
|
|
1151
|
+
* content. It is visible on the page if `countType` is not supported or
|
|
1152
|
+
* JavaScript is unavailable. The component will replace the `%{count}`
|
|
1153
|
+
* placeholder with the value of the `maxlength` parameter.
|
|
1100
1154
|
*/
|
|
1101
1155
|
|
|
1102
1156
|
/**
|
|
@@ -1106,6 +1160,7 @@
|
|
|
1106
1160
|
CharacterCount.moduleName = 'govuk-character-count';
|
|
1107
1161
|
CharacterCount.defaults = Object.freeze({
|
|
1108
1162
|
threshold: 0,
|
|
1163
|
+
countType: 'length',
|
|
1109
1164
|
i18n: {
|
|
1110
1165
|
charactersUnderLimit: {
|
|
1111
1166
|
one: 'You have %{count} character remaining',
|
|
@@ -1143,6 +1198,9 @@
|
|
|
1143
1198
|
},
|
|
1144
1199
|
threshold: {
|
|
1145
1200
|
type: 'number'
|
|
1201
|
+
},
|
|
1202
|
+
countType: {
|
|
1203
|
+
type: 'string'
|
|
1146
1204
|
}
|
|
1147
1205
|
},
|
|
1148
1206
|
anyOf: [{
|
|
@@ -1405,9 +1463,10 @@
|
|
|
1405
1463
|
window.addEventListener('pageshow', this.resetPage.bind(this));
|
|
1406
1464
|
}
|
|
1407
1465
|
initUpdateSpan() {
|
|
1408
|
-
this.$updateSpan =
|
|
1409
|
-
|
|
1410
|
-
|
|
1466
|
+
this.$updateSpan = createElement('span', {
|
|
1467
|
+
role: 'status',
|
|
1468
|
+
class: 'govuk-visually-hidden'
|
|
1469
|
+
});
|
|
1411
1470
|
this.$root.appendChild(this.$updateSpan);
|
|
1412
1471
|
}
|
|
1413
1472
|
initButtonClickHandler() {
|
|
@@ -1417,13 +1476,14 @@
|
|
|
1417
1476
|
}
|
|
1418
1477
|
}
|
|
1419
1478
|
buildIndicator() {
|
|
1420
|
-
this.$indicatorContainer =
|
|
1421
|
-
|
|
1422
|
-
|
|
1479
|
+
this.$indicatorContainer = createElement('div', {
|
|
1480
|
+
class: 'govuk-exit-this-page__indicator',
|
|
1481
|
+
'aria-hidden': 'true'
|
|
1482
|
+
});
|
|
1423
1483
|
for (let i = 0; i < 3; i++) {
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1484
|
+
this.$indicatorContainer.appendChild(createElement('div', {
|
|
1485
|
+
class: 'govuk-exit-this-page__indicator-light'
|
|
1486
|
+
}));
|
|
1427
1487
|
}
|
|
1428
1488
|
this.$button.appendChild(this.$indicatorContainer);
|
|
1429
1489
|
}
|
|
@@ -1443,9 +1503,10 @@
|
|
|
1443
1503
|
}
|
|
1444
1504
|
this.$updateSpan.textContent = '';
|
|
1445
1505
|
document.body.classList.add('govuk-exit-this-page-hide-content');
|
|
1446
|
-
this.$overlay =
|
|
1447
|
-
|
|
1448
|
-
|
|
1506
|
+
this.$overlay = createElement('div', {
|
|
1507
|
+
class: 'govuk-exit-this-page-overlay',
|
|
1508
|
+
role: 'alert'
|
|
1509
|
+
});
|
|
1449
1510
|
document.body.appendChild(this.$overlay);
|
|
1450
1511
|
this.$overlay.textContent = this.i18n.t('activated');
|
|
1451
1512
|
window.location.href = this.$button.href;
|
|
@@ -1625,46 +1686,48 @@
|
|
|
1625
1686
|
this.$input.addEventListener('change', this.onChange.bind(this));
|
|
1626
1687
|
this.updateDisabledState();
|
|
1627
1688
|
this.observeDisabledState();
|
|
1628
|
-
this.$announcements =
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1689
|
+
this.$announcements = createElement('span', {
|
|
1690
|
+
class: 'govuk-file-upload-announcements govuk-visually-hidden',
|
|
1691
|
+
'aria-live': 'assertive'
|
|
1692
|
+
});
|
|
1632
1693
|
this.$root.insertAdjacentElement('afterend', this.$announcements);
|
|
1633
1694
|
this.bindDraggingEvents();
|
|
1634
1695
|
}
|
|
1635
1696
|
createStatus() {
|
|
1636
|
-
const $status =
|
|
1637
|
-
|
|
1638
|
-
|
|
1697
|
+
const $status = createElement('span', {
|
|
1698
|
+
class: 'govuk-body govuk-file-upload-button__status',
|
|
1699
|
+
'aria-live': 'polite'
|
|
1700
|
+
});
|
|
1639
1701
|
$status.innerText = this.i18n.t('noFileChosen');
|
|
1640
1702
|
return $status;
|
|
1641
1703
|
}
|
|
1642
1704
|
createButton() {
|
|
1643
|
-
const $button =
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1705
|
+
const $button = createElement('button', {
|
|
1706
|
+
class: 'govuk-file-upload-button govuk-file-upload-button--empty',
|
|
1707
|
+
type: 'button',
|
|
1708
|
+
id: this.id
|
|
1709
|
+
});
|
|
1648
1710
|
const ariaDescribedBy = this.$input.getAttribute('aria-describedby');
|
|
1649
1711
|
if (ariaDescribedBy) {
|
|
1650
1712
|
$button.setAttribute('aria-describedby', ariaDescribedBy);
|
|
1651
1713
|
}
|
|
1652
1714
|
$button.appendChild(this.$status);
|
|
1653
|
-
const commaSpan =
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1715
|
+
const commaSpan = createElement('span', {
|
|
1716
|
+
class: 'govuk-visually-hidden',
|
|
1717
|
+
id: `${this.id}-comma`
|
|
1718
|
+
}, [', ']);
|
|
1657
1719
|
$button.appendChild(commaSpan);
|
|
1658
|
-
const containerSpan =
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
buttonSpan
|
|
1662
|
-
|
|
1720
|
+
const containerSpan = createElement('span', {
|
|
1721
|
+
class: 'govuk-file-upload-button__pseudo-button-container'
|
|
1722
|
+
});
|
|
1723
|
+
const buttonSpan = createElement('span', {
|
|
1724
|
+
class: 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button'
|
|
1725
|
+
}, [this.i18n.t('chooseFilesButton')]);
|
|
1663
1726
|
containerSpan.appendChild(buttonSpan);
|
|
1664
1727
|
containerSpan.insertAdjacentText('beforeend', ' ');
|
|
1665
|
-
const instructionSpan =
|
|
1666
|
-
|
|
1667
|
-
|
|
1728
|
+
const instructionSpan = createElement('span', {
|
|
1729
|
+
class: 'govuk-body govuk-file-upload-button__instruction'
|
|
1730
|
+
}, [this.i18n.t('dropInstruction')]);
|
|
1668
1731
|
containerSpan.appendChild(instructionSpan);
|
|
1669
1732
|
$button.appendChild(containerSpan);
|
|
1670
1733
|
$button.setAttribute('aria-labelledby', `${this.$label.id} ${commaSpan.id} ${$button.id}`);
|
|
@@ -1948,9 +2011,10 @@
|
|
|
1948
2011
|
locale: closestAttributeValue(this.$root, 'lang')
|
|
1949
2012
|
});
|
|
1950
2013
|
this.$showHideButton.removeAttribute('hidden');
|
|
1951
|
-
const $screenReaderStatusMessage =
|
|
1952
|
-
|
|
1953
|
-
|
|
2014
|
+
const $screenReaderStatusMessage = createElement('div', {
|
|
2015
|
+
class: 'govuk-password-input__sr-status govuk-visually-hidden',
|
|
2016
|
+
'aria-live': 'polite'
|
|
2017
|
+
});
|
|
1954
2018
|
this.$screenReaderStatusMessage = $screenReaderStatusMessage;
|
|
1955
2019
|
this.$input.insertAdjacentElement('afterend', $screenReaderStatusMessage);
|
|
1956
2020
|
this.$showHideButton.addEventListener('click', this.toggle.bind(this));
|
|
@@ -2234,6 +2298,7 @@
|
|
|
2234
2298
|
}
|
|
2235
2299
|
}
|
|
2236
2300
|
|
|
2301
|
+
const _self = typeof globalThis !== 'undefined' ? globalThis : self;
|
|
2237
2302
|
/**
|
|
2238
2303
|
* Skip link component
|
|
2239
2304
|
*
|
|
@@ -2277,7 +2342,7 @@
|
|
|
2277
2342
|
}));
|
|
2278
2343
|
}
|
|
2279
2344
|
}
|
|
2280
|
-
SkipLink.elementType = HTMLAnchorElement;
|
|
2345
|
+
SkipLink.elementType = _self.HTMLAnchorElement;
|
|
2281
2346
|
SkipLink.moduleName = 'govuk-skip-link';
|
|
2282
2347
|
|
|
2283
2348
|
/**
|
|
@@ -2662,14 +2727,14 @@
|
|
|
2662
2727
|
* @typedef {object} Config
|
|
2663
2728
|
* @property {Element | Document | null} [scope] - Scope of the document to search within
|
|
2664
2729
|
* @property {OnErrorCallback<CompatibleClass>} [onError] - Initialisation error callback
|
|
2665
|
-
* @property {
|
|
2666
|
-
* @property {
|
|
2667
|
-
* @property {
|
|
2668
|
-
* @property {
|
|
2669
|
-
* @property {
|
|
2670
|
-
* @property {
|
|
2671
|
-
* @property {
|
|
2672
|
-
* @property {
|
|
2730
|
+
* @property {ComponentConfig<typeof Accordion>} [accordion] - Accordion config
|
|
2731
|
+
* @property {ComponentConfig<typeof Button>} [button] - Button config
|
|
2732
|
+
* @property {ComponentConfig<typeof CharacterCount>} [characterCount] - Character Count config
|
|
2733
|
+
* @property {ComponentConfig<typeof ErrorSummary>} [errorSummary] - Error Summary config
|
|
2734
|
+
* @property {ComponentConfig<typeof ExitThisPage>} [exitThisPage] - Exit This Page config
|
|
2735
|
+
* @property {ComponentConfig<typeof FileUpload>} [fileUpload] - File Upload config
|
|
2736
|
+
* @property {ComponentConfig<typeof NotificationBanner>} [notificationBanner] - Notification Banner config
|
|
2737
|
+
* @property {ComponentConfig<typeof PasswordInput>} [passwordInput] - Password input config
|
|
2673
2738
|
*/
|
|
2674
2739
|
/**
|
|
2675
2740
|
* Config for individual components
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@import "error-message";
|
|
11
11
|
@import "error-summary";
|
|
12
12
|
@import "exit-this-page";
|
|
13
|
+
@import "feedback";
|
|
13
14
|
@import "fieldset";
|
|
14
15
|
@import "file-upload";
|
|
15
16
|
@import "footer";
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
@import "input";
|
|
20
21
|
@import "inset-text";
|
|
21
22
|
@import "label";
|
|
23
|
+
@import "language-navigation";
|
|
22
24
|
@import "notification-banner";
|
|
23
25
|
@import "pagination";
|
|
24
26
|
@import "panel";
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@use "error-message";
|
|
11
11
|
@use "error-summary";
|
|
12
12
|
@use "exit-this-page";
|
|
13
|
+
@use "feedback";
|
|
13
14
|
@use "fieldset";
|
|
14
15
|
@use "file-upload";
|
|
15
16
|
@use "footer";
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
@use "input";
|
|
20
21
|
@use "inset-text";
|
|
21
22
|
@use "label";
|
|
23
|
+
@use "language-navigation";
|
|
22
24
|
@use "notification-banner";
|
|
23
25
|
@use "pagination";
|
|
24
26
|
@use "panel";
|
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
color: base.govuk-functional-colour(surface-text);
|
|
18
18
|
background-color: base.govuk-functional-colour(surface-background);
|
|
19
|
+
|
|
20
|
+
@media print {
|
|
21
|
+
border-bottom-color: currentcolor;
|
|
22
|
+
color: base.govuk-functional-colour(print-text);
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
// Support older browsers which don't hide elements with the `hidden` attribute
|