katalyst-govuk-formbuilder 1.12.0 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/builds/katalyst/govuk/formbuilder.css +1 -1
- data/app/assets/builds/katalyst/govuk/formbuilder.js +117 -103
- data/app/assets/builds/katalyst/govuk/formbuilder.min.js +7 -7
- data/app/assets/stylesheets/katalyst/govuk/components/combobox/_index.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +7 -2
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +8 -10
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +7 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +4 -3
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +15 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb7a5f79742efe731b47dcf4f26f797b4d43e7a97593e979be80c4da34e47707
|
4
|
+
data.tar.gz: 334a40fb19dd3362db6532b68fb33ee4ded7134e293db426af65fc7ab33724dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a24b9773c6b0426ac5864fd9bc2d5b71ec145f9759b2b54c45651c92aef1bc639a945db305972c9893fb95b161affd2da2f4c696c38ff9a1e79e04b4c42d188
|
7
|
+
data.tar.gz: 1aacfcaaeaa8dedae0fa8add858555ad677002dada8f6ccf7f64a92be07ee09dd2d42c95258f664299454025fb7b8622a25b3e8452d258cc2259a0b9b1c8fce9
|
@@ -94,6 +94,19 @@ function setFocus($element, options = {}) {
|
|
94
94
|
(_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);
|
95
95
|
$element.focus();
|
96
96
|
}
|
97
|
+
function isInitialised($root, moduleName) {
|
98
|
+
return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Checks if GOV.UK Frontend is supported on this page
|
103
|
+
*
|
104
|
+
* Some browsers will load and run our JavaScript but GOV.UK Frontend
|
105
|
+
* won't be supported.
|
106
|
+
*
|
107
|
+
* @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
|
108
|
+
* @returns {boolean} Whether GOV.UK Frontend is supported on this page
|
109
|
+
*/
|
97
110
|
function isSupported($scope = document.body) {
|
98
111
|
if (!$scope) {
|
99
112
|
return false;
|
@@ -126,6 +139,9 @@ function isArray(option) {
|
|
126
139
|
function isObject(option) {
|
127
140
|
return !!option && typeof option === 'object' && !isArray(option);
|
128
141
|
}
|
142
|
+
function formatErrorMessage(Component, message) {
|
143
|
+
return `${Component.moduleName}: ${message}`;
|
144
|
+
}
|
129
145
|
|
130
146
|
function normaliseDataset(Component, dataset) {
|
131
147
|
const out = {};
|
@@ -169,30 +185,82 @@ class ElementError extends GOVUKFrontendError {
|
|
169
185
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
170
186
|
if (typeof messageOrOptions === 'object') {
|
171
187
|
const {
|
172
|
-
|
188
|
+
component,
|
173
189
|
identifier,
|
174
190
|
element,
|
175
191
|
expectedType
|
176
192
|
} = messageOrOptions;
|
177
|
-
message =
|
193
|
+
message = identifier;
|
178
194
|
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
195
|
+
message = formatErrorMessage(component, message);
|
179
196
|
}
|
180
197
|
super(message);
|
181
198
|
this.name = 'ElementError';
|
182
199
|
}
|
183
200
|
}
|
201
|
+
class InitError extends GOVUKFrontendError {
|
202
|
+
constructor(componentOrMessage) {
|
203
|
+
const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
|
204
|
+
super(message);
|
205
|
+
this.name = 'InitError';
|
206
|
+
}
|
207
|
+
}
|
184
208
|
|
185
209
|
class GOVUKFrontendComponent {
|
186
|
-
|
187
|
-
|
210
|
+
/**
|
211
|
+
* Returns the root element of the component
|
212
|
+
*
|
213
|
+
* @protected
|
214
|
+
* @returns {RootElementType} - the root element of component
|
215
|
+
*/
|
216
|
+
get $root() {
|
217
|
+
return this._$root;
|
188
218
|
}
|
189
|
-
|
219
|
+
constructor($root) {
|
220
|
+
this._$root = void 0;
|
221
|
+
const childConstructor = this.constructor;
|
222
|
+
if (typeof childConstructor.moduleName !== 'string') {
|
223
|
+
throw new InitError(`\`moduleName\` not defined in component`);
|
224
|
+
}
|
225
|
+
if (!($root instanceof childConstructor.elementType)) {
|
226
|
+
throw new ElementError({
|
227
|
+
element: $root,
|
228
|
+
component: childConstructor,
|
229
|
+
identifier: 'Root element (`$root`)',
|
230
|
+
expectedType: childConstructor.elementType.name
|
231
|
+
});
|
232
|
+
} else {
|
233
|
+
this._$root = $root;
|
234
|
+
}
|
235
|
+
childConstructor.checkSupport();
|
236
|
+
this.checkInitialised();
|
237
|
+
const moduleName = childConstructor.moduleName;
|
238
|
+
this.$root.setAttribute(`data-${moduleName}-init`, '');
|
239
|
+
}
|
240
|
+
checkInitialised() {
|
241
|
+
const constructor = this.constructor;
|
242
|
+
const moduleName = constructor.moduleName;
|
243
|
+
if (moduleName && isInitialised(this.$root, moduleName)) {
|
244
|
+
throw new InitError(constructor);
|
245
|
+
}
|
246
|
+
}
|
247
|
+
static checkSupport() {
|
190
248
|
if (!isSupported()) {
|
191
249
|
throw new SupportError();
|
192
250
|
}
|
193
251
|
}
|
194
252
|
}
|
195
253
|
|
254
|
+
/**
|
255
|
+
* @typedef ChildClass
|
256
|
+
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
|
257
|
+
*/
|
258
|
+
|
259
|
+
/**
|
260
|
+
* @typedef {typeof GOVUKFrontendComponent & ChildClass} ChildClassConstructor
|
261
|
+
*/
|
262
|
+
GOVUKFrontendComponent.elementType = HTMLElement;
|
263
|
+
|
196
264
|
class I18n {
|
197
265
|
constructor(translations = {}, config = {}) {
|
198
266
|
var _config$locale;
|
@@ -395,25 +463,16 @@ const DEBOUNCE_TIMEOUT_IN_SECONDS = 1;
|
|
395
463
|
*/
|
396
464
|
class Button extends GOVUKFrontendComponent {
|
397
465
|
/**
|
398
|
-
* @param {Element | null} $
|
466
|
+
* @param {Element | null} $root - HTML element to use for button
|
399
467
|
* @param {ButtonConfig} [config] - Button config
|
400
468
|
*/
|
401
|
-
constructor($
|
402
|
-
super();
|
403
|
-
this.$module = void 0;
|
469
|
+
constructor($root, config = {}) {
|
470
|
+
super($root);
|
404
471
|
this.config = void 0;
|
405
472
|
this.debounceFormSubmitTimer = null;
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
element: $module,
|
410
|
-
identifier: 'Root element (`$module`)'
|
411
|
-
});
|
412
|
-
}
|
413
|
-
this.$module = $module;
|
414
|
-
this.config = mergeConfigs(Button.defaults, config, normaliseDataset(Button, $module.dataset));
|
415
|
-
this.$module.addEventListener('keydown', event => this.handleKeyDown(event));
|
416
|
-
this.$module.addEventListener('click', event => this.debounce(event));
|
473
|
+
this.config = mergeConfigs(Button.defaults, config, normaliseDataset(Button, this.$root.dataset));
|
474
|
+
this.$root.addEventListener('keydown', event => this.handleKeyDown(event));
|
475
|
+
this.$root.addEventListener('click', event => this.debounce(event));
|
417
476
|
}
|
418
477
|
handleKeyDown(event) {
|
419
478
|
const $target = event.target;
|
@@ -481,13 +540,12 @@ function closestAttributeValue($element, attributeName) {
|
|
481
540
|
*/
|
482
541
|
class CharacterCount extends GOVUKFrontendComponent {
|
483
542
|
/**
|
484
|
-
* @param {Element | null} $
|
543
|
+
* @param {Element | null} $root - HTML element to use for character count
|
485
544
|
* @param {CharacterCountConfig} [config] - Character count config
|
486
545
|
*/
|
487
|
-
constructor($
|
546
|
+
constructor($root, config = {}) {
|
488
547
|
var _ref, _this$config$maxwords;
|
489
|
-
super();
|
490
|
-
this.$module = void 0;
|
548
|
+
super($root);
|
491
549
|
this.$textarea = void 0;
|
492
550
|
this.$visibleCountMessage = void 0;
|
493
551
|
this.$screenReaderCountMessage = void 0;
|
@@ -497,23 +555,16 @@ class CharacterCount extends GOVUKFrontendComponent {
|
|
497
555
|
this.config = void 0;
|
498
556
|
this.i18n = void 0;
|
499
557
|
this.maxLength = void 0;
|
500
|
-
|
501
|
-
throw new ElementError({
|
502
|
-
componentName: 'Character count',
|
503
|
-
element: $module,
|
504
|
-
identifier: 'Root element (`$module`)'
|
505
|
-
});
|
506
|
-
}
|
507
|
-
const $textarea = $module.querySelector('.govuk-js-character-count');
|
558
|
+
const $textarea = this.$root.querySelector('.govuk-js-character-count');
|
508
559
|
if (!($textarea instanceof HTMLTextAreaElement || $textarea instanceof HTMLInputElement)) {
|
509
560
|
throw new ElementError({
|
510
|
-
|
561
|
+
component: CharacterCount,
|
511
562
|
element: $textarea,
|
512
563
|
expectedType: 'HTMLTextareaElement or HTMLInputElement',
|
513
564
|
identifier: 'Form field (`.govuk-js-character-count`)'
|
514
565
|
});
|
515
566
|
}
|
516
|
-
const datasetConfig = normaliseDataset(CharacterCount,
|
567
|
+
const datasetConfig = normaliseDataset(CharacterCount, this.$root.dataset);
|
517
568
|
let configOverrides = {};
|
518
569
|
if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {
|
519
570
|
configOverrides = {
|
@@ -524,19 +575,18 @@ class CharacterCount extends GOVUKFrontendComponent {
|
|
524
575
|
this.config = mergeConfigs(CharacterCount.defaults, config, configOverrides, datasetConfig);
|
525
576
|
const errors = validateConfig(CharacterCount.schema, this.config);
|
526
577
|
if (errors[0]) {
|
527
|
-
throw new ConfigError(
|
578
|
+
throw new ConfigError(formatErrorMessage(CharacterCount, errors[0]));
|
528
579
|
}
|
529
580
|
this.i18n = new I18n(this.config.i18n, {
|
530
|
-
locale: closestAttributeValue(
|
581
|
+
locale: closestAttributeValue(this.$root, 'lang')
|
531
582
|
});
|
532
583
|
this.maxLength = (_ref = (_this$config$maxwords = this.config.maxwords) != null ? _this$config$maxwords : this.config.maxlength) != null ? _ref : Infinity;
|
533
|
-
this.$module = $module;
|
534
584
|
this.$textarea = $textarea;
|
535
585
|
const textareaDescriptionId = `${this.$textarea.id}-info`;
|
536
586
|
const $textareaDescription = document.getElementById(textareaDescriptionId);
|
537
587
|
if (!$textareaDescription) {
|
538
588
|
throw new ElementError({
|
539
|
-
|
589
|
+
component: CharacterCount,
|
540
590
|
element: $textareaDescription,
|
541
591
|
identifier: `Count message (\`id="${textareaDescriptionId}"\`)`
|
542
592
|
});
|
@@ -780,27 +830,18 @@ class Checkboxes extends GOVUKFrontendComponent {
|
|
780
830
|
* (for example if the user has navigated back), and set up event handlers to
|
781
831
|
* keep the reveal in sync with the checkbox state.
|
782
832
|
*
|
783
|
-
* @param {Element | null} $
|
833
|
+
* @param {Element | null} $root - HTML element to use for checkboxes
|
784
834
|
*/
|
785
|
-
constructor($
|
786
|
-
super();
|
787
|
-
this.$module = void 0;
|
835
|
+
constructor($root) {
|
836
|
+
super($root);
|
788
837
|
this.$inputs = void 0;
|
789
|
-
|
790
|
-
throw new ElementError({
|
791
|
-
componentName: 'Checkboxes',
|
792
|
-
element: $module,
|
793
|
-
identifier: 'Root element (`$module`)'
|
794
|
-
});
|
795
|
-
}
|
796
|
-
const $inputs = $module.querySelectorAll('input[type="checkbox"]');
|
838
|
+
const $inputs = this.$root.querySelectorAll('input[type="checkbox"]');
|
797
839
|
if (!$inputs.length) {
|
798
840
|
throw new ElementError({
|
799
|
-
|
841
|
+
component: Checkboxes,
|
800
842
|
identifier: 'Form inputs (`<input type="checkbox">`)'
|
801
843
|
});
|
802
844
|
}
|
803
|
-
this.$module = $module;
|
804
845
|
this.$inputs = $inputs;
|
805
846
|
this.$inputs.forEach($input => {
|
806
847
|
const targetId = $input.getAttribute('data-aria-controls');
|
@@ -809,7 +850,7 @@ class Checkboxes extends GOVUKFrontendComponent {
|
|
809
850
|
}
|
810
851
|
if (!document.getElementById(targetId)) {
|
811
852
|
throw new ElementError({
|
812
|
-
|
853
|
+
component: Checkboxes,
|
813
854
|
identifier: `Conditional reveal (\`id="${targetId}"\`)`
|
814
855
|
});
|
815
856
|
}
|
@@ -818,7 +859,7 @@ class Checkboxes extends GOVUKFrontendComponent {
|
|
818
859
|
});
|
819
860
|
window.addEventListener('pageshow', () => this.syncAllConditionalReveals());
|
820
861
|
this.syncAllConditionalReveals();
|
821
|
-
this.$
|
862
|
+
this.$root.addEventListener('click', event => this.handleClick(event));
|
822
863
|
}
|
823
864
|
syncAllConditionalReveals() {
|
824
865
|
this.$inputs.forEach($input => this.syncConditionalRevealWithInputState($input));
|
@@ -887,26 +928,17 @@ Checkboxes.moduleName = 'govuk-checkboxes';
|
|
887
928
|
*/
|
888
929
|
class ErrorSummary extends GOVUKFrontendComponent {
|
889
930
|
/**
|
890
|
-
* @param {Element | null} $
|
931
|
+
* @param {Element | null} $root - HTML element to use for error summary
|
891
932
|
* @param {ErrorSummaryConfig} [config] - Error summary config
|
892
933
|
*/
|
893
|
-
constructor($
|
894
|
-
super();
|
895
|
-
this.$module = void 0;
|
934
|
+
constructor($root, config = {}) {
|
935
|
+
super($root);
|
896
936
|
this.config = void 0;
|
897
|
-
|
898
|
-
throw new ElementError({
|
899
|
-
componentName: 'Error summary',
|
900
|
-
element: $module,
|
901
|
-
identifier: 'Root element (`$module`)'
|
902
|
-
});
|
903
|
-
}
|
904
|
-
this.$module = $module;
|
905
|
-
this.config = mergeConfigs(ErrorSummary.defaults, config, normaliseDataset(ErrorSummary, $module.dataset));
|
937
|
+
this.config = mergeConfigs(ErrorSummary.defaults, config, normaliseDataset(ErrorSummary, this.$root.dataset));
|
906
938
|
if (!this.config.disableAutoFocus) {
|
907
|
-
setFocus(this.$
|
939
|
+
setFocus(this.$root);
|
908
940
|
}
|
909
|
-
this.$
|
941
|
+
this.$root.addEventListener('click', event => this.handleClick(event));
|
910
942
|
}
|
911
943
|
handleClick(event) {
|
912
944
|
const $target = event.target;
|
@@ -990,28 +1022,20 @@ ErrorSummary.schema = Object.freeze({
|
|
990
1022
|
*/
|
991
1023
|
class PasswordInput extends GOVUKFrontendComponent {
|
992
1024
|
/**
|
993
|
-
* @param {Element | null} $
|
1025
|
+
* @param {Element | null} $root - HTML element to use for password input
|
994
1026
|
* @param {PasswordInputConfig} [config] - Password input config
|
995
1027
|
*/
|
996
|
-
constructor($
|
997
|
-
super();
|
998
|
-
this.$module = void 0;
|
1028
|
+
constructor($root, config = {}) {
|
1029
|
+
super($root);
|
999
1030
|
this.config = void 0;
|
1000
1031
|
this.i18n = void 0;
|
1001
1032
|
this.$input = void 0;
|
1002
1033
|
this.$showHideButton = void 0;
|
1003
1034
|
this.$screenReaderStatusMessage = void 0;
|
1004
|
-
|
1005
|
-
throw new ElementError({
|
1006
|
-
componentName: 'Password input',
|
1007
|
-
element: $module,
|
1008
|
-
identifier: 'Root element (`$module`)'
|
1009
|
-
});
|
1010
|
-
}
|
1011
|
-
const $input = $module.querySelector('.govuk-js-password-input-input');
|
1035
|
+
const $input = this.$root.querySelector('.govuk-js-password-input-input');
|
1012
1036
|
if (!($input instanceof HTMLInputElement)) {
|
1013
1037
|
throw new ElementError({
|
1014
|
-
|
1038
|
+
component: PasswordInput,
|
1015
1039
|
element: $input,
|
1016
1040
|
expectedType: 'HTMLInputElement',
|
1017
1041
|
identifier: 'Form field (`.govuk-js-password-input-input`)'
|
@@ -1020,10 +1044,10 @@ class PasswordInput extends GOVUKFrontendComponent {
|
|
1020
1044
|
if ($input.type !== 'password') {
|
1021
1045
|
throw new ElementError('Password input: Form field (`.govuk-js-password-input-input`) must be of type `password`.');
|
1022
1046
|
}
|
1023
|
-
const $showHideButton =
|
1047
|
+
const $showHideButton = this.$root.querySelector('.govuk-js-password-input-toggle');
|
1024
1048
|
if (!($showHideButton instanceof HTMLButtonElement)) {
|
1025
1049
|
throw new ElementError({
|
1026
|
-
|
1050
|
+
component: PasswordInput,
|
1027
1051
|
element: $showHideButton,
|
1028
1052
|
expectedType: 'HTMLButtonElement',
|
1029
1053
|
identifier: 'Button (`.govuk-js-password-input-toggle`)'
|
@@ -1032,12 +1056,11 @@ class PasswordInput extends GOVUKFrontendComponent {
|
|
1032
1056
|
if ($showHideButton.type !== 'button') {
|
1033
1057
|
throw new ElementError('Password input: Button (`.govuk-js-password-input-toggle`) must be of type `button`.');
|
1034
1058
|
}
|
1035
|
-
this.$module = $module;
|
1036
1059
|
this.$input = $input;
|
1037
1060
|
this.$showHideButton = $showHideButton;
|
1038
|
-
this.config = mergeConfigs(PasswordInput.defaults, config, normaliseDataset(PasswordInput,
|
1061
|
+
this.config = mergeConfigs(PasswordInput.defaults, config, normaliseDataset(PasswordInput, this.$root.dataset));
|
1039
1062
|
this.i18n = new I18n(this.config.i18n, {
|
1040
|
-
locale: closestAttributeValue(
|
1063
|
+
locale: closestAttributeValue(this.$root, 'lang')
|
1041
1064
|
});
|
1042
1065
|
this.$showHideButton.removeAttribute('hidden');
|
1043
1066
|
const $screenReaderStatusMessage = document.createElement('div');
|
@@ -1155,27 +1178,18 @@ class Radios extends GOVUKFrontendComponent {
|
|
1155
1178
|
* (for example if the user has navigated back), and set up event handlers to
|
1156
1179
|
* keep the reveal in sync with the radio state.
|
1157
1180
|
*
|
1158
|
-
* @param {Element | null} $
|
1181
|
+
* @param {Element | null} $root - HTML element to use for radios
|
1159
1182
|
*/
|
1160
|
-
constructor($
|
1161
|
-
super();
|
1162
|
-
this.$module = void 0;
|
1183
|
+
constructor($root) {
|
1184
|
+
super($root);
|
1163
1185
|
this.$inputs = void 0;
|
1164
|
-
|
1165
|
-
throw new ElementError({
|
1166
|
-
componentName: 'Radios',
|
1167
|
-
element: $module,
|
1168
|
-
identifier: 'Root element (`$module`)'
|
1169
|
-
});
|
1170
|
-
}
|
1171
|
-
const $inputs = $module.querySelectorAll('input[type="radio"]');
|
1186
|
+
const $inputs = this.$root.querySelectorAll('input[type="radio"]');
|
1172
1187
|
if (!$inputs.length) {
|
1173
1188
|
throw new ElementError({
|
1174
|
-
|
1189
|
+
component: Radios,
|
1175
1190
|
identifier: 'Form inputs (`<input type="radio">`)'
|
1176
1191
|
});
|
1177
1192
|
}
|
1178
|
-
this.$module = $module;
|
1179
1193
|
this.$inputs = $inputs;
|
1180
1194
|
this.$inputs.forEach($input => {
|
1181
1195
|
const targetId = $input.getAttribute('data-aria-controls');
|
@@ -1184,7 +1198,7 @@ class Radios extends GOVUKFrontendComponent {
|
|
1184
1198
|
}
|
1185
1199
|
if (!document.getElementById(targetId)) {
|
1186
1200
|
throw new ElementError({
|
1187
|
-
|
1201
|
+
component: Radios,
|
1188
1202
|
identifier: `Conditional reveal (\`id="${targetId}"\`)`
|
1189
1203
|
});
|
1190
1204
|
}
|
@@ -1193,7 +1207,7 @@ class Radios extends GOVUKFrontendComponent {
|
|
1193
1207
|
});
|
1194
1208
|
window.addEventListener('pageshow', () => this.syncAllConditionalReveals());
|
1195
1209
|
this.syncAllConditionalReveals();
|
1196
|
-
this.$
|
1210
|
+
this.$root.addEventListener('click', event => this.handleClick(event));
|
1197
1211
|
}
|
1198
1212
|
syncAllConditionalReveals() {
|
1199
1213
|
this.$inputs.forEach($input => this.syncConditionalRevealWithInputState($input));
|
@@ -1,10 +1,10 @@
|
|
1
|
-
function e(e,t){const n=e?e.trim():"";let o,s=null==t?void 0:t.type;switch(s||(["true","false"].includes(n)&&(s="boolean"),n.length>0&&isFinite(Number(n))&&(s="number")),s){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function t(...e){const n={};for(const o of e)for(const e of Object.keys(o)){const i=n[e],r=o[e];s(i)&&s(r)?n[e]=t(i,r):n[e]=r}return n}function n(t,n,o){const i=t.schema.properties[o];if("object"!==(null==i?void 0:i.type))return;const r={[o]:{}};for(const[t,i]of Object.entries(n)){let n=r;const a=t.split(".");for(const[r,
|
1
|
+
function e(e,t){const n=e?e.trim():"";let o,s=null==t?void 0:t.type;switch(s||(["true","false"].includes(n)&&(s="boolean"),n.length>0&&isFinite(Number(n))&&(s="number")),s){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function t(...e){const n={};for(const o of e)for(const e of Object.keys(o)){const i=n[e],r=o[e];s(i)&&s(r)?n[e]=t(i,r):n[e]=r}return n}function n(t,n,o){const i=t.schema.properties[o];if("object"!==(null==i?void 0:i.type))return;const r={[o]:{}};for(const[t,i]of Object.entries(n)){let n=r;const a=t.split(".");for(const[r,u]of a.entries())"object"==typeof n&&(r<a.length-1?(s(n[u])||(n[u]={}),n=n[u]):t!==o&&(n[u]=e(i)))}return r[o]}function o(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function s(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function i(e,t){return`${e.moduleName}: ${t}`}function r(t,o){const s={};for(const[i,r]of Object.entries(t.schema.properties))i in o&&(s[i]=e(o[i],r)),"object"===(null==r?void 0:r.type)&&(s[i]=n(t,o,i));return s}class a extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class u extends a{constructor(e=document.body){const t="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";super(e?t:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class l extends a{constructor(...e){super(...e),this.name="ConfigError"}}class c extends a{constructor(e){let t="string"==typeof e?e:"";if("object"==typeof e){const{component:n,identifier:o,element:s,expectedType:r}=e;t=o,t+=s?` is not of type ${null!=r?r:"HTMLElement"}`:" not found",t=i(n,t)}super(t),this.name="ElementError"}}class h extends a{constructor(e){super("string"==typeof e?e:i(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class d{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new h("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new c({element:e,component:t,identifier:"Root element (`$root`)",expectedType:t.elementType.name});this._$root=e,t.checkSupport(),this.checkInitialised();const n=t.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const e=this.constructor,t=e.moduleName;if(t&&function(e,t){return e instanceof HTMLElement&&e.hasAttribute(`data-${t}-init`)}(this.$root,t))throw new h(e)}static checkSupport(){if(!o())throw new u}}d.elementType=HTMLElement;class p{constructor(e={},t={}){var n;this.translations=void 0,this.locale=void 0,this.translations=e,this.locale=null!=(n=t.locale)?n:document.documentElement.lang||"en"}t(e,t){if(!e)throw new Error("i18n: lookup key missing");let n=this.translations[e];if("number"==typeof(null==t?void 0:t.count)&&"object"==typeof n){const o=n[this.getPluralSuffix(e,t.count)];o&&(n=o)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!t)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,t)}return n}return e}replacePlaceholders(e,t){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return e.replace(/%{(.\S+)}/g,(function(e,o){if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];return!1===e||"number"!=typeof e&&"string"!=typeof e?"":"number"==typeof e?n?n.format(e):`${e}`:e}throw new Error(`i18n: no data found to replace ${e} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(e,t){if(t=Number(t),!isFinite(t))return"other";const n=this.translations[e],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(t):this.selectPluralFormUsingFallbackRules(t);if("object"==typeof n){if(o in n)return o;if("other"in n)return console.warn(`i18n: Missing plural form ".${o}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}selectPluralFormUsingFallbackRules(e){e=Math.abs(Math.floor(e));const t=this.getPluralRulesForLocale();return t?p.pluralRules[t](e):"other"}getPluralRulesForLocale(){const e=this.locale.split("-")[0];for(const t in p.pluralRulesMap){const n=p.pluralRulesMap[t];if(n.includes(this.locale)||n.includes(e))return t}}}p.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],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"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},p.pluralRules={arabic:e=>0===e?"zero":1===e?"one":2===e?"two":e%100>=3&&e%100<=10?"few":e%100>=11&&e%100<=99?"many":"other",chinese:()=>"other",french:e=>0===e||1===e?"one":"other",german:e=>1===e?"one":"other",irish:e=>1===e?"one":2===e?"two":e>=3&&e<=6?"few":e>=7&&e<=10?"many":"other",russian(e){const t=e%100,n=t%10;return 1===n&&11!==t?"one":n>=2&&n<=4&&!(t>=12&&t<=14)?"few":0===n||n>=5&&n<=9||t>=11&&t<=14?"many":"other"},scottish:e=>1===e||11===e?"one":2===e||12===e?"two":e>=3&&e<=10||e>=13&&e<=19?"few":"other",spanish:e=>1===e?"one":e%1e6==0&&0!==e?"many":"other",welsh:e=>0===e?"zero":1===e?"one":2===e?"two":3===e?"few":6===e?"many":"other"};
|
2
2
|
/**
|
3
3
|
* JavaScript enhancements for the Button component
|
4
4
|
*
|
5
5
|
* @preserve
|
6
6
|
*/
|
7
|
-
class
|
7
|
+
class m extends d{constructor(e,n={}){super(e),this.config=void 0,this.debounceFormSubmitTimer=null,this.config=t(m.defaults,n,r(m,this.$root.dataset)),this.$root.addEventListener("keydown",(e=>this.handleKeyDown(e))),this.$root.addEventListener("click",(e=>this.debounce(e)))}handleKeyDown(e){const t=e.target;" "===e.key&&t instanceof HTMLElement&&"button"===t.getAttribute("role")&&(e.preventDefault(),t.click())}debounce(e){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout((()=>{this.debounceFormSubmitTimer=null}),1e3))}}function f(e,t){const n=e.closest(`[${t}]`);return n?n.getAttribute(t):null}
|
8
8
|
/**
|
9
9
|
* Character count component
|
10
10
|
*
|
@@ -16,13 +16,13 @@ class d extends c{constructor(e,n={}){if(super(),this.$module=void 0,this.config
|
|
16
16
|
* of the available characters/words has been entered.
|
17
17
|
*
|
18
18
|
* @preserve
|
19
|
-
*/
|
19
|
+
*/m.moduleName="govuk-button",m.defaults=Object.freeze({preventDoubleClick:!1}),m.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class g extends d{constructor(e,n={}){var o,s;super(e),this.$textarea=void 0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.config=void 0,this.i18n=void 0,this.maxLength=void 0;const a=this.$root.querySelector(".govuk-js-character-count");if(!(a instanceof HTMLTextAreaElement||a instanceof HTMLInputElement))throw new c({component:g,element:a,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const u=r(g,this.$root.dataset);let h={};("maxwords"in u||"maxlength"in u)&&(h={maxlength:void 0,maxwords:void 0}),this.config=t(g.defaults,n,h,u);const d=function(e,t){const n=[];for(const[o,s]of Object.entries(e)){const e=[];if(Array.isArray(s)){for(const{required:n,errorMessage:o}of s)n.every((e=>!!t[e]))||e.push(o);"anyOf"!==o||s.length-e.length>=1||n.push(...e)}}return n}(g.schema,this.config);if(d[0])throw new l(i(g,d[0]));this.i18n=new p(this.config.i18n,{locale:f(this.$root,"lang")}),this.maxLength=null!=(o=null!=(s=this.config.maxwords)?s:this.config.maxlength)?o:1/0,this.$textarea=a;const m=`${this.$textarea.id}-info`,v=document.getElementById(m);if(!v)throw new c({component:g,element:v,identifier:`Count message (\`id="${m}"\`)`});`${v.textContent}`.match(/^\s*$/)&&(v.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",v);const w=document.createElement("div");w.className="govuk-character-count__sr-status govuk-visually-hidden",w.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=w,v.insertAdjacentElement("afterend",w);const b=document.createElement("div");b.className=v.className,b.classList.add("govuk-character-count__status"),b.setAttribute("aria-hidden","true"),this.$visibleCountMessage=b,v.insertAdjacentElement("afterend",b),v.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",(()=>this.updateCountMessage())),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",(()=>this.handleKeyUp())),this.$textarea.addEventListener("focus",(()=>this.handleFocus())),this.$textarea.addEventListener("blur",(()=>this.handleBlur()))}handleKeyUp(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval((()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}),1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const e=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$textarea.classList.toggle("govuk-textarea--error",e),this.$visibleCountMessage.classList.toggle("govuk-error-message",e),this.$visibleCountMessage.classList.toggle("govuk-hint",!e),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(e){if(this.config.maxwords){var t;return(null!=(t=e.match(/\S+/g))?t:[]).length}return e.length}getCountMessage(){const e=this.maxLength-this.count(this.$textarea.value),t=this.config.maxwords?"words":"characters";return this.formatCountMessage(e,t)}formatCountMessage(e,t){if(0===e)return this.i18n.t(`${t}AtLimit`);const n=e<0?"OverLimit":"UnderLimit";return this.i18n.t(`${t}${n}`,{count:Math.abs(e)})}isOverThreshold(){if(!this.config.threshold)return!0;const e=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=e}}g.moduleName="govuk-character-count",g.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),g.schema=Object.freeze({properties:{i18n:{type:"object"},maxwords:{type:"number"},maxlength:{type:"number"},threshold:{type:"number"}},anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});
|
20
20
|
/**
|
21
21
|
* Checkboxes component
|
22
22
|
*
|
23
23
|
* @preserve
|
24
24
|
*/
|
25
|
-
class
|
25
|
+
class v extends d{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="checkbox"]');if(!t.length)throw new c({component:v,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=t,this.$inputs.forEach((e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new c({component:v,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(e=>this.handleClick(e)))}syncAllConditionalReveals(){this.$inputs.forEach((e=>this.syncConditionalRevealWithInputState(e)))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-checkboxes__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!t)}}unCheckAllInputsExcept(e){document.querySelectorAll(`input[type="checkbox"][name="${e.name}"]`).forEach((t=>{e.form===t.form&&t!==e&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))}))}unCheckExclusiveInputs(e){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${e.name}"]`).forEach((t=>{e.form===t.form&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))}))}handleClick(e){const t=e.target;if(!(t instanceof HTMLInputElement)||"checkbox"!==t.type)return;if(t.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(t),!t.checked)return;"exclusive"===t.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(t):this.unCheckExclusiveInputs(t)}}v.moduleName="govuk-checkboxes";
|
26
26
|
/**
|
27
27
|
* Error summary component
|
28
28
|
*
|
@@ -31,16 +31,16 @@ class f extends c{constructor(e){if(super(),this.$module=void 0,this.$inputs=voi
|
|
31
31
|
*
|
32
32
|
* @preserve
|
33
33
|
*/
|
34
|
-
class
|
34
|
+
class w extends d{constructor(e,n={}){super(e),this.config=void 0,this.config=t(w.defaults,n,r(w,this.$root.dataset)),this.config.disableAutoFocus||function(e,t={}){var n;const o=e.getAttribute("tabindex");function s(){var n;null==(n=t.onBlur)||n.call(e),o||e.removeAttribute("tabindex")}o||e.setAttribute("tabindex","-1"),e.addEventListener("focus",(function(){e.addEventListener("blur",s,{once:!0})}),{once:!0}),null==(n=t.onBeforeFocus)||n.call(e),e.focus()}(this.$root),this.$root.addEventListener("click",(e=>this.handleClick(e)))}handleClick(e){const t=e.target;t&&this.focusTarget(t)&&e.preventDefault()}focusTarget(e){if(!(e instanceof HTMLAnchorElement))return!1;const t=function(e){if(e.includes("#"))return e.split("#").pop()}(e.href);if(!t)return!1;const n=document.getElementById(t);if(!n)return!1;const o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(e){var t;const n=e.closest("fieldset");if(n){const t=n.getElementsByTagName("legend");if(t.length){const n=t[0];if(e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type))return n;const o=n.getBoundingClientRect().top,s=e.getBoundingClientRect();if(s.height&&window.innerHeight){if(s.top+s.height-o<window.innerHeight/2)return n}}}return null!=(t=document.querySelector(`label[for='${e.getAttribute("id")}']`))?t:e.closest("label")}}w.moduleName="govuk-error-summary",w.defaults=Object.freeze({disableAutoFocus:!1}),w.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});
|
35
35
|
/**
|
36
36
|
* Password input component
|
37
37
|
*
|
38
38
|
* @preserve
|
39
39
|
*/
|
40
|
-
class
|
40
|
+
class b extends d{constructor(e,n={}){super(e),this.config=void 0,this.i18n=void 0,this.$input=void 0,this.$showHideButton=void 0,this.$screenReaderStatusMessage=void 0;const o=this.$root.querySelector(".govuk-js-password-input-input");if(!(o instanceof HTMLInputElement))throw new c({component:b,element:o,expectedType:"HTMLInputElement",identifier:"Form field (`.govuk-js-password-input-input`)"});if("password"!==o.type)throw new c("Password input: Form field (`.govuk-js-password-input-input`) must be of type `password`.");const s=this.$root.querySelector(".govuk-js-password-input-toggle");if(!(s instanceof HTMLButtonElement))throw new c({component:b,element:s,expectedType:"HTMLButtonElement",identifier:"Button (`.govuk-js-password-input-toggle`)"});if("button"!==s.type)throw new c("Password input: Button (`.govuk-js-password-input-toggle`) must be of type `button`.");this.$input=o,this.$showHideButton=s,this.config=t(b.defaults,n,r(b,this.$root.dataset)),this.i18n=new p(this.config.i18n,{locale:f(this.$root,"lang")}),this.$showHideButton.removeAttribute("hidden");const i=document.createElement("div");i.className="govuk-password-input__sr-status govuk-visually-hidden",i.setAttribute("aria-live","polite"),this.$screenReaderStatusMessage=i,this.$input.insertAdjacentElement("afterend",i),this.$showHideButton.addEventListener("click",this.toggle.bind(this)),this.$input.form&&this.$input.form.addEventListener("submit",(()=>this.hide())),window.addEventListener("pageshow",(e=>{e.persisted&&"password"!==this.$input.type&&this.hide()})),this.hide()}toggle(e){e.preventDefault(),"password"!==this.$input.type?this.hide():this.show()}show(){this.setType("text")}hide(){this.setType("password")}setType(e){if(e===this.$input.type)return;this.$input.setAttribute("type",e);const t="password"===e,n=t?"show":"hide",o=t?"passwordHidden":"passwordShown";this.$showHideButton.innerText=this.i18n.t(`${n}Password`),this.$showHideButton.setAttribute("aria-label",this.i18n.t(`${n}PasswordAriaLabel`)),this.$screenReaderStatusMessage.innerText=this.i18n.t(`${o}Announcement`)}}b.moduleName="govuk-password-input",b.defaults=Object.freeze({i18n:{showPassword:"Show",hidePassword:"Hide",showPasswordAriaLabel:"Show password",hidePasswordAriaLabel:"Hide password",passwordShownAnnouncement:"Your password is visible",passwordHiddenAnnouncement:"Your password is hidden"}}),b.schema=Object.freeze({properties:{i18n:{type:"object"}}});
|
41
41
|
/**
|
42
42
|
* Radios component
|
43
43
|
*
|
44
44
|
* @preserve
|
45
45
|
*/
|
46
|
-
class
|
46
|
+
class y extends d{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="radio"]');if(!t.length)throw new c({component:y,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=t,this.$inputs.forEach((e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new c({component:y,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(e=>this.handleClick(e)))}syncAllConditionalReveals(){this.$inputs.forEach((e=>this.syncConditionalRevealWithInputState(e)))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-radios__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!t)}}handleClick(e){const t=e.target;if(!(t instanceof HTMLInputElement)||"radio"!==t.type)return;const n=document.querySelectorAll('input[type="radio"][aria-controls]'),o=t.form,s=t.name;n.forEach((e=>{const t=e.form===o;e.name===s&&t&&this.syncConditionalRevealWithInputState(e)}))}}function $(e){let t;if(e=void 0!==e?e:{},!o())return void console.log(new u);const n=[[m,e.button],[g,e.characterCount],[v],[w,e.errorSummary],[y],[b,e.passwordInput]],s=null!=(t=e.scope)?t:document;n.forEach((([e,t])=>{s.querySelectorAll(`[data-module="${e.moduleName}"]`).forEach((n=>{try{"defaults"in e?new e(n,t):new e(n)}catch(e){console.log(e)}}))}))}y.moduleName="govuk-radios";export{m as Button,g as CharacterCount,v as Checkboxes,w as ErrorSummary,b as PasswordInput,y as Radios,$ as initAll};
|
@@ -8,9 +8,10 @@
|
|
8
8
|
}
|
9
9
|
|
10
10
|
.govuk-details__summary {
|
11
|
-
|
12
|
-
|
11
|
+
display: block;
|
12
|
+
}
|
13
13
|
|
14
|
+
.govuk-details[open] .govuk-details__summary {
|
14
15
|
margin-bottom: govuk-spacing(1);
|
15
16
|
}
|
16
17
|
|
@@ -72,6 +73,10 @@
|
|
72
73
|
// Absolutely position the marker against this element
|
73
74
|
position: relative;
|
74
75
|
|
76
|
+
// Make the focus outline shrink-wrap the text content of the summary
|
77
|
+
width: -webkit-fit-content;
|
78
|
+
width: fit-content;
|
79
|
+
|
75
80
|
// Allow for absolutely positioned marker and align with disclosed text
|
76
81
|
padding-left: govuk-spacing(4) + $govuk-border-width;
|
77
82
|
|
@@ -3,12 +3,9 @@
|
|
3
3
|
$govuk-footer-border: $govuk-border-colour;
|
4
4
|
$govuk-footer-text: $govuk-text-colour;
|
5
5
|
|
6
|
-
//
|
7
|
-
$govuk-footer-crest-image-width
|
8
|
-
$govuk-footer-crest-image-height
|
9
|
-
// Half the 2x image so that it fits the regular 1x size.
|
10
|
-
$govuk-footer-crest-image-width: ($govuk-footer-crest-image-width-2x / 2);
|
11
|
-
$govuk-footer-crest-image-height: ($govuk-footer-crest-image-height-2x / 2);
|
6
|
+
// Royal Arms image dimensions
|
7
|
+
$govuk-footer-crest-image-width: 125px;
|
8
|
+
$govuk-footer-crest-image-height: 102px;
|
12
9
|
|
13
10
|
.govuk-footer {
|
14
11
|
@include govuk-font($size: if($govuk-new-typography-scale, 19, 16));
|
@@ -67,17 +64,18 @@
|
|
67
64
|
}
|
68
65
|
|
69
66
|
.govuk-footer__licence-description {
|
67
|
+
// This makes the license description reflow under the logo when space gets too narrow
|
70
68
|
display: inline-block;
|
69
|
+
// This prevents the description from having orphans when space is narrow enough
|
70
|
+
// and makes the text reflow more nicely
|
71
|
+
text-wrap: balance;
|
71
72
|
}
|
72
73
|
|
73
74
|
.govuk-footer__copyright-logo {
|
74
75
|
display: inline-block;
|
75
76
|
min-width: $govuk-footer-crest-image-width;
|
76
77
|
padding-top: ($govuk-footer-crest-image-height + govuk-spacing(2));
|
77
|
-
background-image: govuk-image-url("govuk-crest.
|
78
|
-
@include govuk-device-pixel-ratio {
|
79
|
-
background-image: govuk-image-url("govuk-crest-2x.png");
|
80
|
-
}
|
78
|
+
background-image: govuk-image-url("govuk-crest.svg");
|
81
79
|
background-repeat: no-repeat;
|
82
80
|
background-position: 50% 0%;
|
83
81
|
background-size: $govuk-footer-crest-image-width $govuk-footer-crest-image-height;
|
@@ -90,7 +90,7 @@
|
|
90
90
|
.govuk-service-navigation__toggle {
|
91
91
|
@include govuk-font($size: 19, $weight: bold);
|
92
92
|
display: inline-flex;
|
93
|
-
margin:
|
93
|
+
margin: govuk-spacing(2) 0;
|
94
94
|
padding: 0;
|
95
95
|
border: 0;
|
96
96
|
color: $govuk-service-navigation-link-colour;
|
@@ -117,6 +117,12 @@
|
|
117
117
|
&[hidden] {
|
118
118
|
display: none;
|
119
119
|
}
|
120
|
+
|
121
|
+
// If we have both a service name and navigation toggle, remove the
|
122
|
+
// margin-top so that there isn't a bunch of space between them
|
123
|
+
.govuk-service-navigation__service-name + .govuk-service-navigation__wrapper & {
|
124
|
+
margin-top: 0;
|
125
|
+
}
|
120
126
|
}
|
121
127
|
|
122
128
|
.govuk-service-navigation__list {
|
@@ -2,14 +2,12 @@
|
|
2
2
|
.govuk-warning-text {
|
3
3
|
@include govuk-font($size: 19);
|
4
4
|
@include govuk-responsive-margin(6, "bottom");
|
5
|
+
@include govuk-typography-weight-bold;
|
5
6
|
position: relative;
|
6
7
|
padding: govuk-spacing(2) 0;
|
7
8
|
}
|
8
9
|
|
9
10
|
.govuk-warning-text__icon {
|
10
|
-
// We apply this here and not at the parent level because the actual text is
|
11
|
-
// a <strong> and so will always be bold
|
12
|
-
@include govuk-typography-weight-bold;
|
13
11
|
box-sizing: border-box;
|
14
12
|
|
15
13
|
display: inline-block;
|
@@ -59,6 +57,9 @@
|
|
59
57
|
@include govuk-text-colour;
|
60
58
|
display: block;
|
61
59
|
padding-left: 45px;
|
60
|
+
// While `<strong>` is styled `bold` or `bolder` by user-agents
|
61
|
+
// this can be reset by the app's stylesheet
|
62
|
+
font-weight: inherit;
|
62
63
|
}
|
63
64
|
}
|
64
65
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
:root {
|
2
2
|
// This variable is automatically overwritten during builds and releases.
|
3
3
|
// It doesn't need to be updated manually.
|
4
|
-
--govuk-frontend-version: "5.
|
4
|
+
--govuk-frontend-version: "5.7.1";
|
5
5
|
|
6
6
|
// CSS custom property for each breakpoint
|
7
7
|
@each $name, $value in $govuk-breakpoints {
|
@@ -60,7 +60,8 @@ $_govuk-organisation-colours: (
|
|
60
60
|
"`department-for-communities-local-government` became `ministry-of-housing-communities-local-government` in 2018."
|
61
61
|
),
|
62
62
|
"department-for-culture-media-sport": (
|
63
|
-
colour: #
|
63
|
+
colour: #ed1588,
|
64
|
+
contrast-safe: #d6177a
|
64
65
|
),
|
65
66
|
"department-for-digital-culture-media-sport": (
|
66
67
|
colour: #d40072,
|
@@ -75,8 +76,8 @@ $_govuk-organisation-colours: (
|
|
75
76
|
contrast-safe: #00852f
|
76
77
|
),
|
77
78
|
"department-for-environment-food-rural-affairs": (
|
78
|
-
colour: #
|
79
|
-
contrast-safe: #
|
79
|
+
colour: #00a33b,
|
80
|
+
contrast-safe: #008531
|
80
81
|
),
|
81
82
|
"department-for-exiting-the-european-union": (
|
82
83
|
colour: #009fe3,
|
@@ -98,7 +99,7 @@ $_govuk-organisation-colours: (
|
|
98
99
|
"`department-for-levelling-up-housing-communities` was renamed to `ministry-of-housing-communities-local-government` in 2024."
|
99
100
|
),
|
100
101
|
"department-for-science-innovation-technology": (
|
101
|
-
colour: #
|
102
|
+
colour: #00f8f8,
|
102
103
|
contrast-safe: #008180
|
103
104
|
),
|
104
105
|
"department-for-transport": (
|
@@ -128,7 +129,7 @@ $_govuk-organisation-colours: (
|
|
128
129
|
deprecation-message: "`foreign-commonwealth-office` became `foreign-commonwealth-development-office` in 2018."
|
129
130
|
),
|
130
131
|
"foreign-commonwealth-development-office": (
|
131
|
-
colour: #
|
132
|
+
colour: #012069
|
132
133
|
),
|
133
134
|
"government-equalities-office": (
|
134
135
|
colour: #0056b8,
|
@@ -168,17 +169,21 @@ $_govuk-organisation-colours: (
|
|
168
169
|
colour: #9c182f
|
169
170
|
),
|
170
171
|
"office-of-the-secretary-of-state-for-scotland": (
|
171
|
-
colour: #00205c
|
172
|
+
colour: #00205c,
|
173
|
+
deprecation-message: "`office-of-the-secretary-of-state-for-scotland` was renamed to `scotland-office` in 2024."
|
172
174
|
),
|
173
175
|
"office-of-the-secretary-of-state-for-wales": (
|
174
|
-
colour: #a8353a
|
176
|
+
colour: #a8353a,
|
177
|
+
deprecation-message: "`office-of-the-secretary-of-state-for-wales` was renamed to `wales-office` in 2024."
|
175
178
|
),
|
176
179
|
"prime-ministers-office-10-downing-street": (
|
177
180
|
colour: #0b0c0c
|
178
181
|
),
|
179
182
|
"scotland-office": (
|
180
|
-
colour: #
|
181
|
-
|
183
|
+
colour: #00205c
|
184
|
+
),
|
185
|
+
"serious-fraud-office": (
|
186
|
+
colour: #82368c
|
182
187
|
),
|
183
188
|
"uk-export-finance": (
|
184
189
|
colour: #cf102d
|
@@ -189,8 +194,7 @@ $_govuk-organisation-colours: (
|
|
189
194
|
"`uk-trade-investment` became `department-for-international-trade` in 2016. As of 2023, it is equivalent to `department-for-business-trade`."
|
190
195
|
),
|
191
196
|
"wales-office": (
|
192
|
-
colour: #a33038
|
193
|
-
deprecation-message: "`wales-office` became `office-of-the-secretary-of-state-for-wales` in 2018."
|
197
|
+
colour: #a33038
|
194
198
|
)
|
195
199
|
);
|
196
200
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katalyst-govuk-formbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katalyst Interactive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|