@descope/web-components-ui 1.0.159 → 1.0.160
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 +43 -36
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +44 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.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-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(
|
|
@@ -4582,7 +4589,7 @@ class PhoneFieldInternal extends BaseInputClass$2 {
|
|
|
4582
4589
|
const hasPhone = this.phoneNumberInput.value;
|
|
4583
4590
|
const emptyValue = !hasCode || !hasPhone;
|
|
4584
4591
|
const hasMinPhoneLength =
|
|
4585
|
-
this.phoneNumberInput.value
|
|
4592
|
+
this.phoneNumberInput.value?.length && this.phoneNumberInput.value.length < this.minLength;
|
|
4586
4593
|
|
|
4587
4594
|
if (this.isRequired && emptyValue) {
|
|
4588
4595
|
return { valueMissing: true };
|