@descope/web-components-ui 1.0.406 → 1.0.408
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 +171 -54
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +173 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1053.js +1 -1
- package/dist/umd/{5459.js → 2755.js} +1 -1
- package/dist/umd/4480.js +1 -0
- package/dist/umd/4619.js +1 -1
- package/dist/umd/6726.js +1 -1
- package/dist/umd/7212.js +1 -1
- package/dist/umd/7607.js +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +7 -7
- package/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-hybrid-field-index-js.js +3 -3
- package/dist/umd/descope-recaptcha-index-js.js +1 -1
- package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
- package/dist/umd/index.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/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
- package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
- package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
- package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +8 -8
- package/package.json +1 -1
- package/src/components/descope-combo-box/ComboBoxClass.js +112 -46
- package/src/components/descope-date-field/descope-calendar/CalendarClass.js +8 -6
- package/src/components/descope-recaptcha/RecaptchaClass.js +32 -3
- package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +2 -1
- package/src/mixins/normalizeBooleanAttributesMixin.js +2 -0
- package/src/theme/components/comboBox.js +19 -0
package/dist/cjs/index.cjs.js
CHANGED
@@ -1060,6 +1060,8 @@ const booleanAttributesList = [
|
|
1060
1060
|
'opening',
|
1061
1061
|
'closing',
|
1062
1062
|
'has-no-options',
|
1063
|
+
'loading',
|
1064
|
+
'allow-custom-value',
|
1063
1065
|
];
|
1064
1066
|
|
1065
1067
|
const isBooleanAttribute = (attr) => {
|
@@ -6531,6 +6533,23 @@ const ComboBoxMixin = (superclass) =>
|
|
6531
6533
|
this.renderItems();
|
6532
6534
|
}
|
6533
6535
|
|
6536
|
+
set renderer(fn) {
|
6537
|
+
// fn takes (root, comboBox, model) as arguments
|
6538
|
+
this.baseElement.renderer = fn;
|
6539
|
+
}
|
6540
|
+
|
6541
|
+
get loading() {
|
6542
|
+
return this.getAttribute('loading') === 'true';
|
6543
|
+
}
|
6544
|
+
|
6545
|
+
set loading(val) {
|
6546
|
+
if (val) {
|
6547
|
+
this.setAttribute('loading', 'true');
|
6548
|
+
} else {
|
6549
|
+
this.removeAttribute('loading');
|
6550
|
+
}
|
6551
|
+
}
|
6552
|
+
|
6534
6553
|
get data() {
|
6535
6554
|
if (this.#data) return this.#data;
|
6536
6555
|
|
@@ -6574,14 +6593,20 @@ const ComboBoxMixin = (superclass) =>
|
|
6574
6593
|
}
|
6575
6594
|
|
6576
6595
|
renderItems() {
|
6577
|
-
|
6578
|
-
|
6596
|
+
if (this.#data || this.getAttribute('data')) {
|
6597
|
+
const template = this.getItemsTemplate();
|
6598
|
+
this.innerHTML = template;
|
6599
|
+
}
|
6579
6600
|
}
|
6580
6601
|
|
6581
6602
|
handleSelectedItem() {
|
6582
|
-
const
|
6603
|
+
const { selectedItem } = this.baseElement;
|
6604
|
+
const currentSelected = selectedItem?.['data-id'];
|
6583
6605
|
|
6584
|
-
|
6606
|
+
// If the selected item is still a child, there's no need to update the value
|
6607
|
+
if (selectedItem && Array.from(this.children).includes(selectedItem)) {
|
6608
|
+
return;
|
6609
|
+
}
|
6585
6610
|
|
6586
6611
|
// if previously selected item ID exists in current children, set it as selected
|
6587
6612
|
if (currentSelected) {
|
@@ -6614,7 +6639,7 @@ const ComboBoxMixin = (superclass) =>
|
|
6614
6639
|
value: {
|
6615
6640
|
...valueDescriptor,
|
6616
6641
|
set(val) {
|
6617
|
-
if (!comboBox.baseElement.items?.length) {
|
6642
|
+
if (!comboBox.baseElement.items?.length && !comboBox.allowCustomValue) {
|
6618
6643
|
return;
|
6619
6644
|
}
|
6620
6645
|
|
@@ -6634,39 +6659,27 @@ const ComboBoxMixin = (superclass) =>
|
|
6634
6659
|
// in order to avoid it, we are passing the children of this component
|
6635
6660
|
// to the items & renderer props, so it will be used as the combo box items
|
6636
6661
|
#onChildrenChange() {
|
6637
|
-
const baseElement = this.shadowRoot.querySelector(this.baseSelector);
|
6638
6662
|
const items = Array.from(this.children);
|
6639
6663
|
|
6640
6664
|
// we want the data-name attribute to be accessible as an object attribute
|
6641
|
-
|
6642
|
-
|
6643
|
-
|
6644
|
-
|
6645
|
-
|
6646
|
-
writable: true,
|
6647
|
-
});
|
6648
|
-
Object.defineProperty(node, 'data-id', {
|
6649
|
-
value: node.getAttribute('data-id'),
|
6650
|
-
configurable: true,
|
6651
|
-
writable: true,
|
6652
|
-
});
|
6665
|
+
items.forEach((node) => {
|
6666
|
+
Object.defineProperty(node, 'data-name', {
|
6667
|
+
value: node.getAttribute('data-name'),
|
6668
|
+
configurable: true,
|
6669
|
+
writable: true,
|
6653
6670
|
});
|
6671
|
+
Object.defineProperty(node, 'data-id', {
|
6672
|
+
value: node.getAttribute('data-id'),
|
6673
|
+
configurable: true,
|
6674
|
+
writable: true,
|
6675
|
+
});
|
6676
|
+
});
|
6654
6677
|
|
6655
|
-
|
6656
|
-
|
6657
|
-
|
6658
|
-
|
6659
|
-
|
6660
|
-
}, 0);
|
6661
|
-
}
|
6662
|
-
|
6663
|
-
// use vaadin combobox custom renderer to render options as HTML
|
6664
|
-
// and not via default renderer, which renders only the data-name's value
|
6665
|
-
// in its own HTML template
|
6666
|
-
baseElement.renderer = (root, combo, model) => {
|
6667
|
-
// eslint-disable-next-line no-param-reassign
|
6668
|
-
root.innerHTML = model.item.outerHTML;
|
6669
|
-
};
|
6678
|
+
this.baseElement.items = items;
|
6679
|
+
setTimeout(() => {
|
6680
|
+
// set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
|
6681
|
+
this.handleSelectedItem();
|
6682
|
+
}, 0);
|
6670
6683
|
}
|
6671
6684
|
|
6672
6685
|
// the default vaadin behavior is to attach the overlay to the body when opened
|
@@ -6681,6 +6694,16 @@ const ComboBoxMixin = (superclass) =>
|
|
6681
6694
|
overlay._enterModalState = () => {};
|
6682
6695
|
}
|
6683
6696
|
|
6697
|
+
#overrideRenderer() {
|
6698
|
+
// use vaadin combobox custom renderer to render options as HTML
|
6699
|
+
// and not via default renderer, which renders only the data-name's value
|
6700
|
+
// in its own HTML template
|
6701
|
+
this.baseElement.renderer = (root, combo, model) => {
|
6702
|
+
// eslint-disable-next-line no-param-reassign
|
6703
|
+
root.innerHTML = model.item.outerHTML;
|
6704
|
+
};
|
6705
|
+
}
|
6706
|
+
|
6684
6707
|
init() {
|
6685
6708
|
super.init?.();
|
6686
6709
|
|
@@ -6695,13 +6718,11 @@ const ComboBoxMixin = (superclass) =>
|
|
6695
6718
|
};
|
6696
6719
|
|
6697
6720
|
this.setComboBoxDescriptor();
|
6698
|
-
|
6699
6721
|
this.#overrideOverlaySettings();
|
6722
|
+
this.#overrideRenderer();
|
6700
6723
|
|
6701
|
-
|
6702
|
-
|
6724
|
+
// Set up observers - order matters here since renderItems can clear innerHTML
|
6703
6725
|
observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
|
6704
|
-
|
6705
6726
|
observeChildren(this, this.#onChildrenChange.bind(this));
|
6706
6727
|
|
6707
6728
|
this.setDefaultValue();
|
@@ -6734,16 +6755,38 @@ const ComboBoxMixin = (superclass) =>
|
|
6734
6755
|
}
|
6735
6756
|
|
6736
6757
|
setDefaultValue() {
|
6737
|
-
|
6758
|
+
if (this.defaultValue) {
|
6759
|
+
this.value = this.defaultValue;
|
6760
|
+
}
|
6738
6761
|
}
|
6739
6762
|
|
6740
|
-
|
6741
|
-
|
6742
|
-
|
6763
|
+
#getChildToSelect(val) {
|
6764
|
+
return this.baseElement.items?.find((item) => item['data-id'] === val);
|
6765
|
+
}
|
6743
6766
|
|
6744
|
-
|
6745
|
-
|
6746
|
-
|
6767
|
+
#preventSelectedItemChangeEventIfNeeded(val, selectedChild) {
|
6768
|
+
// If the actual value didn't change, but the selected item did (the element changed),
|
6769
|
+
// we want to stop the event propagation since it's not a real change
|
6770
|
+
const shouldPreventItemChangeEvent =
|
6771
|
+
val === this.value && selectedChild !== this.baseElement.selectedItem;
|
6772
|
+
if (shouldPreventItemChangeEvent) {
|
6773
|
+
this.baseElement.addEventListener(
|
6774
|
+
'selected-item-changed',
|
6775
|
+
(e) => {
|
6776
|
+
e.stopImmediatePropagation();
|
6777
|
+
},
|
6778
|
+
{ once: true, capture: true }
|
6779
|
+
);
|
6780
|
+
}
|
6781
|
+
}
|
6782
|
+
|
6783
|
+
set value(val) {
|
6784
|
+
const selectedChild = this.#getChildToSelect(val);
|
6785
|
+
this.#preventSelectedItemChangeEventIfNeeded(val, selectedChild);
|
6786
|
+
if (val && selectedChild) {
|
6787
|
+
this.baseElement.selectedItem = selectedChild;
|
6788
|
+
} else if (!selectedChild && this.allowCustomValue) {
|
6789
|
+
this.baseElement.value = val;
|
6747
6790
|
} else {
|
6748
6791
|
this.baseElement.selectedItem = undefined;
|
6749
6792
|
}
|
@@ -6873,7 +6916,10 @@ const ComboBoxClass = compose(
|
|
6873
6916
|
name: 'overlay',
|
6874
6917
|
selector: '',
|
6875
6918
|
mappings: {
|
6876
|
-
backgroundColor:
|
6919
|
+
backgroundColor: [
|
6920
|
+
{ selector: 'vaadin-combo-box-scroller' },
|
6921
|
+
{ selector: 'vaadin-combo-box-overlay::part(overlay)' },
|
6922
|
+
],
|
6877
6923
|
minHeight: { selector: 'vaadin-combo-box-overlay' },
|
6878
6924
|
margin: { selector: 'vaadin-combo-box-overlay' },
|
6879
6925
|
cursor: { selector: 'vaadin-combo-box-item' },
|
@@ -6886,6 +6932,24 @@ const ComboBoxClass = compose(
|
|
6886
6932
|
property: 'padding-inline-start',
|
6887
6933
|
},
|
6888
6934
|
itemPaddingInlineEnd: { selector: 'vaadin-combo-box-item', property: 'padding-inline-end' },
|
6935
|
+
|
6936
|
+
loaderTop: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'top' },
|
6937
|
+
loaderLeft: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'left' },
|
6938
|
+
loaderRight: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'right' },
|
6939
|
+
loaderMargin: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'margin' },
|
6940
|
+
loaderWidth: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'width' },
|
6941
|
+
loaderHeight: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'height' },
|
6942
|
+
loaderBorder: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'border' },
|
6943
|
+
loaderBorderColor: {
|
6944
|
+
selector: 'vaadin-combo-box-overlay::part(loader)',
|
6945
|
+
property: 'border-color',
|
6946
|
+
},
|
6947
|
+
loaderBorderRadius: {
|
6948
|
+
selector: 'vaadin-combo-box-overlay::part(loader)',
|
6949
|
+
property: 'border-radius',
|
6950
|
+
},
|
6951
|
+
contentHeight: { selector: 'vaadin-combo-box-overlay::part(content)', property: 'height' },
|
6952
|
+
contentOpacity: { selector: 'vaadin-combo-box-overlay::part(content)', property: 'opacity' },
|
6889
6953
|
},
|
6890
6954
|
forward: {
|
6891
6955
|
include: false,
|
@@ -6933,6 +6997,10 @@ const ComboBoxClass = compose(
|
|
6933
6997
|
align-self: center;
|
6934
6998
|
}
|
6935
6999
|
|
7000
|
+
vaadin-combo-box[hide-toggle-button="true"]::part(toggle-button) {
|
7001
|
+
display: none;
|
7002
|
+
}
|
7003
|
+
|
6936
7004
|
vaadin-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {
|
6937
7005
|
opacity: 0;
|
6938
7006
|
}
|
@@ -6947,7 +7015,7 @@ const ComboBoxClass = compose(
|
|
6947
7015
|
// with the same name. Including it will cause Vaadin to calculate NaN size,
|
6948
7016
|
// and reset items to an empty array, and opening the list box with no items
|
6949
7017
|
// to display.
|
6950
|
-
excludeAttrsSync: ['tabindex', 'size', 'data'],
|
7018
|
+
excludeAttrsSync: ['tabindex', 'size', 'data', 'loading'],
|
6951
7019
|
componentName: componentName$F,
|
6952
7020
|
includeForwardProps: ['items', 'renderer', 'selectedItem'],
|
6953
7021
|
})
|
@@ -7011,6 +7079,25 @@ const comboBox = {
|
|
7011
7079
|
// Overlay direct theme:
|
7012
7080
|
[vars$y.overlay.minHeight]: '400px',
|
7013
7081
|
[vars$y.overlay.margin]: '0',
|
7082
|
+
|
7083
|
+
[vars$y.overlay.contentHeight]: '100%',
|
7084
|
+
[vars$y.overlay.contentOpacity]: '1',
|
7085
|
+
_loading: {
|
7086
|
+
[vars$y.overlay.loaderTop]: '50%',
|
7087
|
+
[vars$y.overlay.loaderLeft]: '50%',
|
7088
|
+
[vars$y.overlay.loaderRight]: 'auto',
|
7089
|
+
// Margin has to be negative to center the loader, "transform" can't be used because the animation uses it
|
7090
|
+
// Margin has to be half of the width/height of the loader to center it
|
7091
|
+
[vars$y.overlay.loaderMargin]: '-15px 0 0 -15px',
|
7092
|
+
[vars$y.overlay.loaderWidth]: '30px',
|
7093
|
+
[vars$y.overlay.loaderHeight]: '30px',
|
7094
|
+
[vars$y.overlay.loaderBorder]: '2px solid transparent',
|
7095
|
+
[vars$y.overlay
|
7096
|
+
.loaderBorderColor]: `${globalRefs$m.colors.primary.highlight} ${globalRefs$m.colors.primary.highlight} ${globalRefs$m.colors.primary.main} ${globalRefs$m.colors.primary.main}`,
|
7097
|
+
[vars$y.overlay.loaderBorderRadius]: '50%',
|
7098
|
+
[vars$y.overlay.contentHeight]: '100px',
|
7099
|
+
[vars$y.overlay.contentOpacity]: '0',
|
7100
|
+
},
|
7014
7101
|
};
|
7015
7102
|
|
7016
7103
|
var comboBox$1 = /*#__PURE__*/Object.freeze({
|
@@ -14262,7 +14349,9 @@ class RawCalendar extends BaseInputClass$1 {
|
|
14262
14349
|
this.monthInput.value = month;
|
14263
14350
|
// For the yearInput we update the base element directly to properly trigger the change event
|
14264
14351
|
// since this can be a custom value
|
14265
|
-
|
14352
|
+
setTimeout(() => {
|
14353
|
+
this.yearInput.baseElement.value = year;
|
14354
|
+
});
|
14266
14355
|
}
|
14267
14356
|
}
|
14268
14357
|
|
@@ -14401,11 +14490,10 @@ class RawCalendar extends BaseInputClass$1 {
|
|
14401
14490
|
}
|
14402
14491
|
|
14403
14492
|
onMonthNamesChange() {
|
14404
|
-
|
14405
|
-
|
14406
|
-
|
14407
|
-
|
14408
|
-
child.textContent = month;
|
14493
|
+
setTimeout(() => {
|
14494
|
+
if (this.monthInput) {
|
14495
|
+
this.monthInput.innerHTML = getMonthsOptions(this.monthNames);
|
14496
|
+
}
|
14409
14497
|
});
|
14410
14498
|
}
|
14411
14499
|
|
@@ -17311,6 +17399,11 @@ class RawRecaptcha extends BaseClass {
|
|
17311
17399
|
}
|
17312
17400
|
|
17313
17401
|
renderRecaptcha(enabled) {
|
17402
|
+
if (this.children.length) {
|
17403
|
+
this.updatePreview();
|
17404
|
+
return;
|
17405
|
+
}
|
17406
|
+
|
17314
17407
|
if (enabled) {
|
17315
17408
|
this.recaptchaEle.style.display = '';
|
17316
17409
|
this.mockRecaptchaEle.style.display = 'none';
|
@@ -17328,7 +17421,7 @@ class RawRecaptcha extends BaseClass {
|
|
17328
17421
|
:host {
|
17329
17422
|
display: inline-flex;
|
17330
17423
|
}
|
17331
|
-
:host > div {
|
17424
|
+
:host > div:not(.hidden) {
|
17332
17425
|
display: flex;
|
17333
17426
|
}
|
17334
17427
|
:host #recaptcha .grecaptcha-badge {
|
@@ -17343,16 +17436,40 @@ class RawRecaptcha extends BaseClass {
|
|
17343
17436
|
}
|
17344
17437
|
:host img {
|
17345
17438
|
width: 256px;
|
17439
|
+
}
|
17440
|
+
:host([full-width="true"]) {
|
17441
|
+
width: 100%;
|
17442
|
+
}
|
17443
|
+
.hidden {
|
17444
|
+
display: none;
|
17346
17445
|
}
|
17347
17446
|
</style>
|
17348
|
-
<div>
|
17447
|
+
<div class="badge">
|
17349
17448
|
<span id="recaptcha"></span>
|
17350
17449
|
<img src="https://imgs.descope.com/connectors/templates/recaptcha/recaptcha-big.png" alt="recaptcha"/>
|
17351
17450
|
</div>
|
17451
|
+
<slot></slot>
|
17352
17452
|
`;
|
17353
17453
|
|
17354
17454
|
this.recaptchaEle = this.baseElement.querySelector('#recaptcha');
|
17355
17455
|
this.mockRecaptchaEle = this.baseElement.querySelector('img');
|
17456
|
+
this.badge = this.shadowRoot.querySelector('.badge');
|
17457
|
+
}
|
17458
|
+
|
17459
|
+
init() {
|
17460
|
+
super.init?.();
|
17461
|
+
|
17462
|
+
observeChildren(this, this.updatePreview.bind(this));
|
17463
|
+
}
|
17464
|
+
|
17465
|
+
updatePreview() {
|
17466
|
+
if (this.children.length) {
|
17467
|
+
this.recaptchaEle.style.display = 'none';
|
17468
|
+
this.mockRecaptchaEle.style.display = 'none';
|
17469
|
+
this.badge.classList.add('hidden');
|
17470
|
+
} else {
|
17471
|
+
this.badge.classList.remove('hidden');
|
17472
|
+
}
|
17356
17473
|
}
|
17357
17474
|
|
17358
17475
|
get enterprise() {
|