govuk_publishing_components 51.1.1 → 51.2.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/stylesheets/component_guide/application.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -0
- data/app/models/govuk_publishing_components/audit_comparer.rb +3 -3
- data/app/views/govuk_publishing_components/components/_title.html.erb +2 -3
- data/app/views/govuk_publishing_components/components/docs/add_another.yml +1 -1
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +1 -1
- data/lib/govuk_publishing_components/presenters/shared_helper.rb +0 -11
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +217 -184
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +216 -184
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.mjs +1 -0
- data/node_modules/govuk-frontend/dist/govuk/all.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.scss +6 -0
- data/node_modules/govuk-frontend/dist/govuk/all.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +164 -0
- data/node_modules/govuk-frontend/dist/govuk/common/configuration.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/index.mjs +1 -87
- data/node_modules/govuk-frontend/dist/govuk/common/index.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +149 -112
- 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 +148 -111
- 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 +5 -8
- 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 +149 -112
- 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 +148 -111
- 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 +5 -8
- 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 +174 -140
- 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 +173 -139
- 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 +17 -16
- 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/macro-options.json +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +1 -24
- 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 +0 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/date-input/macro-options.json +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +149 -112
- 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 +148 -111
- 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 +6 -8
- 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 +149 -112
- 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 +148 -111
- 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 +5 -8
- 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/header/header.bundle.js +1 -24
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -23
- data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/input/macro-options.json +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +149 -112
- 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 +148 -111
- 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 +6 -8
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/macro-options.json +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +149 -112
- 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 +148 -111
- 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 -8
- 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 +1 -24
- 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 +0 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +1 -24
- 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 +0 -23
- 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/skip-link/skip-link.bundle.js +1 -24
- 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 +0 -23
- 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/tabs/tabs.bundle.js +1 -24
- 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 +0 -23
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/macro-options.json +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +1 -1
- 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/init.mjs +17 -13
- data/node_modules/govuk-frontend/dist/govuk/init.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +5 -10
- data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss.map +1 -1
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
- data/node_modules/govuk-frontend/package.json +9 -9
- metadata +4 -6
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs +0 -18
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-dataset.mjs.map +0 -1
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs +0 -31
- data/node_modules/govuk-frontend/dist/govuk/common/normalise-string.mjs.map +0 -1
data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs
CHANGED
@@ -3,76 +3,6 @@ function closestAttributeValue($element, attributeName) {
|
|
3
3
|
return $closestElementWithAttribute ? $closestElementWithAttribute.getAttribute(attributeName) : null;
|
4
4
|
}
|
5
5
|
|
6
|
-
function normaliseString(value, property) {
|
7
|
-
const trimmedValue = value ? value.trim() : '';
|
8
|
-
let output;
|
9
|
-
let outputType = property == null ? void 0 : property.type;
|
10
|
-
if (!outputType) {
|
11
|
-
if (['true', 'false'].includes(trimmedValue)) {
|
12
|
-
outputType = 'boolean';
|
13
|
-
}
|
14
|
-
if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
|
15
|
-
outputType = 'number';
|
16
|
-
}
|
17
|
-
}
|
18
|
-
switch (outputType) {
|
19
|
-
case 'boolean':
|
20
|
-
output = trimmedValue === 'true';
|
21
|
-
break;
|
22
|
-
case 'number':
|
23
|
-
output = Number(trimmedValue);
|
24
|
-
break;
|
25
|
-
default:
|
26
|
-
output = value;
|
27
|
-
}
|
28
|
-
return output;
|
29
|
-
}
|
30
|
-
|
31
|
-
/**
|
32
|
-
* @typedef {import('./index.mjs').SchemaProperty} SchemaProperty
|
33
|
-
*/
|
34
|
-
|
35
|
-
function mergeConfigs(...configObjects) {
|
36
|
-
const formattedConfigObject = {};
|
37
|
-
for (const configObject of configObjects) {
|
38
|
-
for (const key of Object.keys(configObject)) {
|
39
|
-
const option = formattedConfigObject[key];
|
40
|
-
const override = configObject[key];
|
41
|
-
if (isObject(option) && isObject(override)) {
|
42
|
-
formattedConfigObject[key] = mergeConfigs(option, override);
|
43
|
-
} else {
|
44
|
-
formattedConfigObject[key] = override;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
48
|
-
return formattedConfigObject;
|
49
|
-
}
|
50
|
-
function extractConfigByNamespace(Component, dataset, namespace) {
|
51
|
-
const property = Component.schema.properties[namespace];
|
52
|
-
if ((property == null ? void 0 : property.type) !== 'object') {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
const newObject = {
|
56
|
-
[namespace]: ({})
|
57
|
-
};
|
58
|
-
for (const [key, value] of Object.entries(dataset)) {
|
59
|
-
let current = newObject;
|
60
|
-
const keyParts = key.split('.');
|
61
|
-
for (const [index, name] of keyParts.entries()) {
|
62
|
-
if (typeof current === 'object') {
|
63
|
-
if (index < keyParts.length - 1) {
|
64
|
-
if (!isObject(current[name])) {
|
65
|
-
current[name] = {};
|
66
|
-
}
|
67
|
-
current = current[name];
|
68
|
-
} else if (key !== namespace) {
|
69
|
-
current[name] = normaliseString(value);
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
|
-
return newObject[namespace];
|
75
|
-
}
|
76
6
|
function isInitialised($root, moduleName) {
|
77
7
|
return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
|
78
8
|
}
|
@@ -101,47 +31,11 @@ function isObject(option) {
|
|
101
31
|
function formatErrorMessage(Component, message) {
|
102
32
|
return `${Component.moduleName}: ${message}`;
|
103
33
|
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Schema for component config
|
107
|
-
*
|
108
|
-
* @typedef {object} Schema
|
109
|
-
* @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
|
110
|
-
* @property {SchemaCondition[]} [anyOf] - List of schema conditions
|
111
|
-
*/
|
112
|
-
|
113
|
-
/**
|
114
|
-
* Schema property for component config
|
115
|
-
*
|
116
|
-
* @typedef {object} SchemaProperty
|
117
|
-
* @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
|
118
|
-
*/
|
119
|
-
|
120
|
-
/**
|
121
|
-
* Schema condition for component config
|
122
|
-
*
|
123
|
-
* @typedef {object} SchemaCondition
|
124
|
-
* @property {string[]} required - List of required config fields
|
125
|
-
* @property {string} errorMessage - Error message when required config fields not provided
|
126
|
-
*/
|
127
34
|
/**
|
128
35
|
* @typedef ComponentWithModuleName
|
129
36
|
* @property {string} moduleName - Name of the component
|
130
37
|
*/
|
131
38
|
|
132
|
-
function normaliseDataset(Component, dataset) {
|
133
|
-
const out = {};
|
134
|
-
for (const [field, property] of Object.entries(Component.schema.properties)) {
|
135
|
-
if (field in dataset) {
|
136
|
-
out[field] = normaliseString(dataset[field], property);
|
137
|
-
}
|
138
|
-
if ((property == null ? void 0 : property.type) === 'object') {
|
139
|
-
out[field] = extractConfigByNamespace(Component, dataset, field);
|
140
|
-
}
|
141
|
-
}
|
142
|
-
return out;
|
143
|
-
}
|
144
|
-
|
145
39
|
class GOVUKFrontendError extends Error {
|
146
40
|
constructor(...args) {
|
147
41
|
super(...args);
|
@@ -160,6 +54,12 @@ class SupportError extends GOVUKFrontendError {
|
|
160
54
|
this.name = 'SupportError';
|
161
55
|
}
|
162
56
|
}
|
57
|
+
class ConfigError extends GOVUKFrontendError {
|
58
|
+
constructor(...args) {
|
59
|
+
super(...args);
|
60
|
+
this.name = 'ConfigError';
|
61
|
+
}
|
62
|
+
}
|
163
63
|
class ElementError extends GOVUKFrontendError {
|
164
64
|
constructor(messageOrOptions) {
|
165
65
|
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
@@ -244,6 +144,144 @@ class GOVUKFrontendComponent {
|
|
244
144
|
*/
|
245
145
|
GOVUKFrontendComponent.elementType = HTMLElement;
|
246
146
|
|
147
|
+
const configOverride = Symbol.for('configOverride');
|
148
|
+
class ConfigurableComponent extends GOVUKFrontendComponent {
|
149
|
+
[configOverride](param) {
|
150
|
+
return {};
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Returns the root element of the component
|
155
|
+
*
|
156
|
+
* @protected
|
157
|
+
* @returns {ConfigurationType} - the root element of component
|
158
|
+
*/
|
159
|
+
get config() {
|
160
|
+
return this._config;
|
161
|
+
}
|
162
|
+
constructor($root, config) {
|
163
|
+
super($root);
|
164
|
+
this._config = void 0;
|
165
|
+
const childConstructor = this.constructor;
|
166
|
+
if (typeof childConstructor.defaults === 'undefined') {
|
167
|
+
throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));
|
168
|
+
}
|
169
|
+
const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);
|
170
|
+
this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
function normaliseString(value, property) {
|
174
|
+
const trimmedValue = value ? value.trim() : '';
|
175
|
+
let output;
|
176
|
+
let outputType = property == null ? void 0 : property.type;
|
177
|
+
if (!outputType) {
|
178
|
+
if (['true', 'false'].includes(trimmedValue)) {
|
179
|
+
outputType = 'boolean';
|
180
|
+
}
|
181
|
+
if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {
|
182
|
+
outputType = 'number';
|
183
|
+
}
|
184
|
+
}
|
185
|
+
switch (outputType) {
|
186
|
+
case 'boolean':
|
187
|
+
output = trimmedValue === 'true';
|
188
|
+
break;
|
189
|
+
case 'number':
|
190
|
+
output = Number(trimmedValue);
|
191
|
+
break;
|
192
|
+
default:
|
193
|
+
output = value;
|
194
|
+
}
|
195
|
+
return output;
|
196
|
+
}
|
197
|
+
function normaliseDataset(Component, dataset) {
|
198
|
+
if (typeof Component.schema === 'undefined') {
|
199
|
+
throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));
|
200
|
+
}
|
201
|
+
const out = {};
|
202
|
+
for (const [field, property] of Object.entries(Component.schema.properties)) {
|
203
|
+
if (field in dataset) {
|
204
|
+
out[field] = normaliseString(dataset[field], property);
|
205
|
+
}
|
206
|
+
if ((property == null ? void 0 : property.type) === 'object') {
|
207
|
+
out[field] = extractConfigByNamespace(Component.schema, dataset, field);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
return out;
|
211
|
+
}
|
212
|
+
function mergeConfigs(...configObjects) {
|
213
|
+
const formattedConfigObject = {};
|
214
|
+
for (const configObject of configObjects) {
|
215
|
+
for (const key of Object.keys(configObject)) {
|
216
|
+
const option = formattedConfigObject[key];
|
217
|
+
const override = configObject[key];
|
218
|
+
if (isObject(option) && isObject(override)) {
|
219
|
+
formattedConfigObject[key] = mergeConfigs(option, override);
|
220
|
+
} else {
|
221
|
+
formattedConfigObject[key] = override;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
return formattedConfigObject;
|
226
|
+
}
|
227
|
+
function extractConfigByNamespace(schema, dataset, namespace) {
|
228
|
+
const property = schema.properties[namespace];
|
229
|
+
if ((property == null ? void 0 : property.type) !== 'object') {
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
const newObject = {
|
233
|
+
[namespace]: ({})
|
234
|
+
};
|
235
|
+
for (const [key, value] of Object.entries(dataset)) {
|
236
|
+
let current = newObject;
|
237
|
+
const keyParts = key.split('.');
|
238
|
+
for (const [index, name] of keyParts.entries()) {
|
239
|
+
if (typeof current === 'object') {
|
240
|
+
if (index < keyParts.length - 1) {
|
241
|
+
if (!isObject(current[name])) {
|
242
|
+
current[name] = {};
|
243
|
+
}
|
244
|
+
current = current[name];
|
245
|
+
} else if (key !== namespace) {
|
246
|
+
current[name] = normaliseString(value);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
return newObject[namespace];
|
252
|
+
}
|
253
|
+
/**
|
254
|
+
* Schema for component config
|
255
|
+
*
|
256
|
+
* @typedef {object} Schema
|
257
|
+
* @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties
|
258
|
+
* @property {SchemaCondition[]} [anyOf] - List of schema conditions
|
259
|
+
*/
|
260
|
+
/**
|
261
|
+
* Schema property for component config
|
262
|
+
*
|
263
|
+
* @typedef {object} SchemaProperty
|
264
|
+
* @property {'string' | 'boolean' | 'number' | 'object'} type - Property type
|
265
|
+
*/
|
266
|
+
/**
|
267
|
+
* Schema condition for component config
|
268
|
+
*
|
269
|
+
* @typedef {object} SchemaCondition
|
270
|
+
* @property {string[]} required - List of required config fields
|
271
|
+
* @property {string} errorMessage - Error message when required config fields not provided
|
272
|
+
*/
|
273
|
+
/**
|
274
|
+
* @template {ObjectNested} [ConfigurationType={}]
|
275
|
+
* @typedef ChildClass
|
276
|
+
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
|
277
|
+
* @property {Schema} [schema] - The schema of the component configuration
|
278
|
+
* @property {ConfigurationType} [defaults] - The default values of the configuration of the component
|
279
|
+
*/
|
280
|
+
/**
|
281
|
+
* @template {ObjectNested} [ConfigurationType={}]
|
282
|
+
* @typedef {typeof GOVUKFrontendComponent & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
|
283
|
+
*/
|
284
|
+
|
247
285
|
class I18n {
|
248
286
|
constructor(translations = {}, config = {}) {
|
249
287
|
var _config$locale;
|
@@ -441,15 +479,15 @@ I18n.pluralRules = {
|
|
441
479
|
* Password input component
|
442
480
|
*
|
443
481
|
* @preserve
|
482
|
+
* @augments ConfigurableComponent<PasswordInputConfig>
|
444
483
|
*/
|
445
|
-
class PasswordInput extends
|
484
|
+
class PasswordInput extends ConfigurableComponent {
|
446
485
|
/**
|
447
486
|
* @param {Element | null} $root - HTML element to use for password input
|
448
487
|
* @param {PasswordInputConfig} [config] - Password input config
|
449
488
|
*/
|
450
489
|
constructor($root, config = {}) {
|
451
|
-
super($root);
|
452
|
-
this.config = void 0;
|
490
|
+
super($root, config);
|
453
491
|
this.i18n = void 0;
|
454
492
|
this.$input = void 0;
|
455
493
|
this.$showHideButton = void 0;
|
@@ -480,7 +518,6 @@ class PasswordInput extends GOVUKFrontendComponent {
|
|
480
518
|
}
|
481
519
|
this.$input = $input;
|
482
520
|
this.$showHideButton = $showHideButton;
|
483
|
-
this.config = mergeConfigs(PasswordInput.defaults, config, normaliseDataset(PasswordInput, this.$root.dataset));
|
484
521
|
this.i18n = new I18n(this.config.i18n, {
|
485
522
|
locale: closestAttributeValue(this.$root, 'lang')
|
486
523
|
});
|
@@ -560,7 +597,7 @@ class PasswordInput extends GOVUKFrontendComponent {
|
|
560
597
|
*/
|
561
598
|
|
562
599
|
/**
|
563
|
-
* @typedef {import('../../common/
|
600
|
+
* @typedef {import('../../common/configuration.mjs').Schema} Schema
|
564
601
|
* @typedef {import('../../i18n.mjs').TranslationPluralForms} TranslationPluralForms
|
565
602
|
*/
|
566
603
|
PasswordInput.moduleName = 'govuk-password-input';
|