@descope/web-components-ui 1.0.407 → 1.0.409
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 +145 -52
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +147 -53
- 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 +5 -0
- 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/index.esm.js
CHANGED
@@ -640,6 +640,8 @@ const booleanAttributesList = [
|
|
640
640
|
'opening',
|
641
641
|
'closing',
|
642
642
|
'has-no-options',
|
643
|
+
'loading',
|
644
|
+
'allow-custom-value',
|
643
645
|
];
|
644
646
|
|
645
647
|
const isBooleanAttribute = (attr) => {
|
@@ -2774,6 +2776,23 @@ const ComboBoxMixin = (superclass) =>
|
|
2774
2776
|
this.renderItems();
|
2775
2777
|
}
|
2776
2778
|
|
2779
|
+
set renderer(fn) {
|
2780
|
+
// fn takes (root, comboBox, model) as arguments
|
2781
|
+
this.baseElement.renderer = fn;
|
2782
|
+
}
|
2783
|
+
|
2784
|
+
get loading() {
|
2785
|
+
return this.getAttribute('loading') === 'true';
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
set loading(val) {
|
2789
|
+
if (val) {
|
2790
|
+
this.setAttribute('loading', 'true');
|
2791
|
+
} else {
|
2792
|
+
this.removeAttribute('loading');
|
2793
|
+
}
|
2794
|
+
}
|
2795
|
+
|
2777
2796
|
get data() {
|
2778
2797
|
if (this.#data) return this.#data;
|
2779
2798
|
|
@@ -2817,14 +2836,20 @@ const ComboBoxMixin = (superclass) =>
|
|
2817
2836
|
}
|
2818
2837
|
|
2819
2838
|
renderItems() {
|
2820
|
-
|
2821
|
-
|
2839
|
+
if (this.#data || this.getAttribute('data')) {
|
2840
|
+
const template = this.getItemsTemplate();
|
2841
|
+
this.innerHTML = template;
|
2842
|
+
}
|
2822
2843
|
}
|
2823
2844
|
|
2824
2845
|
handleSelectedItem() {
|
2825
|
-
const
|
2846
|
+
const { selectedItem } = this.baseElement;
|
2847
|
+
const currentSelected = selectedItem?.['data-id'];
|
2826
2848
|
|
2827
|
-
|
2849
|
+
// If the selected item is still a child, there's no need to update the value
|
2850
|
+
if (selectedItem && Array.from(this.children).includes(selectedItem)) {
|
2851
|
+
return;
|
2852
|
+
}
|
2828
2853
|
|
2829
2854
|
// if previously selected item ID exists in current children, set it as selected
|
2830
2855
|
if (currentSelected) {
|
@@ -2857,7 +2882,7 @@ const ComboBoxMixin = (superclass) =>
|
|
2857
2882
|
value: {
|
2858
2883
|
...valueDescriptor,
|
2859
2884
|
set(val) {
|
2860
|
-
if (!comboBox.baseElement.items?.length) {
|
2885
|
+
if (!comboBox.baseElement.items?.length && !comboBox.allowCustomValue) {
|
2861
2886
|
return;
|
2862
2887
|
}
|
2863
2888
|
|
@@ -2877,39 +2902,27 @@ const ComboBoxMixin = (superclass) =>
|
|
2877
2902
|
// in order to avoid it, we are passing the children of this component
|
2878
2903
|
// to the items & renderer props, so it will be used as the combo box items
|
2879
2904
|
#onChildrenChange() {
|
2880
|
-
const baseElement = this.shadowRoot.querySelector(this.baseSelector);
|
2881
2905
|
const items = Array.from(this.children);
|
2882
2906
|
|
2883
2907
|
// we want the data-name attribute to be accessible as an object attribute
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
writable: true,
|
2890
|
-
});
|
2891
|
-
Object.defineProperty(node, 'data-id', {
|
2892
|
-
value: node.getAttribute('data-id'),
|
2893
|
-
configurable: true,
|
2894
|
-
writable: true,
|
2895
|
-
});
|
2908
|
+
items.forEach((node) => {
|
2909
|
+
Object.defineProperty(node, 'data-name', {
|
2910
|
+
value: node.getAttribute('data-name'),
|
2911
|
+
configurable: true,
|
2912
|
+
writable: true,
|
2896
2913
|
});
|
2914
|
+
Object.defineProperty(node, 'data-id', {
|
2915
|
+
value: node.getAttribute('data-id'),
|
2916
|
+
configurable: true,
|
2917
|
+
writable: true,
|
2918
|
+
});
|
2919
|
+
});
|
2897
2920
|
|
2898
|
-
|
2899
|
-
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
}, 0);
|
2904
|
-
}
|
2905
|
-
|
2906
|
-
// use vaadin combobox custom renderer to render options as HTML
|
2907
|
-
// and not via default renderer, which renders only the data-name's value
|
2908
|
-
// in its own HTML template
|
2909
|
-
baseElement.renderer = (root, combo, model) => {
|
2910
|
-
// eslint-disable-next-line no-param-reassign
|
2911
|
-
root.innerHTML = model.item.outerHTML;
|
2912
|
-
};
|
2921
|
+
this.baseElement.items = items;
|
2922
|
+
setTimeout(() => {
|
2923
|
+
// set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
|
2924
|
+
this.handleSelectedItem();
|
2925
|
+
}, 0);
|
2913
2926
|
}
|
2914
2927
|
|
2915
2928
|
// the default vaadin behavior is to attach the overlay to the body when opened
|
@@ -2924,6 +2937,16 @@ const ComboBoxMixin = (superclass) =>
|
|
2924
2937
|
overlay._enterModalState = () => {};
|
2925
2938
|
}
|
2926
2939
|
|
2940
|
+
#overrideRenderer() {
|
2941
|
+
// use vaadin combobox custom renderer to render options as HTML
|
2942
|
+
// and not via default renderer, which renders only the data-name's value
|
2943
|
+
// in its own HTML template
|
2944
|
+
this.baseElement.renderer = (root, combo, model) => {
|
2945
|
+
// eslint-disable-next-line no-param-reassign
|
2946
|
+
root.innerHTML = model.item.outerHTML;
|
2947
|
+
};
|
2948
|
+
}
|
2949
|
+
|
2927
2950
|
init() {
|
2928
2951
|
super.init?.();
|
2929
2952
|
|
@@ -2938,13 +2961,11 @@ const ComboBoxMixin = (superclass) =>
|
|
2938
2961
|
};
|
2939
2962
|
|
2940
2963
|
this.setComboBoxDescriptor();
|
2941
|
-
|
2942
2964
|
this.#overrideOverlaySettings();
|
2965
|
+
this.#overrideRenderer();
|
2943
2966
|
|
2944
|
-
|
2945
|
-
|
2967
|
+
// Set up observers - order matters here since renderItems can clear innerHTML
|
2946
2968
|
observeAttributes(this, this.renderItems.bind(this), { includeAttrs: ['data'] });
|
2947
|
-
|
2948
2969
|
observeChildren(this, this.#onChildrenChange.bind(this));
|
2949
2970
|
|
2950
2971
|
this.setDefaultValue();
|
@@ -2977,16 +2998,38 @@ const ComboBoxMixin = (superclass) =>
|
|
2977
2998
|
}
|
2978
2999
|
|
2979
3000
|
setDefaultValue() {
|
2980
|
-
|
3001
|
+
if (this.defaultValue) {
|
3002
|
+
this.value = this.defaultValue;
|
3003
|
+
}
|
2981
3004
|
}
|
2982
3005
|
|
2983
|
-
|
2984
|
-
|
2985
|
-
|
3006
|
+
#getChildToSelect(val) {
|
3007
|
+
return this.baseElement.items?.find((item) => item['data-id'] === val);
|
3008
|
+
}
|
2986
3009
|
|
2987
|
-
|
2988
|
-
|
2989
|
-
|
3010
|
+
#preventSelectedItemChangeEventIfNeeded(val, selectedChild) {
|
3011
|
+
// If the actual value didn't change, but the selected item did (the element changed),
|
3012
|
+
// we want to stop the event propagation since it's not a real change
|
3013
|
+
const shouldPreventItemChangeEvent =
|
3014
|
+
val === this.value && selectedChild !== this.baseElement.selectedItem;
|
3015
|
+
if (shouldPreventItemChangeEvent) {
|
3016
|
+
this.baseElement.addEventListener(
|
3017
|
+
'selected-item-changed',
|
3018
|
+
(e) => {
|
3019
|
+
e.stopImmediatePropagation();
|
3020
|
+
},
|
3021
|
+
{ once: true, capture: true }
|
3022
|
+
);
|
3023
|
+
}
|
3024
|
+
}
|
3025
|
+
|
3026
|
+
set value(val) {
|
3027
|
+
const selectedChild = this.#getChildToSelect(val);
|
3028
|
+
this.#preventSelectedItemChangeEventIfNeeded(val, selectedChild);
|
3029
|
+
if (val && selectedChild) {
|
3030
|
+
this.baseElement.selectedItem = selectedChild;
|
3031
|
+
} else if (!selectedChild && this.allowCustomValue) {
|
3032
|
+
this.baseElement.value = val;
|
2990
3033
|
} else {
|
2991
3034
|
this.baseElement.selectedItem = undefined;
|
2992
3035
|
}
|
@@ -3116,7 +3159,10 @@ const ComboBoxClass = compose(
|
|
3116
3159
|
name: 'overlay',
|
3117
3160
|
selector: '',
|
3118
3161
|
mappings: {
|
3119
|
-
backgroundColor:
|
3162
|
+
backgroundColor: [
|
3163
|
+
{ selector: 'vaadin-combo-box-scroller' },
|
3164
|
+
{ selector: 'vaadin-combo-box-overlay::part(overlay)' },
|
3165
|
+
],
|
3120
3166
|
minHeight: { selector: 'vaadin-combo-box-overlay' },
|
3121
3167
|
margin: { selector: 'vaadin-combo-box-overlay' },
|
3122
3168
|
cursor: { selector: 'vaadin-combo-box-item' },
|
@@ -3129,6 +3175,24 @@ const ComboBoxClass = compose(
|
|
3129
3175
|
property: 'padding-inline-start',
|
3130
3176
|
},
|
3131
3177
|
itemPaddingInlineEnd: { selector: 'vaadin-combo-box-item', property: 'padding-inline-end' },
|
3178
|
+
|
3179
|
+
loaderTop: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'top' },
|
3180
|
+
loaderLeft: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'left' },
|
3181
|
+
loaderRight: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'right' },
|
3182
|
+
loaderMargin: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'margin' },
|
3183
|
+
loaderWidth: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'width' },
|
3184
|
+
loaderHeight: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'height' },
|
3185
|
+
loaderBorder: { selector: 'vaadin-combo-box-overlay::part(loader)', property: 'border' },
|
3186
|
+
loaderBorderColor: {
|
3187
|
+
selector: 'vaadin-combo-box-overlay::part(loader)',
|
3188
|
+
property: 'border-color',
|
3189
|
+
},
|
3190
|
+
loaderBorderRadius: {
|
3191
|
+
selector: 'vaadin-combo-box-overlay::part(loader)',
|
3192
|
+
property: 'border-radius',
|
3193
|
+
},
|
3194
|
+
contentHeight: { selector: 'vaadin-combo-box-overlay::part(content)', property: 'height' },
|
3195
|
+
contentOpacity: { selector: 'vaadin-combo-box-overlay::part(content)', property: 'opacity' },
|
3132
3196
|
},
|
3133
3197
|
forward: {
|
3134
3198
|
include: false,
|
@@ -3176,6 +3240,10 @@ const ComboBoxClass = compose(
|
|
3176
3240
|
align-self: center;
|
3177
3241
|
}
|
3178
3242
|
|
3243
|
+
vaadin-combo-box[hide-toggle-button="true"]::part(toggle-button) {
|
3244
|
+
display: none;
|
3245
|
+
}
|
3246
|
+
|
3179
3247
|
vaadin-combo-box[label-type="floating"]:not([focused])[readonly] > input:placeholder-shown {
|
3180
3248
|
opacity: 0;
|
3181
3249
|
}
|
@@ -3190,7 +3258,7 @@ const ComboBoxClass = compose(
|
|
3190
3258
|
// with the same name. Including it will cause Vaadin to calculate NaN size,
|
3191
3259
|
// and reset items to an empty array, and opening the list box with no items
|
3192
3260
|
// to display.
|
3193
|
-
excludeAttrsSync: ['tabindex', 'size', 'data'],
|
3261
|
+
excludeAttrsSync: ['tabindex', 'size', 'data', 'loading'],
|
3194
3262
|
componentName: componentName$Z,
|
3195
3263
|
includeForwardProps: ['items', 'renderer', 'selectedItem'],
|
3196
3264
|
})
|
@@ -3766,7 +3834,9 @@ class RawCalendar extends BaseInputClass$9 {
|
|
3766
3834
|
this.monthInput.value = month;
|
3767
3835
|
// For the yearInput we update the base element directly to properly trigger the change event
|
3768
3836
|
// since this can be a custom value
|
3769
|
-
|
3837
|
+
setTimeout(() => {
|
3838
|
+
this.yearInput.baseElement.value = year;
|
3839
|
+
});
|
3770
3840
|
}
|
3771
3841
|
}
|
3772
3842
|
|
@@ -3905,11 +3975,10 @@ class RawCalendar extends BaseInputClass$9 {
|
|
3905
3975
|
}
|
3906
3976
|
|
3907
3977
|
onMonthNamesChange() {
|
3908
|
-
|
3909
|
-
|
3910
|
-
|
3911
|
-
|
3912
|
-
child.textContent = month;
|
3978
|
+
setTimeout(() => {
|
3979
|
+
if (this.monthInput) {
|
3980
|
+
this.monthInput.innerHTML = getMonthsOptions(this.monthNames);
|
3981
|
+
}
|
3913
3982
|
});
|
3914
3983
|
}
|
3915
3984
|
|
@@ -8199,7 +8268,8 @@ let PhoneFieldInternal$1 = class PhoneFieldInternal extends BaseInputClass$6 {
|
|
8199
8268
|
}
|
8200
8269
|
|
8201
8270
|
getRestrictedCountries() {
|
8202
|
-
|
8271
|
+
const attr = this.getAttribute('restrict-countries');
|
8272
|
+
return attr ? attr.split(',') : [];
|
8203
8273
|
}
|
8204
8274
|
|
8205
8275
|
getCountryByDialCode(countryDialCode) {
|
@@ -9703,6 +9773,10 @@ class RawRecaptcha extends BaseClass$1 {
|
|
9703
9773
|
return;
|
9704
9774
|
}
|
9705
9775
|
|
9776
|
+
this.toggleRecaptchaEles(enabled);
|
9777
|
+
}
|
9778
|
+
|
9779
|
+
toggleRecaptchaEles(enabled) {
|
9706
9780
|
if (enabled) {
|
9707
9781
|
this.recaptchaEle.style.display = '';
|
9708
9782
|
this.mockRecaptchaEle.style.display = 'none';
|
@@ -9767,6 +9841,7 @@ class RawRecaptcha extends BaseClass$1 {
|
|
9767
9841
|
this.mockRecaptchaEle.style.display = 'none';
|
9768
9842
|
this.badge.classList.add('hidden');
|
9769
9843
|
} else {
|
9844
|
+
this.toggleRecaptchaEles(this.enabled);
|
9770
9845
|
this.badge.classList.remove('hidden');
|
9771
9846
|
}
|
9772
9847
|
}
|
@@ -17268,6 +17343,25 @@ const comboBox = {
|
|
17268
17343
|
// Overlay direct theme:
|
17269
17344
|
[vars$y.overlay.minHeight]: '400px',
|
17270
17345
|
[vars$y.overlay.margin]: '0',
|
17346
|
+
|
17347
|
+
[vars$y.overlay.contentHeight]: '100%',
|
17348
|
+
[vars$y.overlay.contentOpacity]: '1',
|
17349
|
+
_loading: {
|
17350
|
+
[vars$y.overlay.loaderTop]: '50%',
|
17351
|
+
[vars$y.overlay.loaderLeft]: '50%',
|
17352
|
+
[vars$y.overlay.loaderRight]: 'auto',
|
17353
|
+
// Margin has to be negative to center the loader, "transform" can't be used because the animation uses it
|
17354
|
+
// Margin has to be half of the width/height of the loader to center it
|
17355
|
+
[vars$y.overlay.loaderMargin]: '-15px 0 0 -15px',
|
17356
|
+
[vars$y.overlay.loaderWidth]: '30px',
|
17357
|
+
[vars$y.overlay.loaderHeight]: '30px',
|
17358
|
+
[vars$y.overlay.loaderBorder]: '2px solid transparent',
|
17359
|
+
[vars$y.overlay
|
17360
|
+
.loaderBorderColor]: `${globalRefs$m.colors.primary.highlight} ${globalRefs$m.colors.primary.highlight} ${globalRefs$m.colors.primary.main} ${globalRefs$m.colors.primary.main}`,
|
17361
|
+
[vars$y.overlay.loaderBorderRadius]: '50%',
|
17362
|
+
[vars$y.overlay.contentHeight]: '100px',
|
17363
|
+
[vars$y.overlay.contentOpacity]: '0',
|
17364
|
+
},
|
17271
17365
|
};
|
17272
17366
|
|
17273
17367
|
var comboBox$1 = /*#__PURE__*/Object.freeze({
|