@descope/web-components-ui 1.0.159 → 1.0.161
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 +47 -41
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +48 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -1
- package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-combo-box/ComboBoxClass.js +4 -5
- package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +1 -1
- package/src/mixins/proxyInputMixin.js +46 -39
package/dist/index.esm.js
CHANGED
@@ -919,12 +919,14 @@ const proxyInputMixin = (superclass) =>
|
|
919
919
|
}
|
920
920
|
|
921
921
|
get inputElement() {
|
922
|
+
if (this.#inputElement) return this.#inputElement
|
923
|
+
|
922
924
|
this.warnIfInputElementIsMissing();
|
923
925
|
|
924
926
|
const inputSlot = this.baseElement.shadowRoot?.querySelector('slot[name="input"]');
|
925
927
|
const textAreaSlot = this.baseElement.shadowRoot?.querySelector('slot[name="textarea"]');
|
926
928
|
|
927
|
-
this.#inputElement
|
929
|
+
this.#inputElement = getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
|
928
930
|
|
929
931
|
return this.#inputElement;
|
930
932
|
}
|
@@ -951,49 +953,54 @@ const proxyInputMixin = (superclass) =>
|
|
951
953
|
init() {
|
952
954
|
super.init?.();
|
953
955
|
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
956
|
+
// on some cases the base element is not ready so the inputElement is empty
|
957
|
+
// we are deferring this section to make sure the base element is ready
|
958
|
+
setTimeout(() => {
|
959
|
+
this.inputElement.addEventListener('input', (e) => {
|
960
|
+
if (!this.inputElement.checkValidity()) {
|
961
|
+
this.inputElement.setCustomValidity('');
|
962
|
+
// after updating the input validity we want to trigger set validity on the wrapping element
|
963
|
+
// so we will get the updated validity
|
964
|
+
this.setCustomValidity('');
|
965
|
+
|
966
|
+
// Vaadin is getting the input event before us,
|
967
|
+
// so in order to make sure they use the updated validity
|
968
|
+
// we calling their fn after updating the input validity
|
969
|
+
this.baseElement.__onInput(e);
|
970
|
+
|
971
|
+
this.#handleErrorMessage();
|
972
|
+
}
|
973
|
+
});
|
965
974
|
|
966
|
-
|
967
|
-
|
968
|
-
|
975
|
+
this.baseElement.addEventListener('change', () => {
|
976
|
+
this.#dispatchChange();
|
977
|
+
});
|
969
978
|
|
970
|
-
|
971
|
-
|
972
|
-
|
979
|
+
this.#inputElement.addEventListener('blur', () => {
|
980
|
+
if (!this.checkValidity()) {
|
981
|
+
this.setAttribute('invalid', 'true');
|
982
|
+
this.#handleErrorMessage();
|
983
|
+
}
|
984
|
+
});
|
973
985
|
|
974
|
-
|
975
|
-
|
976
|
-
|
986
|
+
this.addEventListener('invalid', () => {
|
987
|
+
if (!this.checkValidity()) {
|
988
|
+
this.setAttribute('invalid', 'true');
|
989
|
+
}
|
977
990
|
this.#handleErrorMessage();
|
978
|
-
}
|
979
|
-
});
|
980
|
-
|
981
|
-
this.addEventListener('invalid', () => {
|
982
|
-
if (!this.checkValidity()) {
|
983
|
-
this.setAttribute('invalid', 'true');
|
984
|
-
}
|
985
|
-
this.#handleErrorMessage();
|
986
|
-
});
|
991
|
+
});
|
987
992
|
|
988
|
-
|
993
|
+
this.handleInternalInputErrorMessage();
|
989
994
|
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
995
|
+
// sync properties
|
996
|
+
propertyObserver(this, this.inputElement, 'value');
|
997
|
+
propertyObserver(this, this.inputElement, 'selectionStart');
|
998
|
+
this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
|
994
999
|
|
995
|
-
|
1000
|
+
forwardAttrs(this, this.inputElement, { includeAttrs: ['inputmode'] });
|
1001
|
+
});
|
996
1002
|
}
|
1003
|
+
|
997
1004
|
};
|
998
1005
|
|
999
1006
|
const composedProxyInputMixin = compose(
|
@@ -3120,18 +3127,17 @@ const ComboBoxMixin = (superclass) =>
|
|
3120
3127
|
// so we override it to open inside the shadow DOM
|
3121
3128
|
#overrideOverlaySettings() {
|
3122
3129
|
const overlay = this.baseElement.shadowRoot.querySelector('vaadin-combo-box-overlay');
|
3123
|
-
|
3124
3130
|
overlay._attachOverlay = () => {
|
3125
|
-
|
3131
|
+
overlay.bringToFront();
|
3126
3132
|
};
|
3127
|
-
overlay._detachOverlay = () => {};
|
3128
|
-
overlay._enterModalState = () => {};
|
3133
|
+
overlay._detachOverlay = () => { };
|
3134
|
+
overlay._enterModalState = () => { };
|
3129
3135
|
}
|
3130
3136
|
|
3131
3137
|
init() {
|
3132
3138
|
super.init?.();
|
3133
3139
|
|
3134
|
-
this.#overrideOverlaySettings
|
3140
|
+
this.#overrideOverlaySettings();
|
3135
3141
|
observeChildren(this, this.#onChildrenChange.bind(this));
|
3136
3142
|
}
|
3137
3143
|
};
|
@@ -4582,7 +4588,7 @@ class PhoneFieldInternal extends BaseInputClass$2 {
|
|
4582
4588
|
const hasPhone = this.phoneNumberInput.value;
|
4583
4589
|
const emptyValue = !hasCode || !hasPhone;
|
4584
4590
|
const hasMinPhoneLength =
|
4585
|
-
this.phoneNumberInput.value
|
4591
|
+
this.phoneNumberInput.value?.length && this.phoneNumberInput.value.length < this.minLength;
|
4586
4592
|
|
4587
4593
|
if (this.isRequired && emptyValue) {
|
4588
4594
|
return { valueMissing: true };
|