@descope/web-components-ui 1.0.406 → 1.0.407-2

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.
@@ -1,7 +1,7 @@
1
1
  import { draggableMixin } from '../../mixins';
2
2
  import { createBaseClass } from '../../baseClasses/createBaseClass';
3
3
  import { compose } from '../../helpers';
4
- import { getComponentName } from '../../helpers/componentHelpers';
4
+ import { getComponentName, observeChildren } from '../../helpers/componentHelpers';
5
5
 
6
6
  export const componentName = getComponentName('recaptcha');
7
7
 
@@ -26,6 +26,11 @@ class RawRecaptcha extends BaseClass {
26
26
  }
27
27
 
28
28
  renderRecaptcha(enabled) {
29
+ if (this.children.length) {
30
+ this.updatePreview();
31
+ return;
32
+ }
33
+
29
34
  if (enabled) {
30
35
  this.recaptchaEle.style.display = '';
31
36
  this.mockRecaptchaEle.style.display = 'none';
@@ -43,7 +48,7 @@ class RawRecaptcha extends BaseClass {
43
48
  :host {
44
49
  display: inline-flex;
45
50
  }
46
- :host > div {
51
+ :host > div:not(.hidden) {
47
52
  display: flex;
48
53
  }
49
54
  :host #recaptcha .grecaptcha-badge {
@@ -58,16 +63,40 @@ class RawRecaptcha extends BaseClass {
58
63
  }
59
64
  :host img {
60
65
  width: 256px;
66
+ }
67
+ :host([full-width="true"]) {
68
+ width: 100%;
69
+ }
70
+ .hidden {
71
+ display: none;
61
72
  }
62
73
  </style>
63
- <div>
74
+ <div class="badge">
64
75
  <span id="recaptcha"></span>
65
76
  <img src="https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png" alt="recaptcha"/>
66
77
  </div>
78
+ <slot></slot>
67
79
  `;
68
80
 
69
81
  this.recaptchaEle = this.baseElement.querySelector('#recaptcha');
70
82
  this.mockRecaptchaEle = this.baseElement.querySelector('img');
83
+ this.badge = this.shadowRoot.querySelector('.badge');
84
+ }
85
+
86
+ init() {
87
+ super.init?.();
88
+
89
+ observeChildren(this, this.updatePreview.bind(this));
90
+ }
91
+
92
+ updatePreview() {
93
+ if (this.children.length) {
94
+ this.recaptchaEle.style.display = 'none';
95
+ this.mockRecaptchaEle.style.display = 'none';
96
+ this.badge.classList.add('hidden');
97
+ } else {
98
+ this.badge.classList.remove('hidden');
99
+ }
71
100
  }
72
101
 
73
102
  get enterprise() {
@@ -155,15 +155,15 @@ class RawUploadFile extends BaseInputClass {
155
155
  }
156
156
 
157
157
  updateTitle(val) {
158
- this.title.innerHTML = val;
158
+ this.title.textContent = val;
159
159
  }
160
160
 
161
161
  updateDescription(val) {
162
- this.description.innerHTML = val;
162
+ this.description.textContent = val;
163
163
  }
164
164
 
165
165
  updateButtonLabel(val) {
166
- this.button.innerHTML = val;
166
+ this.button.textContent = val;
167
167
  }
168
168
 
169
169
  updateButtonSize(val) {