@descope/web-components-ui 1.0.350 → 1.0.351

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/index.esm.js CHANGED
@@ -3460,10 +3460,20 @@ const componentName$E = getComponentName('password');
3460
3460
 
3461
3461
  const customMixin$7 = (superclass) =>
3462
3462
  class PasswordFieldMixinClass extends superclass {
3463
+ static get observedAttributes() {
3464
+ return ['manual-visibility-toggle'];
3465
+ }
3466
+
3467
+ get manualToggleVisibility() {
3468
+ return this.getAttribute('manual-visibility-toggle') === 'true';
3469
+ }
3470
+
3463
3471
  init() {
3464
3472
  super.init?.();
3465
-
3466
3473
  this.handleCaretOnVisibilityChange();
3474
+ this.origSetPasswordVisible = this.baseElement._setPasswordVisible;
3475
+ this.origSetFocused = this.baseElement._setFocused;
3476
+ this.baseElement._setFocused = this.setFocus.bind(this);
3467
3477
  }
3468
3478
 
3469
3479
  get caretPosition() {
@@ -3482,8 +3492,27 @@ const customMixin$7 = (superclass) =>
3482
3492
  };
3483
3493
  }
3484
3494
 
3485
- getAutocompleteType() {
3486
- return this.getAttribute('autocomplete') || 'current-password';
3495
+ // We use `manual-visibility-toggle` to to toggle the password's visibility
3496
+ // even if the input field is focused-out. However, on focusout - Vaadin resets
3497
+ // password visibility. Since we don't want to override Vaadin's native setFocus
3498
+ // function (which is part of their FocusMixin).
3499
+ // So, here we override the part of logic that runs within Vaadin's setFocus that reports
3500
+ // the password visibility state. This logic is part of our `manual-visibility-toggle` only.
3501
+ setFocus(focused) {
3502
+ if (this.manualToggleVisibility) {
3503
+ this.baseElement._setPasswordVisible = () => {};
3504
+ }
3505
+ this.origSetFocused.call(this.baseElement, focused);
3506
+ this.baseElement._setPasswordVisible = this.origSetPasswordVisible.bind(this.baseElement);
3507
+ }
3508
+
3509
+ resetPasswordVisibilityToggle() {
3510
+ this.baseElement._setPasswordVisible = this.origSetPasswordVisible;
3511
+ this.baseElement._setFocused = this.origSetFocus;
3512
+ }
3513
+
3514
+ attributeChangedCallback(attrName, oldValue, newValue) {
3515
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
3487
3516
  }
3488
3517
  };
3489
3518
 
@@ -6802,6 +6831,7 @@ const customMixin$4 = (superclass) =>
6802
6831
  'available-policies',
6803
6832
  'data-password-policy-value-minlength',
6804
6833
  'label-type',
6834
+ 'manual-visibility-toggle',
6805
6835
  ],
6806
6836
  });
6807
6837
  }
@@ -6949,6 +6979,7 @@ const commonAttrs = [
6949
6979
  'draggable',
6950
6980
  'autocomplete',
6951
6981
  'label-type',
6982
+ 'manual-visibility-toggle',
6952
6983
  ];
6953
6984
 
6954
6985
  const inputRelatedAttrs = [].concat(
@@ -7064,6 +7095,7 @@ class NewPasswordInternal extends BaseInputClass$4 {
7064
7095
  'available-policies',
7065
7096
  'active-policies',
7066
7097
  'data-password-policy-value-minlength',
7098
+ 'manual-visibility-toggle',
7067
7099
  ],
7068
7100
  mapAttrs: {
7069
7101
  'policy-label': 'label',