edvoyui-component-library-test-flight 0.0.242 → 0.0.243
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/components/telephone/EUITelephone.vue +23 -4
- package/dist/edvoy-ui.cjs.js +14 -14
- package/dist/edvoy-ui.es.js +3136 -3135
- package/dist/edvoy-ui.umd.js +19 -19
- package/package.json +1 -1
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
:class="[getIconClass()]"
|
|
49
49
|
@on-input="onInputChanged"
|
|
50
50
|
@country-changed="onCountryChanged"
|
|
51
|
+
@focus="onFocus"
|
|
51
52
|
@blur="onBlur"
|
|
52
53
|
></vue-tel-input>
|
|
53
54
|
</button>
|
|
@@ -85,7 +86,7 @@ import "vue-tel-input/vue-tel-input.css";
|
|
|
85
86
|
|
|
86
87
|
type TelephoneInputMeta = PhoneMeta & { number: string };
|
|
87
88
|
|
|
88
|
-
const emit = defineEmits(["update:modelValue", "blur", "update:isValid"]);
|
|
89
|
+
const emit = defineEmits(["update:modelValue", "blur", "focus", "update:isValid"]);
|
|
89
90
|
|
|
90
91
|
const props = defineProps({
|
|
91
92
|
modelValue: {
|
|
@@ -170,6 +171,7 @@ const inputValue = computed(() => {
|
|
|
170
171
|
});
|
|
171
172
|
|
|
172
173
|
const mobile = ref(String(props.modelValue ?? ""));
|
|
174
|
+
const isFocused = ref(false);
|
|
173
175
|
const isTouched = ref(false);
|
|
174
176
|
const telephoneIsValid = ref(props.isValid);
|
|
175
177
|
const activeCountry = ref<CountryObject | null>(null);
|
|
@@ -252,10 +254,16 @@ const bindProps = computed<VueTelInputProps>(() => ({
|
|
|
252
254
|
},
|
|
253
255
|
}));
|
|
254
256
|
|
|
257
|
+
const onFocus = () => {
|
|
258
|
+
isFocused.value = true;
|
|
259
|
+
emit("focus");
|
|
260
|
+
};
|
|
261
|
+
|
|
255
262
|
const onInputChanged = (
|
|
256
263
|
_formattedNumber: string,
|
|
257
264
|
phoneObject: TelephoneInputMeta,
|
|
258
265
|
) => {
|
|
266
|
+
isFocused.value = true;
|
|
259
267
|
telephoneIsValid.value = Boolean(phoneObject.valid);
|
|
260
268
|
hasError.value = !telephoneIsValid.value;
|
|
261
269
|
|
|
@@ -267,6 +275,7 @@ const onInputChanged = (
|
|
|
267
275
|
};
|
|
268
276
|
|
|
269
277
|
const onBlur = () => {
|
|
278
|
+
isFocused.value = false;
|
|
270
279
|
isTouched.value = true;
|
|
271
280
|
emit("blur");
|
|
272
281
|
};
|
|
@@ -320,9 +329,19 @@ const internalErrorMessage = computed(() => {
|
|
|
320
329
|
return "Enter a valid phone number";
|
|
321
330
|
});
|
|
322
331
|
|
|
323
|
-
const errorMessage = computed(
|
|
324
|
-
(
|
|
325
|
-
|
|
332
|
+
const errorMessage = computed(() => {
|
|
333
|
+
if (props.readonly || props.disabled) return "";
|
|
334
|
+
|
|
335
|
+
if (isFocused.value && !telephoneIsValid.value) {
|
|
336
|
+
return "";
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if (isTouched.value) {
|
|
340
|
+
return internalErrorMessage.value || externalErrorMessage.value || "";
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return externalErrorMessage.value || "";
|
|
344
|
+
});
|
|
326
345
|
|
|
327
346
|
const getIconClass = () => {
|
|
328
347
|
switch (props.iconType) {
|