@descope/web-components-ui 1.111.0 → 1.113.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.
Files changed (28) hide show
  1. package/dist/cjs/index.cjs.js +116 -50
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +124 -57
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/DescopeDev.js +1 -1
  6. package/dist/umd/DescopeDev.js.map +1 -1
  7. package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
  8. package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js.map +1 -1
  9. package/dist/umd/descope-button.js +1 -1
  10. package/dist/umd/descope-button.js.map +1 -1
  11. package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
  12. package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
  13. package/dist/umd/descope-outbound-apps.js +1 -1
  14. package/dist/umd/descope-outbound-apps.js.map +1 -1
  15. package/dist/umd/descope-timer-button.js +1 -1
  16. package/dist/umd/descope-timer-button.js.map +1 -1
  17. package/dist/umd/descope-upload-file-index-js.js +1 -1
  18. package/dist/umd/descope-upload-file-index-js.js.map +1 -1
  19. package/dist/umd/descope-user-attribute-index-js.js +1 -1
  20. package/dist/umd/descope-user-attribute-index-js.js.map +1 -1
  21. package/dist/umd/descope-user-auth-method-index-js.js +4 -4
  22. package/dist/umd/descope-user-auth-method-index-js.js.map +1 -1
  23. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  24. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  25. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  26. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  27. package/package.json +4 -4
  28. package/src/components/descope-user-auth-method/UserAuthMethodClass.js +72 -18
@@ -25,10 +25,13 @@ class RawUserAuthMethod extends createBaseClass({
25
25
  </div>
26
26
 
27
27
  <div class="btn-wrapper">
28
- <descope-button size="sm" variant="link" mode="primary">
28
+ <descope-button class="btn unfulfilled hidden" size="sm" variant="link" mode="primary">
29
29
  <slot name="button-icon"></slot>
30
30
  </descope-button>
31
- <div class="fulfilled-indicator">
31
+ <descope-button class="btn fulfilled hidden" size="sm" variant="link" mode="primary">
32
+ <slot name="fulfilled-button-icon"></slot>
33
+ </descope-button>
34
+ <div class="status-indicator hidden">
32
35
  <vaadin-icon src=${greenVIcon}></vaadin-icon>
33
36
  </div>
34
37
  <descope-button class="hidden-btn" size="sm" variant="link" mode="primary"></descope-button>
@@ -77,7 +80,7 @@ class RawUserAuthMethod extends createBaseClass({
77
80
  display: inline-flex;
78
81
  }
79
82
 
80
- .fulfilled-indicator {
83
+ .status-indicator {
81
84
  width: 1em;
82
85
  height: 1em;
83
86
  display: flex;
@@ -92,6 +95,8 @@ class RawUserAuthMethod extends createBaseClass({
92
95
  .hidden-btn {
93
96
  width: 0;
94
97
  overflow: hidden;
98
+ opacity: 0;
99
+ pointer-events: none;
95
100
  }
96
101
 
97
102
  slot[name="method-icon"]{
@@ -102,8 +107,9 @@ class RawUserAuthMethod extends createBaseClass({
102
107
  this
103
108
  );
104
109
 
105
- this.button = this.shadowRoot.querySelector('descope-button');
106
- this.fulfilledIndicator = this.shadowRoot.querySelector('.fulfilled-indicator');
110
+ this.unfulfilledButton = this.shadowRoot.querySelector('.btn.unfulfilled');
111
+ this.fulfilledButton = this.shadowRoot.querySelector('.btn.fulfilled');
112
+ this.statusIndicator = this.shadowRoot.querySelector('.status-indicator');
107
113
  this.labelText = this.shadowRoot.querySelector('descope-text[data-id="label-text"]');
108
114
  }
109
115
 
@@ -112,49 +118,91 @@ class RawUserAuthMethod extends createBaseClass({
112
118
  this.labelText.setAttribute('title', this.label);
113
119
  }
114
120
 
115
- onButtonLabelChange() {
116
- let textSpanEle = this.button.querySelector('span');
121
+ updateButtonLabel(btnRef, label) {
122
+ let textSpanEle = btnRef.querySelector('span');
117
123
 
118
- if (this.buttonLabel) {
124
+ if (label) {
119
125
  if (!textSpanEle) {
120
126
  textSpanEle = document.createElement('span');
121
- this.button.appendChild(textSpanEle);
127
+ btnRef.appendChild(textSpanEle);
122
128
  }
123
- textSpanEle.innerText = this.buttonLabel;
129
+ textSpanEle.innerText = label;
124
130
  } else if (textSpanEle) {
125
- this.button.removeChild(textSpanEle);
131
+ btnRef.removeChild(textSpanEle);
126
132
  }
127
133
  }
128
134
 
129
135
  onFulfilledChange() {
130
- this.button.classList.toggle('hidden', this.isFulfilled);
131
- this.fulfilledIndicator.classList.toggle('hidden', !this.isFulfilled);
136
+ if (this.isFulfilled) {
137
+ this.unfulfilledButton.classList.add('hidden');
138
+ this.handleFulfilled();
139
+ } else {
140
+ this.fulfilledButton.classList.add('hidden');
141
+ this.handleUnfulfilled();
142
+ }
143
+ }
144
+
145
+ handleFulfilled() {
146
+ this.fulfilledButton.classList.toggle('hidden', !this.isFulfilledEditable);
147
+ this.statusIndicator.classList.toggle('hidden', this.isFulfilledEditable);
148
+ }
149
+
150
+ handleUnfulfilled() {
151
+ this.unfulfilledButton.classList.toggle('hidden', !this.isUnfulfilledEditable);
152
+ this.statusIndicator.classList.toggle('hidden', this.isUnfulfilledEditable);
132
153
  }
133
154
 
134
155
  get label() {
135
156
  return this.getAttribute('label') || '';
136
157
  }
137
158
 
138
- get buttonLabel() {
159
+ get unfulfilledButtonLabel() {
139
160
  return this.getAttribute('button-label') || '';
140
161
  }
141
162
 
163
+ get fulfilledButtonLabel() {
164
+ return this.getAttribute('fulfilled-button-label') || '';
165
+ }
166
+
142
167
  get isFulfilled() {
143
168
  return this.getAttribute('fulfilled') === 'true';
144
169
  }
145
170
 
171
+ get isFulfilledEditable() {
172
+ return this.getAttribute('fulfilled-editable') === 'true';
173
+ }
174
+
175
+ get isUnfulfilledEditable() {
176
+ // this is to keep backward compatibility with previous versions
177
+ return this.getAttribute('unfulfilled-editable') !== 'false';
178
+ }
179
+
146
180
  init() {
147
181
  this.onLabelChange();
148
- this.onButtonLabelChange();
182
+ this.updateButtonLabel(this.fulfilledButton, this.fulfilledButtonLabel);
183
+ this.updateButtonLabel(this.unfulfilledButton, this.unfulfilledButtonLabel);
149
184
  this.onFulfilledChange();
150
185
 
151
- this.button.addEventListener('click', () =>
186
+ this.unfulfilledButton.addEventListener('click', () =>
152
187
  this.dispatchEvent(new CustomEvent('button-clicked', { bubbles: true, composed: true }))
153
188
  );
189
+
190
+ this.fulfilledButton.addEventListener('click', () => {
191
+ this.dispatchEvent(
192
+ new CustomEvent('fulfilled-button-clicked', { bubbles: true, composed: true })
193
+ );
194
+ });
154
195
  }
155
196
 
156
197
  static get observedAttributes() {
157
- return ['label', 'fulfilled'].concat(super.observedAttributes);
198
+ return [
199
+ 'label',
200
+ 'fulfilled',
201
+ 'button-label',
202
+ 'fulfilled-button-label',
203
+ 'fulfilled-editable',
204
+ 'unfulfilled-editable',
205
+ ].concat(super.observedAttributes);
158
206
  }
159
207
 
160
208
  attributeChangedCallback(name, oldValue, newValue) {
@@ -168,7 +216,13 @@ class RawUserAuthMethod extends createBaseClass({
168
216
  } else if (name === 'fulfilled') {
169
217
  this.onFulfilledChange();
170
218
  } else if (name === 'button-label') {
171
- this.onButtonLabelChange();
219
+ this.updateButtonLabel(this.unfulfilledButton, this.unfulfilledButtonLabel);
220
+ } else if (name === 'fulfilled-button-label') {
221
+ this.updateButtonLabel(this.fulfilledButton, this.fulfilledButtonLabel);
222
+ } else if (name === 'fulfilled-editable' && this.isFulfilled) {
223
+ this.handleFulfilled();
224
+ } else if (name === 'unfulfilled-editable' && !this.isFulfilled) {
225
+ this.handleUnfulfilled();
172
226
  }
173
227
  }
174
228
  }