@descope/web-components-ui 1.0.312 → 1.0.314
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/dist/cjs/index.cjs.js +209 -29
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +231 -63
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/4978.js +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-divider-index-js.js +1 -1
- package/dist/umd/descope-enriched-text-index-js.js +1 -1
- package/dist/umd/descope-link-index-js.js +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-new-password-index-js.js +1 -1
- package/dist/umd/descope-password-index-js.js +1 -1
- package/dist/umd/descope-text-index-js.js +1 -1
- package/dist/umd/descope-user-attribute-index-js.js +1 -1
- package/dist/umd/descope-user-auth-method-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-enriched-text/EnrichedTextClass.js +1 -0
- package/src/components/descope-link/LinkClass.js +1 -0
- package/src/components/descope-new-password/NewPasswordClass.js +27 -1
- package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +18 -30
- package/src/components/descope-password/PasswordClass.js +92 -15
- package/src/components/descope-password/helpers.js +62 -0
- package/src/components/descope-password/passwordDraggableMixin.js +16 -11
- package/src/components/descope-text/TextClass.js +1 -0
- package/src/mixins/inputValidationMixin.js +12 -1
package/dist/index.esm.js
CHANGED
@@ -763,8 +763,13 @@ const errorAttributes = {
|
|
763
763
|
tooShort: 'data-errormessage-pattern-mismatch-too-short',
|
764
764
|
tooLong: 'data-errormessage-pattern-mismatch-too-long',
|
765
765
|
};
|
766
|
+
|
767
|
+
const validationTargetSymbol = Symbol('validationTarget');
|
768
|
+
|
766
769
|
const inputValidationMixin = (superclass) =>
|
767
770
|
class InputValidationMixinClass extends superclass {
|
771
|
+
#validationTarget = validationTargetSymbol;
|
772
|
+
|
768
773
|
static get observedAttributes() {
|
769
774
|
return [...(superclass.observedAttributes || []), ...observedAttributes$6];
|
770
775
|
}
|
@@ -881,7 +886,13 @@ const inputValidationMixin = (superclass) =>
|
|
881
886
|
}
|
882
887
|
|
883
888
|
get validationTarget() {
|
884
|
-
return this
|
889
|
+
return this.#validationTarget === validationTargetSymbol
|
890
|
+
? this.inputElement
|
891
|
+
: this.#validationTarget;
|
892
|
+
}
|
893
|
+
|
894
|
+
set validationTarget(val) {
|
895
|
+
this.#validationTarget = val;
|
885
896
|
}
|
886
897
|
|
887
898
|
setCustomValidity(errorMessage) {
|
@@ -2289,6 +2300,7 @@ class RawText extends createBaseClass({ componentName: componentName$M, baseSele
|
|
2289
2300
|
<style>
|
2290
2301
|
:host {
|
2291
2302
|
display: inline-block;
|
2303
|
+
line-height: 1em;
|
2292
2304
|
}
|
2293
2305
|
:host > slot {
|
2294
2306
|
width: 100%;
|
@@ -2538,7 +2550,7 @@ var textFieldMappings = {
|
|
2538
2550
|
|
2539
2551
|
const componentName$K = getComponentName('email-field');
|
2540
2552
|
|
2541
|
-
const customMixin$
|
2553
|
+
const customMixin$9 = (superclass) =>
|
2542
2554
|
class EmailFieldMixinClass extends superclass {
|
2543
2555
|
init() {
|
2544
2556
|
super.init?.();
|
@@ -2552,7 +2564,7 @@ const EmailFieldClass = compose(
|
|
2552
2564
|
draggableMixin,
|
2553
2565
|
composedProxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
|
2554
2566
|
componentNameValidationMixin,
|
2555
|
-
customMixin$
|
2567
|
+
customMixin$9
|
2556
2568
|
)(
|
2557
2569
|
createProxy({
|
2558
2570
|
slots: ['', 'suffix'],
|
@@ -2587,6 +2599,7 @@ class RawLink extends createBaseClass({ componentName: componentName$J, baseSele
|
|
2587
2599
|
<style>
|
2588
2600
|
:host {
|
2589
2601
|
display: inline-block;
|
2602
|
+
line-height: 1em;
|
2590
2603
|
}
|
2591
2604
|
:host a {
|
2592
2605
|
display: inline;
|
@@ -3010,7 +3023,7 @@ const componentName$D = getComponentName('text-field');
|
|
3010
3023
|
|
3011
3024
|
const observedAttrs = ['type'];
|
3012
3025
|
|
3013
|
-
const customMixin$
|
3026
|
+
const customMixin$8 = (superclass) =>
|
3014
3027
|
class TextFieldClass extends superclass {
|
3015
3028
|
static get observedAttributes() {
|
3016
3029
|
return observedAttrs.concat(superclass.observedAttributes || []);
|
@@ -3062,7 +3075,7 @@ const TextFieldClass = compose(
|
|
3062
3075
|
draggableMixin,
|
3063
3076
|
composedProxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
|
3064
3077
|
componentNameValidationMixin,
|
3065
|
-
customMixin$
|
3078
|
+
customMixin$8
|
3066
3079
|
)(
|
3067
3080
|
createProxy({
|
3068
3081
|
slots: ['prefix', 'suffix'],
|
@@ -3089,7 +3102,7 @@ const componentName$C = getComponentName('passcode');
|
|
3089
3102
|
|
3090
3103
|
const observedAttributes$4 = ['digits'];
|
3091
3104
|
|
3092
|
-
const customMixin$
|
3105
|
+
const customMixin$7 = (superclass) =>
|
3093
3106
|
class PasscodeMixinClass extends superclass {
|
3094
3107
|
static get observedAttributes() {
|
3095
3108
|
return observedAttributes$4.concat(superclass.observedAttributes || []);
|
@@ -3185,7 +3198,7 @@ const PasscodeClass = compose(
|
|
3185
3198
|
draggableMixin,
|
3186
3199
|
composedProxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
|
3187
3200
|
componentNameValidationMixin,
|
3188
|
-
customMixin$
|
3201
|
+
customMixin$7
|
3189
3202
|
)(
|
3190
3203
|
createProxy({
|
3191
3204
|
slots: [],
|
@@ -3281,32 +3294,165 @@ const passwordDraggableMixin = (superclass) =>
|
|
3281
3294
|
// there is an issue in Chrome that input field with type password cannot be D&D
|
3282
3295
|
// so in case the input is draggable & readonly, we are changing the input type to "text" before dragging
|
3283
3296
|
// and return the original type when done
|
3284
|
-
|
3297
|
+
super.init?.();
|
3298
|
+
|
3299
|
+
const ele = this.querySelector('input');
|
3300
|
+
|
3301
|
+
ele?.addEventListener('mousedown', (e) => {
|
3285
3302
|
if (this.isDraggable && this.isReadOnly) {
|
3286
|
-
|
3287
|
-
const prevType = inputEle.getAttribute('type');
|
3303
|
+
ele.setAttribute('inert', 'true');
|
3288
3304
|
|
3305
|
+
const inputEle = e.target;
|
3306
|
+
const prevType = inputEle.getAttribute('type');
|
3289
3307
|
inputEle.setAttribute('type', 'text');
|
3290
|
-
setTimeout(() =>
|
3308
|
+
setTimeout(() => {
|
3309
|
+
inputEle.focus();
|
3310
|
+
});
|
3291
3311
|
|
3292
3312
|
const onComplete = (_) => {
|
3293
3313
|
inputEle.setAttribute('type', prevType);
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3314
|
+
ele.removeAttribute('inert');
|
3315
|
+
this.removeEventListener('mouseup', onComplete);
|
3316
|
+
this.removeEventListener('dragend', onComplete);
|
3297
3317
|
};
|
3298
3318
|
|
3299
|
-
|
3300
|
-
|
3319
|
+
this.addEventListener('dragend', onComplete, { once: true });
|
3320
|
+
this.addEventListener('mouseup', onComplete, { once: true });
|
3301
3321
|
}
|
3302
3322
|
});
|
3303
|
-
|
3304
|
-
super.init?.();
|
3305
3323
|
}
|
3306
3324
|
};
|
3307
3325
|
|
3326
|
+
// since on load we can only sample the color of the placeholder,
|
3327
|
+
// we need to temporarily populate the input in order to sample the value color
|
3328
|
+
const getValueColor = (ele, computedStyle) => {
|
3329
|
+
// eslint-disable-next-line no-param-reassign
|
3330
|
+
ele.value = '_';
|
3331
|
+
|
3332
|
+
const valueColor = computedStyle.getPropertyValue('color');
|
3333
|
+
|
3334
|
+
// eslint-disable-next-line no-param-reassign
|
3335
|
+
ele.value = '';
|
3336
|
+
|
3337
|
+
return valueColor;
|
3338
|
+
};
|
3339
|
+
|
3340
|
+
const createExternalInputSlot = (slotName, targetSlotName) => {
|
3341
|
+
const slotEle = document.createElement('slot');
|
3342
|
+
|
3343
|
+
slotEle.setAttribute('name', slotName);
|
3344
|
+
slotEle.setAttribute('slot', targetSlotName);
|
3345
|
+
|
3346
|
+
return slotEle;
|
3347
|
+
};
|
3348
|
+
|
3349
|
+
const createExternalInputEle = (targetSlotName, autocompleteType) => {
|
3350
|
+
const inputEle = document.createElement('input');
|
3351
|
+
|
3352
|
+
inputEle.setAttribute('slot', targetSlotName);
|
3353
|
+
inputEle.setAttribute('type', 'password');
|
3354
|
+
inputEle.setAttribute('data-hidden-input', 'true');
|
3355
|
+
inputEle.setAttribute('autocomplete', autocompleteType);
|
3356
|
+
|
3357
|
+
return inputEle;
|
3358
|
+
};
|
3359
|
+
|
3360
|
+
const applyExternalInputStyles = (sourceInputEle, targetInputEle) => {
|
3361
|
+
const computedStyle = getComputedStyle(sourceInputEle);
|
3362
|
+
const height = computedStyle.getPropertyValue('height');
|
3363
|
+
const paddingLeft = computedStyle.getPropertyValue('padding-left');
|
3364
|
+
const paddingRight = computedStyle.getPropertyValue('padding-right');
|
3365
|
+
const fontSize = computedStyle.getPropertyValue('font-size');
|
3366
|
+
const fontFamily = computedStyle.getPropertyValue('font-family');
|
3367
|
+
const letterSpacing = computedStyle.getPropertyValue('letter-spacing');
|
3368
|
+
const caretColor = computedStyle.getPropertyValue('caret-color');
|
3369
|
+
const valueColor = getValueColor(sourceInputEle, computedStyle);
|
3370
|
+
|
3371
|
+
// set external input style (and lock it with `all: unset` and `!important` all around)
|
3372
|
+
// eslint-disable-next-line no-param-reassign
|
3373
|
+
targetInputEle.style = `
|
3374
|
+
all: unset !important;
|
3375
|
+
position: absolute !important;
|
3376
|
+
width: calc(100% - 3em) !important;
|
3377
|
+
background-color: transparent !important;
|
3378
|
+
color: ${valueColor} !important;
|
3379
|
+
height: ${height} !important;
|
3380
|
+
left: ${paddingLeft} !important;
|
3381
|
+
right: ${paddingRight} !important;
|
3382
|
+
font-size: ${fontSize} !important;
|
3383
|
+
font-family: ${fontFamily} !important;
|
3384
|
+
letter-spacing: ${letterSpacing} !important;
|
3385
|
+
caret-color: ${caretColor} !important;
|
3386
|
+
`;
|
3387
|
+
};
|
3388
|
+
|
3308
3389
|
const componentName$B = getComponentName('password');
|
3309
3390
|
|
3391
|
+
const customMixin$6 = (superclass) =>
|
3392
|
+
class PasswordFieldMixinClass extends superclass {
|
3393
|
+
init() {
|
3394
|
+
super.init?.();
|
3395
|
+
|
3396
|
+
// reset vaadin's checkValidity
|
3397
|
+
this.baseElement.checkValidity = () => {};
|
3398
|
+
// set safety attribute `external-input`
|
3399
|
+
this.setAttribute('external-input', 'true');
|
3400
|
+
|
3401
|
+
// use original input element as reference
|
3402
|
+
const origInput = this.baseElement.querySelector('input');
|
3403
|
+
|
3404
|
+
// create external slot
|
3405
|
+
const externalInputSlot = createExternalInputSlot('external-input', 'suffix');
|
3406
|
+
// append external slot to base element
|
3407
|
+
this.baseElement.appendChild(externalInputSlot);
|
3408
|
+
|
3409
|
+
// create external input
|
3410
|
+
const externalInput = createExternalInputEle('external-input', this.getAutocompleteType());
|
3411
|
+
|
3412
|
+
// apply original input's styles to external input
|
3413
|
+
setTimeout(() => {
|
3414
|
+
applyExternalInputStyles(origInput, externalInput);
|
3415
|
+
});
|
3416
|
+
|
3417
|
+
// set external input events
|
3418
|
+
this.handleExternalInputEvents(externalInput);
|
3419
|
+
|
3420
|
+
// sync input stateful attributes: `type` (for visibility state change) and `readonly`
|
3421
|
+
syncAttrs(origInput, externalInput, { includeAttrs: ['type', 'readonly'] });
|
3422
|
+
|
3423
|
+
origInput.addEventListener('focus', (e) => {
|
3424
|
+
e.preventDefault();
|
3425
|
+
if (e.isTrusted) {
|
3426
|
+
externalInput.focus();
|
3427
|
+
}
|
3428
|
+
});
|
3429
|
+
|
3430
|
+
this.addEventListener('focus', (e) => {
|
3431
|
+
e.preventDefault();
|
3432
|
+
this.focus();
|
3433
|
+
});
|
3434
|
+
|
3435
|
+
// append external input to component's DOM
|
3436
|
+
this.appendChild(externalInput);
|
3437
|
+
}
|
3438
|
+
|
3439
|
+
getAutocompleteType() {
|
3440
|
+
return this.getAttribute('autocomplete') || 'current-password';
|
3441
|
+
}
|
3442
|
+
|
3443
|
+
handleExternalInputEvents(inputEle) {
|
3444
|
+
// sync value of insible input back to original input
|
3445
|
+
inputEle.addEventListener('input', (e) => {
|
3446
|
+
this.value = e.target.value;
|
3447
|
+
});
|
3448
|
+
|
3449
|
+
// sync `focused` attribute on host when focusing on external input
|
3450
|
+
inputEle.addEventListener('focus', () => {
|
3451
|
+
this.setAttribute('focused', 'true');
|
3452
|
+
});
|
3453
|
+
}
|
3454
|
+
};
|
3455
|
+
|
3310
3456
|
const {
|
3311
3457
|
host: host$f,
|
3312
3458
|
inputField: inputField$5,
|
@@ -3322,9 +3468,9 @@ const {
|
|
3322
3468
|
host: { selector: () => ':host' },
|
3323
3469
|
inputField: { selector: '::part(input-field)' },
|
3324
3470
|
inputElement: { selector: '> input' },
|
3325
|
-
inputElementPlaceholder: { selector: '
|
3326
|
-
revealButtonContainer: { selector:
|
3327
|
-
revealButtonIcon: { selector:
|
3471
|
+
inputElementPlaceholder: { selector: () => ':host input:placeholder-shown' },
|
3472
|
+
revealButtonContainer: { selector: '::part(reveal-button)' },
|
3473
|
+
revealButtonIcon: { selector: '::part(reveal-button)::before' },
|
3328
3474
|
label: { selector: '::part(label)' },
|
3329
3475
|
requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
|
3330
3476
|
helperText: { selector: '::part(helper-text)' },
|
@@ -3363,8 +3509,14 @@ const PasswordClass = compose(
|
|
3363
3509
|
labelRequiredIndicator: { ...requiredIndicator$7, property: 'content' },
|
3364
3510
|
errorMessageTextColor: { ...errorMessage$8, property: 'color' },
|
3365
3511
|
|
3366
|
-
|
3367
|
-
|
3512
|
+
inputPlaceholderTextColor: [
|
3513
|
+
{ ...inputElementPlaceholder, property: 'color' },
|
3514
|
+
{ selector: () => ':host ::slotted(input:placeholder-shown)', property: 'color' },
|
3515
|
+
],
|
3516
|
+
inputValueTextColor: [
|
3517
|
+
{ ...inputElement$2, property: 'color' },
|
3518
|
+
{ selector: () => ':host ::slotted(input)', property: 'color' },
|
3519
|
+
],
|
3368
3520
|
|
3369
3521
|
revealButtonOffset: [
|
3370
3522
|
{ ...revealButtonContainer, property: 'margin-right' },
|
@@ -3377,7 +3529,8 @@ const PasswordClass = compose(
|
|
3377
3529
|
draggableMixin,
|
3378
3530
|
composedProxyInputMixin({ proxyProps: ['value', 'selectionStart'] }),
|
3379
3531
|
componentNameValidationMixin,
|
3380
|
-
passwordDraggableMixin
|
3532
|
+
passwordDraggableMixin,
|
3533
|
+
customMixin$6
|
3381
3534
|
)(
|
3382
3535
|
createProxy({
|
3383
3536
|
slots: ['', 'suffix'],
|
@@ -3388,6 +3541,7 @@ const PasswordClass = compose(
|
|
3388
3541
|
max-width: 100%;
|
3389
3542
|
min-width: 10em;
|
3390
3543
|
box-sizing: border-box;
|
3544
|
+
position: relative;
|
3391
3545
|
}
|
3392
3546
|
${useHostExternalPadding(PasswordClass.cssVarList)}
|
3393
3547
|
${resetInputCursor('vaadin-password-field')}
|
@@ -3399,7 +3553,9 @@ const PasswordClass = compose(
|
|
3399
3553
|
padding: 0;
|
3400
3554
|
}
|
3401
3555
|
vaadin-password-field > input {
|
3556
|
+
-webkit-mask-image: none;
|
3402
3557
|
box-sizing: border-box;
|
3558
|
+
opacity: 1;
|
3403
3559
|
}
|
3404
3560
|
vaadin-password-field::part(input-field) {
|
3405
3561
|
box-sizing: border-box;
|
@@ -3408,12 +3564,11 @@ const PasswordClass = compose(
|
|
3408
3564
|
vaadin-password-field[focus-ring]::part(input-field) {
|
3409
3565
|
box-shadow: none;
|
3410
3566
|
}
|
3411
|
-
|
3567
|
+
:host ::slotted(input) {
|
3412
3568
|
min-height: 0;
|
3413
|
-
|
3414
|
-
|
3415
|
-
|
3416
|
-
opacity: 1;
|
3569
|
+
}
|
3570
|
+
:host([readonly]) ::slotted(input:placeholder-shown) {
|
3571
|
+
opacity: 0;
|
3417
3572
|
}
|
3418
3573
|
vaadin-password-field::before {
|
3419
3574
|
height: initial;
|
@@ -3424,11 +3579,9 @@ const PasswordClass = compose(
|
|
3424
3579
|
vaadin-password-field-button {
|
3425
3580
|
cursor: pointer;
|
3426
3581
|
}
|
3427
|
-
|
3428
|
-
[readonly] vaadin-password-field-button {
|
3582
|
+
:host([readonly]) vaadin-password-field-button {
|
3429
3583
|
pointer-events: none;
|
3430
3584
|
}
|
3431
|
-
|
3432
3585
|
vaadin-password-field-button[focus-ring] {
|
3433
3586
|
box-shadow: 0 0 0 2px var(${PasswordClass.cssVarList.inputOutlineColor});
|
3434
3587
|
}
|
@@ -3466,6 +3619,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
|
|
3466
3619
|
<style>
|
3467
3620
|
:host {
|
3468
3621
|
display: inline-block;
|
3622
|
+
line-height: 1em;
|
3469
3623
|
}
|
3470
3624
|
:host > slot {
|
3471
3625
|
width: 100%;
|
@@ -6351,13 +6505,24 @@ const customMixin$3 = (superclass) =>
|
|
6351
6505
|
name="new-password"
|
6352
6506
|
tabindex="-1"
|
6353
6507
|
slot="input"
|
6354
|
-
|
6508
|
+
>
|
6509
|
+
</${componentName$s}>
|
6355
6510
|
`;
|
6356
6511
|
|
6512
|
+
this.setAttribute('external-input', 'true');
|
6513
|
+
|
6357
6514
|
this.baseElement.appendChild(template.content.cloneNode(true));
|
6358
6515
|
|
6359
6516
|
this.inputElement = this.shadowRoot.querySelector(componentName$s);
|
6360
6517
|
|
6518
|
+
// get descope input components
|
6519
|
+
this.passwordInput = this.inputElement.querySelector('[data-id="password"]');
|
6520
|
+
this.confirmInput = this.inputElement.querySelector('[data-id="confirm"]');
|
6521
|
+
|
6522
|
+
// create slots for external password input
|
6523
|
+
this.createExternalInput(this.passwordInput, 'external-password-input');
|
6524
|
+
this.createExternalInput(this.confirmInput, 'external-confirm-input');
|
6525
|
+
|
6361
6526
|
forwardAttrs(this, this.inputElement, {
|
6362
6527
|
includeAttrs: [
|
6363
6528
|
'password-label',
|
@@ -6380,6 +6545,20 @@ const customMixin$3 = (superclass) =>
|
|
6380
6545
|
],
|
6381
6546
|
});
|
6382
6547
|
}
|
6548
|
+
|
6549
|
+
createExternalInput(node, slotName) {
|
6550
|
+
const externalInput = node.querySelector('input');
|
6551
|
+
const slotEle = document.createElement('slot');
|
6552
|
+
const targetSlot = externalInput.getAttribute('slot');
|
6553
|
+
slotEle.setAttribute('name', slotName);
|
6554
|
+
slotEle.setAttribute('slot', targetSlot);
|
6555
|
+
node.appendChild(slotEle);
|
6556
|
+
|
6557
|
+
// move external input
|
6558
|
+
externalInput.setAttribute('slot', slotName);
|
6559
|
+
externalInput.setAttribute('data-hidden-input', 'true');
|
6560
|
+
this.appendChild(externalInput);
|
6561
|
+
}
|
6383
6562
|
};
|
6384
6563
|
|
6385
6564
|
const {
|
@@ -6467,6 +6646,7 @@ const NewPasswordClass = compose(
|
|
6467
6646
|
padding: 0;
|
6468
6647
|
}
|
6469
6648
|
descope-new-password-internal > .wrapper {
|
6649
|
+
-webkit-mask-image: none;
|
6470
6650
|
width: 100%;
|
6471
6651
|
height: 100%;
|
6472
6652
|
display: flex;
|
@@ -6503,6 +6683,7 @@ const passwordInputAttrs = ['password-label', 'password-placeholder'];
|
|
6503
6683
|
const confirmInputAttrs = ['confirm-label', 'confirm-placeholder'];
|
6504
6684
|
const policyPanelAttrs = ['has-validation'];
|
6505
6685
|
const commonAttrs = [
|
6686
|
+
'has-confirm',
|
6506
6687
|
'disabled',
|
6507
6688
|
'bordered',
|
6508
6689
|
'size',
|
@@ -6525,7 +6706,7 @@ const BaseInputClass$4 = createBaseInputClass({ componentName: componentName$s,
|
|
6525
6706
|
|
6526
6707
|
class NewPasswordInternal extends BaseInputClass$4 {
|
6527
6708
|
static get observedAttributes() {
|
6528
|
-
return [
|
6709
|
+
return [].concat(BaseInputClass$4.observedAttributes || [], inputRelatedAttrs);
|
6529
6710
|
}
|
6530
6711
|
|
6531
6712
|
constructor() {
|
@@ -6551,6 +6732,14 @@ class NewPasswordInternal extends BaseInputClass$4 {
|
|
6551
6732
|
return this.getAttribute('has-confirm') === 'true';
|
6552
6733
|
}
|
6553
6734
|
|
6735
|
+
onHasConfirmChange(hasConfirm) {
|
6736
|
+
this.confirmInput.style.display = hasConfirm ? '' : 'none';
|
6737
|
+
}
|
6738
|
+
|
6739
|
+
onHasValidationChange(hasValidation) {
|
6740
|
+
this.policyPanel.style.display = hasValidation ? '' : 'none';
|
6741
|
+
}
|
6742
|
+
|
6554
6743
|
get hasValidation() {
|
6555
6744
|
return this.getAttribute('has-validation') === 'true';
|
6556
6745
|
}
|
@@ -6589,20 +6778,15 @@ class NewPasswordInternal extends BaseInputClass$4 {
|
|
6589
6778
|
this.renderInputs(this.hasConfirm, this.hasValidation);
|
6590
6779
|
}
|
6591
6780
|
|
6592
|
-
renderInputs(
|
6593
|
-
|
6781
|
+
renderInputs() {
|
6782
|
+
const template = `
|
6594
6783
|
<div>
|
6595
|
-
<descope-password data-id="password"></descope-password>
|
6596
|
-
<descope-policy-validation
|
6597
|
-
shouldRenderValidation ? 'hidden' : ''
|
6598
|
-
}"></descope-policy-validation>
|
6784
|
+
<descope-password autocomplete="new-password" data-id="password"></descope-password>
|
6785
|
+
<descope-policy-validation></descope-policy-validation>
|
6599
6786
|
</div>
|
6787
|
+
<descope-password autocomplete="new-password" data-id="confirm"></descope-password>
|
6600
6788
|
`;
|
6601
6789
|
|
6602
|
-
if (shouldRenderConfirm) {
|
6603
|
-
template += `<descope-password data-id="confirm"></descope-password>`;
|
6604
|
-
}
|
6605
|
-
|
6606
6790
|
this.wrapperEle.innerHTML = template;
|
6607
6791
|
|
6608
6792
|
this.passwordInput = this.querySelector('[data-id="password"]');
|
@@ -6613,12 +6797,7 @@ class NewPasswordInternal extends BaseInputClass$4 {
|
|
6613
6797
|
|
6614
6798
|
this.initInputs();
|
6615
6799
|
|
6616
|
-
//
|
6617
|
-
// in order to set it on the newly generated input
|
6618
|
-
[...passwordInputAttrs, ...confirmInputAttrs, ...commonAttrs].forEach((attr) => {
|
6619
|
-
this.attributeChangedCallback(attr, null, this.getAttribute(attr));
|
6620
|
-
});
|
6621
|
-
|
6800
|
+
// sync input value to policy validation panel
|
6622
6801
|
this.passwordInput.addEventListener('input', (e) => {
|
6623
6802
|
this.policyPanel.setAttribute('value', e.target.value);
|
6624
6803
|
});
|
@@ -6694,22 +6873,14 @@ class NewPasswordInternal extends BaseInputClass$4 {
|
|
6694
6873
|
value === null ? ele?.removeAttribute(name) : ele?.setAttribute(name, value);
|
6695
6874
|
}
|
6696
6875
|
|
6697
|
-
hidePolicy() {
|
6698
|
-
this.policyPanel.classList.add('hidden');
|
6699
|
-
}
|
6700
|
-
|
6701
|
-
showPolicy() {
|
6702
|
-
this.policyPanel.classList.remove('hidden');
|
6703
|
-
}
|
6704
|
-
|
6705
6876
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
6706
6877
|
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
6707
6878
|
|
6708
6879
|
if (oldValue !== newValue) {
|
6709
6880
|
if (attrName === 'has-validation') {
|
6710
|
-
this.
|
6881
|
+
this.onHasValidationChange(newValue === 'true');
|
6711
6882
|
} else if (attrName === 'has-confirm') {
|
6712
|
-
this.
|
6883
|
+
this.onHasConfirmChange(newValue === 'true');
|
6713
6884
|
} else if (commonAttrs.includes(attrName)) {
|
6714
6885
|
this.inputs.forEach((input) => this.toggleBooleanAttribute(input, attrName, newValue));
|
6715
6886
|
} else if (passwordInputAttrs.includes(attrName)) {
|
@@ -6725,9 +6896,6 @@ class NewPasswordInternal extends BaseInputClass$4 {
|
|
6725
6896
|
newValue
|
6726
6897
|
);
|
6727
6898
|
}
|
6728
|
-
if (attrName === 'has-validation') {
|
6729
|
-
newValue === 'true' ? this.showPolicy() : this.hidePolicy();
|
6730
|
-
}
|
6731
6899
|
}
|
6732
6900
|
}
|
6733
6901
|
}
|