@descope/web-components-ui 1.0.405 → 1.0.407

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
@@ -1436,10 +1436,14 @@ const inputEventsDispatchingMixin = (superclass) =>
1436
1436
  // we are comparing the previous value to the new one,
1437
1437
  // and if they have the same value, we are blocking the input event
1438
1438
  this.addEventListener('input', (e) => {
1439
- e.stopImmediatePropagation();
1440
- if (previousRootComponentValue !== this.value) {
1441
- previousRootComponentValue = this.value;
1442
- createDispatchEvent.call(this, 'input', { bubbles: true });
1439
+ // We don't want to block our own event that we fire from handleInputEventDispatching
1440
+ if (this !== e.target) {
1441
+ e.stopImmediatePropagation();
1442
+
1443
+ if (previousRootComponentValue !== this.value) {
1444
+ previousRootComponentValue = this.value;
1445
+ createDispatchEvent.call(this, 'input', { bubbles: true, composed: true });
1446
+ }
1443
1447
  }
1444
1448
  });
1445
1449
  }
@@ -8768,7 +8772,6 @@ class PhoneFieldInternal extends BaseInputClass$5 {
8768
8772
  });
8769
8773
 
8770
8774
  this.handleFocusEventsDispatching([this.phoneNumberInput]);
8771
- this.handleInputEventDispatching();
8772
8775
  }
8773
8776
 
8774
8777
  attributeChangedCallback(attrName, oldValue, newValue) {
@@ -9695,6 +9698,11 @@ class RawRecaptcha extends BaseClass$1 {
9695
9698
  }
9696
9699
 
9697
9700
  renderRecaptcha(enabled) {
9701
+ if (this.children.length) {
9702
+ this.updatePreview();
9703
+ return;
9704
+ }
9705
+
9698
9706
  if (enabled) {
9699
9707
  this.recaptchaEle.style.display = '';
9700
9708
  this.mockRecaptchaEle.style.display = 'none';
@@ -9712,7 +9720,7 @@ class RawRecaptcha extends BaseClass$1 {
9712
9720
  :host {
9713
9721
  display: inline-flex;
9714
9722
  }
9715
- :host > div {
9723
+ :host > div:not(.hidden) {
9716
9724
  display: flex;
9717
9725
  }
9718
9726
  :host #recaptcha .grecaptcha-badge {
@@ -9727,16 +9735,40 @@ class RawRecaptcha extends BaseClass$1 {
9727
9735
  }
9728
9736
  :host img {
9729
9737
  width: 256px;
9738
+ }
9739
+ :host([full-width="true"]) {
9740
+ width: 100%;
9741
+ }
9742
+ .hidden {
9743
+ display: none;
9730
9744
  }
9731
9745
  </style>
9732
- <div>
9746
+ <div class="badge">
9733
9747
  <span id="recaptcha"></span>
9734
9748
  <img src="https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png" alt="recaptcha"/>
9735
9749
  </div>
9750
+ <slot></slot>
9736
9751
  `;
9737
9752
 
9738
9753
  this.recaptchaEle = this.baseElement.querySelector('#recaptcha');
9739
9754
  this.mockRecaptchaEle = this.baseElement.querySelector('img');
9755
+ this.badge = this.shadowRoot.querySelector('.badge');
9756
+ }
9757
+
9758
+ init() {
9759
+ super.init?.();
9760
+
9761
+ observeChildren(this, this.updatePreview.bind(this));
9762
+ }
9763
+
9764
+ updatePreview() {
9765
+ if (this.children.length) {
9766
+ this.recaptchaEle.style.display = 'none';
9767
+ this.mockRecaptchaEle.style.display = 'none';
9768
+ this.badge.classList.add('hidden');
9769
+ } else {
9770
+ this.badge.classList.remove('hidden');
9771
+ }
9740
9772
  }
9741
9773
 
9742
9774
  get enterprise() {