@schukai/monster 4.105.0 → 4.106.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.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.
|
|
1
|
+
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.106.0"}
|
|
@@ -0,0 +1,765 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © Volker Schukai and all contributing authors, {{copyRightYear}}. All rights reserved.
|
|
3
|
+
* Node module: @schukai/monster
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
7
|
+
*
|
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
|
10
|
+
* For more information about purchasing a commercial license, please contact Volker Schukai.
|
|
11
|
+
*
|
|
12
|
+
* SPDX-License-Identifier: AGPL-3.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { instanceSymbol } from "../../constants.mjs";
|
|
16
|
+
import {
|
|
17
|
+
assembleMethodSymbol,
|
|
18
|
+
registerCustomElement,
|
|
19
|
+
} from "../../dom/customelement.mjs";
|
|
20
|
+
import { ATTRIBUTE_ROLE } from "../../dom/constants.mjs";
|
|
21
|
+
import { fireCustomEvent } from "../../dom/events.mjs";
|
|
22
|
+
import { getLocaleOfDocument } from "../../dom/locale.mjs";
|
|
23
|
+
import { isFunction, isObject, isString } from "../../types/is.mjs";
|
|
24
|
+
import { validateString } from "../../types/validate.mjs";
|
|
25
|
+
import { getGlobal } from "../../types/global.mjs";
|
|
26
|
+
import { PopperButton } from "./popper-button.mjs";
|
|
27
|
+
import { AccessibilityStyleSheet } from "../stylesheet/accessibility.mjs";
|
|
28
|
+
import "./form.mjs";
|
|
29
|
+
import "./field-set.mjs";
|
|
30
|
+
import "./password.mjs";
|
|
31
|
+
import "./message-state-button.mjs";
|
|
32
|
+
|
|
33
|
+
export { CredentialButton };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @private
|
|
37
|
+
* @type {symbol}
|
|
38
|
+
*/
|
|
39
|
+
const passwordElementSymbol = Symbol("passwordElement");
|
|
40
|
+
const passwordInputElementSymbol = Symbol("passwordInputElement");
|
|
41
|
+
const submitButtonElementSymbol = Symbol("submitButtonElement");
|
|
42
|
+
const formElementSymbol = Symbol("formElement");
|
|
43
|
+
const fieldSetElementSymbol = Symbol("fieldSetElement");
|
|
44
|
+
const inFlightSymbol = Symbol("inFlight");
|
|
45
|
+
const wiredSymbol = Symbol("wired");
|
|
46
|
+
const mutationObserverSymbol = Symbol("mutationObserver");
|
|
47
|
+
const formWiredSymbol = Symbol("formWired");
|
|
48
|
+
const passwordWiredSymbol = Symbol("passwordWired");
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A password credential button control.
|
|
52
|
+
*
|
|
53
|
+
* @fragments /fragments/components/form/credential-button/
|
|
54
|
+
*
|
|
55
|
+
* @example /examples/components/form/credential-button-simple
|
|
56
|
+
*
|
|
57
|
+
* @since 3.91.0
|
|
58
|
+
* @copyright Volker Schukai
|
|
59
|
+
* @summary A popper button that opens a password change form.
|
|
60
|
+
* @fires monster-credential-submit
|
|
61
|
+
* @fires monster-credential-successful
|
|
62
|
+
* @fires monster-credential-failed
|
|
63
|
+
*/
|
|
64
|
+
class CredentialButton extends PopperButton {
|
|
65
|
+
/**
|
|
66
|
+
* This method is called by the `instanceof` operator.
|
|
67
|
+
* @return {symbol}
|
|
68
|
+
*/
|
|
69
|
+
static get [instanceSymbol]() {
|
|
70
|
+
return Symbol.for(
|
|
71
|
+
"@schukai/monster/components/form/credential-button@@instance",
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
|
77
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
|
78
|
+
*
|
|
79
|
+
* The individual configuration values can be found in the table.
|
|
80
|
+
*
|
|
81
|
+
* @property {Object} templates Template definitions
|
|
82
|
+
* @property {string} templates.main Main template
|
|
83
|
+
* @property {Object} labels Label definitions
|
|
84
|
+
* @property {string} labels.button Button label
|
|
85
|
+
* @property {string} labels.title Field-set title
|
|
86
|
+
* @property {string} labels.password Password label
|
|
87
|
+
* @property {string} labels.description Description text
|
|
88
|
+
* @property {string} labels.submit Submit button label
|
|
89
|
+
* @property {string} labels.messageEmptyPassword Empty password message
|
|
90
|
+
* @property {string} labels.messageNotConfigured Not configured message
|
|
91
|
+
* @property {string} labels.messageSuccess Success message
|
|
92
|
+
* @property {string} labels.messageFailed Failure message
|
|
93
|
+
* @property {string} url API URL
|
|
94
|
+
* @property {Object} fetch Fetch options
|
|
95
|
+
* @property {string} fetch.redirect Fetch redirect option
|
|
96
|
+
* @property {string} fetch.method Fetch method
|
|
97
|
+
* @property {string} fetch.mode Fetch mode
|
|
98
|
+
* @property {string} fetch.credentials Fetch credentials
|
|
99
|
+
* @property {Object} fetch.headers Fetch headers
|
|
100
|
+
* @property {Object} mapping Mapping configuration
|
|
101
|
+
* @property {string} mapping.password Key for the password field in the payload
|
|
102
|
+
* @property {Object|Function} mapping.data Additional payload data or builder
|
|
103
|
+
* @property {Object} payload Payload configuration
|
|
104
|
+
* @property {string} payload.password Key for the password field in the payload
|
|
105
|
+
* @property {Object|Function} payload.data Additional payload data or builder
|
|
106
|
+
* @property {Object} placeholder Placeholder configuration
|
|
107
|
+
* @property {string} placeholder.password Password placeholder
|
|
108
|
+
* @property {Object} autocomplete Autocomplete configuration
|
|
109
|
+
* @property {string} autocomplete.password Password autocomplete
|
|
110
|
+
* @property {Object} classes Class definitions
|
|
111
|
+
* @property {Object} layout Layout configuration
|
|
112
|
+
* @property {string} layout.containerStyle Inline style for the container
|
|
113
|
+
* @property {string} layout.submitStyle Inline style for the submit button
|
|
114
|
+
* @property {number} timeoutForMessage Duration in milliseconds to show messages
|
|
115
|
+
* @property {number} timeoutForSuccess Duration in milliseconds for success state
|
|
116
|
+
* @property {Object} features Feature flags
|
|
117
|
+
* @property {boolean} features.closeOnSuccess Close popper on success
|
|
118
|
+
* @property {boolean} features.clearOnSuccess Clear password on success
|
|
119
|
+
*/
|
|
120
|
+
get defaults() {
|
|
121
|
+
const base = super.defaults;
|
|
122
|
+
const labels = getTranslations();
|
|
123
|
+
return Object.assign({}, base, {
|
|
124
|
+
templates: {
|
|
125
|
+
main: getTemplate(),
|
|
126
|
+
},
|
|
127
|
+
labels,
|
|
128
|
+
aria: Object.assign({}, base.aria, {
|
|
129
|
+
label: labels.button,
|
|
130
|
+
}),
|
|
131
|
+
layout: {
|
|
132
|
+
containerStyle: "width: 20rem;",
|
|
133
|
+
submitStyle: "margin-top: var(--monster-space-4);",
|
|
134
|
+
},
|
|
135
|
+
url: "",
|
|
136
|
+
fetch: {
|
|
137
|
+
redirect: "error",
|
|
138
|
+
method: "POST",
|
|
139
|
+
mode: "same-origin",
|
|
140
|
+
credentials: "same-origin",
|
|
141
|
+
headers: {
|
|
142
|
+
accept: "application/json",
|
|
143
|
+
"content-type": "application/json",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
mapping: {},
|
|
147
|
+
payload: {
|
|
148
|
+
password: "password",
|
|
149
|
+
data: null,
|
|
150
|
+
},
|
|
151
|
+
placeholder: {
|
|
152
|
+
password: "",
|
|
153
|
+
},
|
|
154
|
+
autocomplete: {
|
|
155
|
+
password: "new-password",
|
|
156
|
+
},
|
|
157
|
+
timeoutForMessage: 3500,
|
|
158
|
+
timeoutForSuccess: 1200,
|
|
159
|
+
features: {
|
|
160
|
+
closeOnSuccess: true,
|
|
161
|
+
clearOnSuccess: true,
|
|
162
|
+
},
|
|
163
|
+
content: getContentTemplate(labels),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @return {CredentialButton}
|
|
169
|
+
*/
|
|
170
|
+
[assembleMethodSymbol]() {
|
|
171
|
+
super[assembleMethodSymbol]();
|
|
172
|
+
initControlReferences.call(this);
|
|
173
|
+
initEventHandler.call(this);
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @return {string}
|
|
179
|
+
*/
|
|
180
|
+
static getTag() {
|
|
181
|
+
return "monster-credential-button";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @return {CSSStyleSheet[]}
|
|
186
|
+
*/
|
|
187
|
+
static getCSSStyleSheet() {
|
|
188
|
+
const styles = super.getCSSStyleSheet();
|
|
189
|
+
styles.push(AccessibilityStyleSheet);
|
|
190
|
+
return styles;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @private
|
|
196
|
+
* @return {CredentialButton}
|
|
197
|
+
*/
|
|
198
|
+
function initControlReferences() {
|
|
199
|
+
this[passwordElementSymbol] = this.shadowRoot.querySelector(
|
|
200
|
+
`[${ATTRIBUTE_ROLE}=password]`,
|
|
201
|
+
);
|
|
202
|
+
this[submitButtonElementSymbol] = this.shadowRoot.querySelector(
|
|
203
|
+
`[${ATTRIBUTE_ROLE}=submit-button]`,
|
|
204
|
+
);
|
|
205
|
+
this[formElementSymbol] = this.shadowRoot.querySelector(
|
|
206
|
+
`[${ATTRIBUTE_ROLE}=form]`,
|
|
207
|
+
);
|
|
208
|
+
this[fieldSetElementSymbol] = this.shadowRoot.querySelector(
|
|
209
|
+
`[${ATTRIBUTE_ROLE}=field-set]`,
|
|
210
|
+
);
|
|
211
|
+
return this;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @private
|
|
216
|
+
* @return {CredentialButton}
|
|
217
|
+
*/
|
|
218
|
+
function initEventHandler() {
|
|
219
|
+
const wireUp = () => {
|
|
220
|
+
initControlReferences.call(this);
|
|
221
|
+
|
|
222
|
+
if (this[formElementSymbol]) {
|
|
223
|
+
if (!this[formWiredSymbol]) {
|
|
224
|
+
this[formWiredSymbol] = true;
|
|
225
|
+
this[formElementSymbol].addEventListener("keydown", (event) => {
|
|
226
|
+
if (event.key === "Enter") {
|
|
227
|
+
this[submitButtonElementSymbol]?.click?.();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (this[fieldSetElementSymbol]) {
|
|
234
|
+
const title = this.getOption("labels.title");
|
|
235
|
+
if (title !== undefined) {
|
|
236
|
+
this[fieldSetElementSymbol].setOption("labels.title", title);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (this[passwordElementSymbol]) {
|
|
241
|
+
const input =
|
|
242
|
+
this[passwordElementSymbol]?.shadowRoot?.querySelector?.("input");
|
|
243
|
+
if (input instanceof HTMLElement) {
|
|
244
|
+
this[passwordInputElementSymbol] = input;
|
|
245
|
+
}
|
|
246
|
+
if (this[passwordInputElementSymbol] && !this[passwordWiredSymbol]) {
|
|
247
|
+
this[passwordWiredSymbol] = true;
|
|
248
|
+
const sync = () => {
|
|
249
|
+
const value = this[passwordElementSymbol]?.value ?? "";
|
|
250
|
+
this.value = value;
|
|
251
|
+
fireCustomEvent(this, "monster-change", { value });
|
|
252
|
+
this.dispatchEvent(
|
|
253
|
+
new Event("input", { bubbles: true, composed: true }),
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
this[passwordInputElementSymbol].addEventListener("input", sync);
|
|
257
|
+
this[passwordInputElementSymbol].addEventListener("change", () => {
|
|
258
|
+
this.dispatchEvent(
|
|
259
|
+
new Event("change", { bubbles: true, composed: true }),
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (!this[submitButtonElementSymbol] || this[wiredSymbol]) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
this[wiredSymbol] = true;
|
|
270
|
+
this[submitButtonElementSymbol].setOption("actions.click", () => {
|
|
271
|
+
handleSubmit.call(this);
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
queueMicrotask(wireUp);
|
|
276
|
+
|
|
277
|
+
if (!this[mutationObserverSymbol]) {
|
|
278
|
+
this[mutationObserverSymbol] = new MutationObserver(() => {
|
|
279
|
+
wireUp();
|
|
280
|
+
});
|
|
281
|
+
this[mutationObserverSymbol].observe(this.shadowRoot, {
|
|
282
|
+
childList: true,
|
|
283
|
+
subtree: true,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return this;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @private
|
|
292
|
+
*/
|
|
293
|
+
function handleSubmit() {
|
|
294
|
+
if (this[inFlightSymbol]) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const password = this[passwordElementSymbol]?.value;
|
|
299
|
+
const timeout = this.getOption("timeoutForMessage");
|
|
300
|
+
|
|
301
|
+
if (!password) {
|
|
302
|
+
this[submitButtonElementSymbol].setMessage(
|
|
303
|
+
this.getOption("labels.messageEmptyPassword"),
|
|
304
|
+
);
|
|
305
|
+
this[submitButtonElementSymbol].showMessage(timeout);
|
|
306
|
+
this[submitButtonElementSymbol].setState("failed", timeout);
|
|
307
|
+
queueMicrotask(() => this[passwordElementSymbol]?.focus?.());
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
this.value = password;
|
|
312
|
+
this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
313
|
+
|
|
314
|
+
let url = this.getOption("url") || this.getOption("fetch.url");
|
|
315
|
+
if (isString(url)) {
|
|
316
|
+
url = validateString(url);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const mapping = this.getOption("mapping");
|
|
320
|
+
const passwordField =
|
|
321
|
+
mapping?.password || this.getOption("payload.password") || "password";
|
|
322
|
+
let payload = { [passwordField]: password };
|
|
323
|
+
let extraPayload = mapping?.data ?? this.getOption("payload.data");
|
|
324
|
+
if (isFunction(extraPayload)) {
|
|
325
|
+
extraPayload = extraPayload({ password, element: this });
|
|
326
|
+
}
|
|
327
|
+
if (isObject(extraPayload)) {
|
|
328
|
+
payload = Object.assign({}, extraPayload, payload);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (!url) {
|
|
332
|
+
const timeoutSuccess = this.getOption("timeoutForSuccess");
|
|
333
|
+
this[submitButtonElementSymbol].setState("successful", timeoutSuccess);
|
|
334
|
+
const successMessage = this.getOption("labels.messageSuccess");
|
|
335
|
+
if (successMessage) {
|
|
336
|
+
this[submitButtonElementSymbol].setMessage(successMessage);
|
|
337
|
+
this[submitButtonElementSymbol].showMessage(timeout);
|
|
338
|
+
}
|
|
339
|
+
if (this.getOption("features.clearOnSuccess")) {
|
|
340
|
+
this[passwordElementSymbol].value = "";
|
|
341
|
+
}
|
|
342
|
+
if (this.getOption("features.closeOnSuccess")) {
|
|
343
|
+
setTimeout(() => {
|
|
344
|
+
this.hideDialog();
|
|
345
|
+
}, timeoutSuccess);
|
|
346
|
+
}
|
|
347
|
+
fireCustomEvent(this, "monster-credential-successful", {
|
|
348
|
+
password,
|
|
349
|
+
payload,
|
|
350
|
+
url: null,
|
|
351
|
+
local: true,
|
|
352
|
+
});
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const fetchOptions = Object.assign({}, this.getOption("fetch"));
|
|
357
|
+
if (fetchOptions.url) {
|
|
358
|
+
delete fetchOptions.url;
|
|
359
|
+
}
|
|
360
|
+
fetchOptions.headers = isObject(fetchOptions.headers)
|
|
361
|
+
? Object.assign({}, fetchOptions.headers)
|
|
362
|
+
: {};
|
|
363
|
+
if (!fetchOptions.headers.accept) {
|
|
364
|
+
fetchOptions.headers.accept = "application/json";
|
|
365
|
+
}
|
|
366
|
+
if (!fetchOptions.headers["content-type"]) {
|
|
367
|
+
fetchOptions.headers["content-type"] = "application/json";
|
|
368
|
+
}
|
|
369
|
+
fetchOptions.body = JSON.stringify(payload);
|
|
370
|
+
|
|
371
|
+
this[inFlightSymbol] = true;
|
|
372
|
+
this[submitButtonElementSymbol].setState("activity");
|
|
373
|
+
|
|
374
|
+
fireCustomEvent(this, "monster-credential-submit", {
|
|
375
|
+
password,
|
|
376
|
+
payload,
|
|
377
|
+
url,
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
const global = getGlobal();
|
|
381
|
+
global
|
|
382
|
+
.fetch(url, fetchOptions)
|
|
383
|
+
.then((response) => {
|
|
384
|
+
if (!response.ok) {
|
|
385
|
+
return Promise.reject(response);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const timeoutSuccess = this.getOption("timeoutForSuccess");
|
|
389
|
+
this[submitButtonElementSymbol].setState("successful", timeoutSuccess);
|
|
390
|
+
|
|
391
|
+
const successMessage = this.getOption("labels.messageSuccess");
|
|
392
|
+
if (successMessage) {
|
|
393
|
+
this[submitButtonElementSymbol].setMessage(successMessage);
|
|
394
|
+
this[submitButtonElementSymbol].showMessage(timeout);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (this.getOption("features.clearOnSuccess")) {
|
|
398
|
+
this[passwordElementSymbol].value = "";
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (this.getOption("features.closeOnSuccess")) {
|
|
402
|
+
setTimeout(() => {
|
|
403
|
+
this.hideDialog();
|
|
404
|
+
}, timeoutSuccess);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
fireCustomEvent(this, "monster-credential-successful", {
|
|
408
|
+
password,
|
|
409
|
+
payload,
|
|
410
|
+
url,
|
|
411
|
+
response,
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
return response;
|
|
415
|
+
})
|
|
416
|
+
.catch((error) => {
|
|
417
|
+
const message = this.getOption("labels.messageFailed");
|
|
418
|
+
this[submitButtonElementSymbol].setMessage(message);
|
|
419
|
+
this[submitButtonElementSymbol].showMessage(timeout);
|
|
420
|
+
this[submitButtonElementSymbol].setState("failed", timeout);
|
|
421
|
+
|
|
422
|
+
fireCustomEvent(this, "monster-credential-failed", {
|
|
423
|
+
password,
|
|
424
|
+
payload,
|
|
425
|
+
url,
|
|
426
|
+
error,
|
|
427
|
+
});
|
|
428
|
+
})
|
|
429
|
+
.finally(() => {
|
|
430
|
+
this[inFlightSymbol] = false;
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function getTranslations() {
|
|
435
|
+
const locale = getLocaleOfDocument();
|
|
436
|
+
switch (locale.language) {
|
|
437
|
+
case "de":
|
|
438
|
+
return {
|
|
439
|
+
button: "Passwort ändern",
|
|
440
|
+
title: "Passwort ändern",
|
|
441
|
+
password: "Neues Passwort",
|
|
442
|
+
description:
|
|
443
|
+
"Wählen Sie ein sicheres Passwort, damit Ihr Konto gut geschützt ist. Es könnte aus Groß- und Kleinbuchstaben, Zahlen und Sonderzeichen bestehen. Auch wäre es besser, kein leicht zu erratendes Wort wie einen Namen oder ein Geburtsdatum zu verwenden.",
|
|
444
|
+
submit: "Passwort ändern",
|
|
445
|
+
messageEmptyPassword: "Bitte geben Sie ein neues Passwort ein",
|
|
446
|
+
messageNotConfigured: "Dieses Formular ist nicht konfiguriert.",
|
|
447
|
+
messageSuccess: "Passwort wurde erfolgreich geändert.",
|
|
448
|
+
messageFailed:
|
|
449
|
+
"Etwas ist schief gelaufen, bitte versuchen Sie es später erneut",
|
|
450
|
+
};
|
|
451
|
+
case "es":
|
|
452
|
+
return {
|
|
453
|
+
button: "Cambiar contraseña",
|
|
454
|
+
title: "Cambiar contraseña",
|
|
455
|
+
password: "Nueva contraseña",
|
|
456
|
+
description:
|
|
457
|
+
"Elige una contraseña segura para proteger tu cuenta. Usa una combinación de mayúsculas, minúsculas, números y símbolos. Evita palabras fáciles de adivinar como nombres o fechas de nacimiento.",
|
|
458
|
+
submit: "Cambiar contraseña",
|
|
459
|
+
messageEmptyPassword: "Por favor ingrese una nueva contraseña",
|
|
460
|
+
messageNotConfigured: "Este formulario no está configurado.",
|
|
461
|
+
messageSuccess: "La contraseña se cambió correctamente.",
|
|
462
|
+
messageFailed:
|
|
463
|
+
"Algo salió mal, por favor intenta de nuevo más tarde.",
|
|
464
|
+
};
|
|
465
|
+
case "zh":
|
|
466
|
+
return {
|
|
467
|
+
button: "更改密码",
|
|
468
|
+
title: "更改密码",
|
|
469
|
+
password: "新密码",
|
|
470
|
+
description:
|
|
471
|
+
"请选择一个安全密码以保护您的账户。建议包含大小写字母、数字和符号。避免使用容易猜到的词语,例如姓名或生日。",
|
|
472
|
+
submit: "更改密码",
|
|
473
|
+
messageEmptyPassword: "请输入新密码",
|
|
474
|
+
messageNotConfigured: "此表单尚未配置。",
|
|
475
|
+
messageSuccess: "密码修改成功。",
|
|
476
|
+
messageFailed: "出了点问题,请稍后再试。",
|
|
477
|
+
};
|
|
478
|
+
case "hi":
|
|
479
|
+
return {
|
|
480
|
+
button: "पासवर्ड बदलें",
|
|
481
|
+
title: "पासवर्ड बदलें",
|
|
482
|
+
password: "नया पासवर्ड",
|
|
483
|
+
description:
|
|
484
|
+
"अपने खाते की सुरक्षा के लिए एक मजबूत पासवर्ड चुनें। इसमें बड़े/छोटे अक्षर, संख्या और प्रतीक शामिल करें। नाम या जन्मतिथि जैसे आसानी से अनुमानित शब्दों से बचें।",
|
|
485
|
+
submit: "पासवर्ड बदलें",
|
|
486
|
+
messageEmptyPassword: "कृपया नया पासवर्ड दर्ज करें",
|
|
487
|
+
messageNotConfigured: "यह फॉर्म कॉन्फ़िगर नहीं है।",
|
|
488
|
+
messageSuccess: "पासवर्ड सफलतापूर्वक बदल दिया गया है।",
|
|
489
|
+
messageFailed:
|
|
490
|
+
"कुछ गलत हुआ, कृपया बाद में फिर से प्रयास करें।",
|
|
491
|
+
};
|
|
492
|
+
case "bn":
|
|
493
|
+
return {
|
|
494
|
+
button: "পাসওয়ার্ড পরিবর্তন করুন",
|
|
495
|
+
title: "পাসওয়ার্ড পরিবর্তন করুন",
|
|
496
|
+
password: "নতুন পাসওয়ার্ড",
|
|
497
|
+
description:
|
|
498
|
+
"আপনার অ্যাকাউন্ট সুরক্ষিত রাখতে একটি শক্তিশালী পাসওয়ার্ড বেছে নিন। বড় ও ছোট হাতের অক্ষর, সংখ্যা এবং প্রতীক ব্যবহার করুন। নাম বা জন্মতারিখের মতো সহজে অনুমানযোগ্য শব্দ এড়িয়ে চলুন।",
|
|
499
|
+
submit: "পাসওয়ার্ড পরিবর্তন করুন",
|
|
500
|
+
messageEmptyPassword: "অনুগ্রহ করে একটি নতুন পাসওয়ার্ড লিখুন",
|
|
501
|
+
messageNotConfigured: "এই ফর্মটি কনফিগার করা হয়নি।",
|
|
502
|
+
messageSuccess: "পাসওয়ার্ড সফলভাবে পরিবর্তন হয়েছে।",
|
|
503
|
+
messageFailed: "কিছু ভুল হয়েছে, পরে আবার চেষ্টা করুন।",
|
|
504
|
+
};
|
|
505
|
+
case "pt":
|
|
506
|
+
return {
|
|
507
|
+
button: "Alterar senha",
|
|
508
|
+
title: "Alterar senha",
|
|
509
|
+
password: "Nova senha",
|
|
510
|
+
description:
|
|
511
|
+
"Escolha uma senha forte para manter sua conta segura. Use letras maiúsculas e minúsculas, números e símbolos. Evite palavras fáceis de adivinhar, como nomes ou datas de nascimento.",
|
|
512
|
+
submit: "Alterar senha",
|
|
513
|
+
messageEmptyPassword: "Por favor, insira uma nova senha",
|
|
514
|
+
messageNotConfigured: "Este formulário não está configurado.",
|
|
515
|
+
messageSuccess: "Senha alterada com sucesso.",
|
|
516
|
+
messageFailed:
|
|
517
|
+
"Algo deu errado, tente novamente mais tarde.",
|
|
518
|
+
};
|
|
519
|
+
case "ru":
|
|
520
|
+
return {
|
|
521
|
+
button: "Изменить пароль",
|
|
522
|
+
title: "Изменить пароль",
|
|
523
|
+
password: "Новый пароль",
|
|
524
|
+
description:
|
|
525
|
+
"Выберите надежный пароль, чтобы защитить учетную запись. Используйте заглавные и строчные буквы, цифры и символы. Избегайте легко угадываемых слов, таких как имена или даты рождения.",
|
|
526
|
+
submit: "Изменить пароль",
|
|
527
|
+
messageEmptyPassword: "Пожалуйста, введите новый пароль",
|
|
528
|
+
messageNotConfigured: "Эта форма не настроена.",
|
|
529
|
+
messageSuccess: "Пароль успешно изменен.",
|
|
530
|
+
messageFailed:
|
|
531
|
+
"Что-то пошло не так, попробуйте позже.",
|
|
532
|
+
};
|
|
533
|
+
case "ja":
|
|
534
|
+
return {
|
|
535
|
+
button: "パスワードを変更",
|
|
536
|
+
title: "パスワードを変更",
|
|
537
|
+
password: "新しいパスワード",
|
|
538
|
+
description:
|
|
539
|
+
"アカウントを安全に保つため、強力なパスワードを設定してください。大文字・小文字、数字、記号を組み合わせ、名前や誕生日など推測しやすい語は避けてください。",
|
|
540
|
+
submit: "パスワードを変更",
|
|
541
|
+
messageEmptyPassword: "新しいパスワードを入力してください",
|
|
542
|
+
messageNotConfigured: "このフォームは設定されていません。",
|
|
543
|
+
messageSuccess: "パスワードを変更しました。",
|
|
544
|
+
messageFailed:
|
|
545
|
+
"問題が発生しました。後でもう一度お試しください。",
|
|
546
|
+
};
|
|
547
|
+
case "pa":
|
|
548
|
+
return {
|
|
549
|
+
button: "ਪਾਸਵਰਡ ਬਦਲੋ",
|
|
550
|
+
title: "ਪਾਸਵਰਡ ਬਦਲੋ",
|
|
551
|
+
password: "ਨਵਾਂ ਪਾਸਵਰਡ",
|
|
552
|
+
description:
|
|
553
|
+
"ਆਪਣਾ ਖਾਤਾ ਸੁਰੱਖਿਅਤ ਰੱਖਣ ਲਈ ਇੱਕ ਮਜ਼ਬੂਤ ਪਾਸਵਰਡ ਚੁਣੋ। ਵੱਡੇ/ਛੋਟੇ ਅੱਖਰ, ਅੰਕ ਅਤੇ ਚਿੰਨ੍ਹ ਵਰਤੋ। ਨਾਮ ਜਾਂ ਜਨਮ ਤਾਰੀਖ ਵਰਗੇ ਆਸਾਨੀ ਨਾਲ ਅਨੁਮਾਨਯੋਗ ਸ਼ਬਦਾਂ ਤੋਂ ਬਚੋ।",
|
|
554
|
+
submit: "ਪਾਸਵਰਡ ਬਦਲੋ",
|
|
555
|
+
messageEmptyPassword: "ਕਿਰਪਾ ਕਰਕੇ ਨਵਾਂ ਪਾਸਵਰਡ ਦਾਖਲ ਕਰੋ",
|
|
556
|
+
messageNotConfigured: "ਇਹ ਫਾਰਮ ਸੰਰਚਿਤ ਨਹੀਂ ਹੈ।",
|
|
557
|
+
messageSuccess: "ਪਾਸਵਰਡ ਸਫਲਤਾਪੂਰਵਕ ਬਦਲਿਆ ਗਿਆ।",
|
|
558
|
+
messageFailed:
|
|
559
|
+
"ਕੁਝ ਗਲਤ ਹੋ ਗਿਆ, ਕਿਰਪਾ ਕਰਕੇ ਬਾਅਦ ਵਿੱਚ ਕੋਸ਼ਿਸ਼ ਕਰੋ।",
|
|
560
|
+
};
|
|
561
|
+
case "mr":
|
|
562
|
+
return {
|
|
563
|
+
button: "पासवर्ड बदला",
|
|
564
|
+
title: "पासवर्ड बदला",
|
|
565
|
+
password: "नवीन पासवर्ड",
|
|
566
|
+
description:
|
|
567
|
+
"आपले खाते सुरक्षित ठेवण्यासाठी मजबूत पासवर्ड निवडा. मोठी/लहान अक्षरे, संख्या आणि चिन्हे वापरा. नाव किंवा जन्मतारीखसारखे सहज अंदाज लावता येणारे शब्द टाळा.",
|
|
568
|
+
submit: "पासवर्ड बदला",
|
|
569
|
+
messageEmptyPassword: "कृपया नवीन पासवर्ड प्रविष्ट करा",
|
|
570
|
+
messageNotConfigured: "हा फॉर्म कॉन्फिगर केलेला नाही.",
|
|
571
|
+
messageSuccess: "पासवर्ड यशस्वीरित्या बदलला.",
|
|
572
|
+
messageFailed:
|
|
573
|
+
"काहीतरी चूक झाली, कृपया नंतर पुन्हा प्रयत्न करा.",
|
|
574
|
+
};
|
|
575
|
+
case "fr":
|
|
576
|
+
return {
|
|
577
|
+
button: "Changer le mot de passe",
|
|
578
|
+
title: "Changer le mot de passe",
|
|
579
|
+
password: "Nouveau mot de passe",
|
|
580
|
+
description:
|
|
581
|
+
"Choisissez un mot de passe fort pour protéger votre compte. Utilisez des majuscules, minuscules, chiffres et symboles. Évitez les mots faciles à deviner comme des noms ou des dates de naissance.",
|
|
582
|
+
submit: "Changer le mot de passe",
|
|
583
|
+
messageEmptyPassword: "Veuillez saisir un nouveau mot de passe",
|
|
584
|
+
messageNotConfigured: "Ce formulaire n'est pas configuré.",
|
|
585
|
+
messageSuccess: "Mot de passe modifié avec succès.",
|
|
586
|
+
messageFailed:
|
|
587
|
+
"Une erreur s'est produite, veuillez réessayer plus tard.",
|
|
588
|
+
};
|
|
589
|
+
case "it":
|
|
590
|
+
return {
|
|
591
|
+
button: "Cambia password",
|
|
592
|
+
title: "Cambia password",
|
|
593
|
+
password: "Nuova password",
|
|
594
|
+
description:
|
|
595
|
+
"Scegli una password sicura per proteggere il tuo account. Usa lettere maiuscole e minuscole, numeri e simboli. Evita parole facili da indovinare come nomi o date di nascita.",
|
|
596
|
+
submit: "Cambia password",
|
|
597
|
+
messageEmptyPassword: "Per favore, inserisci una nuova password",
|
|
598
|
+
messageNotConfigured: "Questo modulo non è configurato.",
|
|
599
|
+
messageSuccess: "Password aggiornata con successo.",
|
|
600
|
+
messageFailed:
|
|
601
|
+
"Qualcosa è andato storto, riprova più tardi.",
|
|
602
|
+
};
|
|
603
|
+
case "nl":
|
|
604
|
+
return {
|
|
605
|
+
button: "Wachtwoord wijzigen",
|
|
606
|
+
title: "Wachtwoord wijzigen",
|
|
607
|
+
password: "Nieuw wachtwoord",
|
|
608
|
+
description:
|
|
609
|
+
"Kies een sterk wachtwoord om je account te beveiligen. Gebruik hoofdletters, kleine letters, cijfers en symbolen. Vermijd gemakkelijk te raden woorden zoals namen of geboortedata.",
|
|
610
|
+
submit: "Wachtwoord wijzigen",
|
|
611
|
+
messageEmptyPassword: "Voer een nieuw wachtwoord in",
|
|
612
|
+
messageNotConfigured: "Dit formulier is niet geconfigureerd.",
|
|
613
|
+
messageSuccess: "Wachtwoord succesvol gewijzigd.",
|
|
614
|
+
messageFailed:
|
|
615
|
+
"Er is iets misgegaan, probeer het later opnieuw.",
|
|
616
|
+
};
|
|
617
|
+
case "sv":
|
|
618
|
+
return {
|
|
619
|
+
button: "Ändra lösenord",
|
|
620
|
+
title: "Ändra lösenord",
|
|
621
|
+
password: "Nytt lösenord",
|
|
622
|
+
description:
|
|
623
|
+
"Välj ett starkt lösenord för att skydda ditt konto. Använd stora och små bokstäver, siffror och symboler. Undvik lättgissade ord som namn eller födelsedatum.",
|
|
624
|
+
submit: "Ändra lösenord",
|
|
625
|
+
messageEmptyPassword: "Ange ett nytt lösenord",
|
|
626
|
+
messageNotConfigured: "Det här formuläret är inte konfigurerat.",
|
|
627
|
+
messageSuccess: "Lösenordet har ändrats.",
|
|
628
|
+
messageFailed:
|
|
629
|
+
"Något gick fel, försök igen senare.",
|
|
630
|
+
};
|
|
631
|
+
case "pl":
|
|
632
|
+
return {
|
|
633
|
+
button: "Zmień hasło",
|
|
634
|
+
title: "Zmień hasło",
|
|
635
|
+
password: "Nowe hasło",
|
|
636
|
+
description:
|
|
637
|
+
"Wybierz silne hasło, aby chronić swoje konto. Używaj wielkich i małych liter, cyfr oraz symboli. Unikaj łatwych do odgadnięcia słów, takich jak imiona czy daty urodzenia.",
|
|
638
|
+
submit: "Zmień hasło",
|
|
639
|
+
messageEmptyPassword: "Wpisz nowe hasło",
|
|
640
|
+
messageNotConfigured: "Ten formularz nie jest skonfigurowany.",
|
|
641
|
+
messageSuccess: "Hasło zostało zmienione.",
|
|
642
|
+
messageFailed:
|
|
643
|
+
"Coś poszło nie tak, spróbuj ponownie później.",
|
|
644
|
+
};
|
|
645
|
+
case "da":
|
|
646
|
+
return {
|
|
647
|
+
button: "Skift adgangskode",
|
|
648
|
+
title: "Skift adgangskode",
|
|
649
|
+
password: "Ny adgangskode",
|
|
650
|
+
description:
|
|
651
|
+
"Vælg en stærk adgangskode for at beskytte din konto. Brug store og små bogstaver, tal og symboler. Undgå let gættelige ord som navne eller fødselsdatoer.",
|
|
652
|
+
submit: "Skift adgangskode",
|
|
653
|
+
messageEmptyPassword: "Indtast en ny adgangskode",
|
|
654
|
+
messageNotConfigured: "Denne formular er ikke konfigureret.",
|
|
655
|
+
messageSuccess: "Adgangskoden er ændret.",
|
|
656
|
+
messageFailed:
|
|
657
|
+
"Noget gik galt, prøv igen senere.",
|
|
658
|
+
};
|
|
659
|
+
case "no":
|
|
660
|
+
return {
|
|
661
|
+
button: "Endre passord",
|
|
662
|
+
title: "Endre passord",
|
|
663
|
+
password: "Nytt passord",
|
|
664
|
+
description:
|
|
665
|
+
"Velg et sterkt passord for å beskytte kontoen din. Bruk store og små bokstaver, tall og symboler. Unngå lett gjettelige ord som navn eller fødselsdato.",
|
|
666
|
+
submit: "Endre passord",
|
|
667
|
+
messageEmptyPassword: "Skriv inn et nytt passord",
|
|
668
|
+
messageNotConfigured: "Dette skjemaet er ikke konfigurert.",
|
|
669
|
+
messageSuccess: "Passordet er endret.",
|
|
670
|
+
messageFailed:
|
|
671
|
+
"Noe gikk galt, prøv igjen senere.",
|
|
672
|
+
};
|
|
673
|
+
case "cs":
|
|
674
|
+
return {
|
|
675
|
+
button: "Změnit heslo",
|
|
676
|
+
title: "Změnit heslo",
|
|
677
|
+
password: "Nové heslo",
|
|
678
|
+
description:
|
|
679
|
+
"Zvolte silné heslo, aby byl váš účet v bezpečí. Použijte velká a malá písmena, čísla a symboly. Vyhněte se snadno uhodnutelným slovům, jako jsou jména nebo data narození.",
|
|
680
|
+
submit: "Změnit heslo",
|
|
681
|
+
messageEmptyPassword: "Zadejte nové heslo",
|
|
682
|
+
messageNotConfigured: "Tento formulář není nakonfigurován.",
|
|
683
|
+
messageSuccess: "Heslo bylo úspěšně změněno.",
|
|
684
|
+
messageFailed:
|
|
685
|
+
"Něco se pokazilo, zkuste to prosím později.",
|
|
686
|
+
};
|
|
687
|
+
default:
|
|
688
|
+
case "en":
|
|
689
|
+
return {
|
|
690
|
+
button: "Change password",
|
|
691
|
+
title: "Change password",
|
|
692
|
+
password: "New password",
|
|
693
|
+
description:
|
|
694
|
+
"Choose a strong password to keep your account secure. Use a mix of upper- and lowercase letters, numbers, and symbols. Avoid easy-to-guess words like names or birthdays.",
|
|
695
|
+
submit: "Change password",
|
|
696
|
+
messageEmptyPassword: "Please enter a new password",
|
|
697
|
+
messageNotConfigured: "This form is not configured.",
|
|
698
|
+
messageSuccess: "Password updated successfully.",
|
|
699
|
+
messageFailed:
|
|
700
|
+
"Something went wrong. Please try again later.",
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* @private
|
|
707
|
+
* @return {string}
|
|
708
|
+
*/
|
|
709
|
+
function getContentTemplate(labels) {
|
|
710
|
+
const title = labels?.title ?? "";
|
|
711
|
+
const password = labels?.password ?? "";
|
|
712
|
+
const description = labels?.description ?? "";
|
|
713
|
+
const submit = labels?.submit ?? "";
|
|
714
|
+
// language=HTML
|
|
715
|
+
return `
|
|
716
|
+
<div data-monster-role="container" part="container"
|
|
717
|
+
data-monster-attributes="style path:layout.containerStyle">
|
|
718
|
+
<monster-form data-monster-role="form">
|
|
719
|
+
<monster-field-set
|
|
720
|
+
part="field-set"
|
|
721
|
+
data-monster-role="field-set"
|
|
722
|
+
data-monster-option-labels-title="${title}">
|
|
723
|
+
<label part="password-label">${password}</label>
|
|
724
|
+
<monster-password part="password"
|
|
725
|
+
data-monster-role="password"
|
|
726
|
+
data-monster-attributes="data-monster-option-placeholder path:placeholder.password,
|
|
727
|
+
data-monster-option-autocomplete path:autocomplete.password">
|
|
728
|
+
</monster-password>
|
|
729
|
+
<p part="description">${description}</p>
|
|
730
|
+
<monster-message-state-button
|
|
731
|
+
data-monster-role="submit-button"
|
|
732
|
+
part="submit-button"
|
|
733
|
+
data-monster-attributes="style path:layout.submitStyle">
|
|
734
|
+
${submit}
|
|
735
|
+
</monster-message-state-button>
|
|
736
|
+
</monster-field-set>
|
|
737
|
+
</monster-form>
|
|
738
|
+
</div>
|
|
739
|
+
`;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* @private
|
|
744
|
+
* @return {string}
|
|
745
|
+
*/
|
|
746
|
+
function getTemplate() {
|
|
747
|
+
return `
|
|
748
|
+
<div data-monster-role="control" part="control">
|
|
749
|
+
<button data-monster-attributes="disabled path:disabled | if:true, class path:classes.button"
|
|
750
|
+
data-monster-role="button"
|
|
751
|
+
part="button"
|
|
752
|
+
aria-labelledby="monster-credential-button-aria-label"
|
|
753
|
+
data-monster-replace="path:labels.button"></button>
|
|
754
|
+
<div id="monster-credential-button-aria-label"
|
|
755
|
+
class="visually-hidden" data-monster-replace="path:aria.label">change password</div>
|
|
756
|
+
|
|
757
|
+
<div data-monster-role="popper" part="popper" tabindex="-1" class="monster-color-primary-1">
|
|
758
|
+
<div data-monster-role="arrow"></div>
|
|
759
|
+
<div part="content" class="flex" data-monster-replace="path:content"></div>
|
|
760
|
+
</div>
|
|
761
|
+
</div>
|
|
762
|
+
`;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
registerCustomElement(CredentialButton);
|
package/source/monster.mjs
CHANGED
|
@@ -60,6 +60,7 @@ export * from "./components/form/cart-control.mjs";
|
|
|
60
60
|
export * from "./components/form/context-hint.mjs";
|
|
61
61
|
export * from "./components/form/select.mjs";
|
|
62
62
|
export * from "./components/form/login.mjs";
|
|
63
|
+
export * from "./components/form/credential-button.mjs";
|
|
63
64
|
export * from "./components/form/confirm-button.mjs";
|
|
64
65
|
export * from "./components/form/context-info.mjs";
|
|
65
66
|
export * from "./components/form/context-base.mjs";
|