diff --git a/.playground/pages/composant/inputText.vue b/.playground/pages/composant/inputText.vue index 56f1032..0f501a6 100644 --- a/.playground/pages/composant/inputText.vue +++ b/.playground/pages/composant/inputText.vue @@ -28,9 +28,9 @@

Désactivé

@@ -44,26 +44,14 @@
-

Hint,erreur et succes

+

Hint + icône

-
- -
-
- -

Erreur + icône

@@ -76,26 +64,14 @@ />
-

Succes + icône

+

Succès + icône

- -
-

Hint + icône

- -
-

Readonly + icône

+
+

Code dynamique

+ +
+
+

Hint,erreur et succès

+ +
+ +
+
+ +
+
@@ -131,8 +141,21 @@ const simpleValue = ref('') const nameValue = ref('') const searchValue = ref('') -const emailValue = ref('') +const codeValue = ref('') const cityValue = ref('') +const dynamicCodeValue = ref('') + +const codeRegex = /^[A-Z0-9]{6,10}$/ +const normalizedDynamicCode = computed(() => dynamicCodeValue.value.toUpperCase()) +const isDynamicCodeValid = computed(() => codeRegex.test(normalizedDynamicCode.value)) +const dynamicCodeError = computed(() => { + if (!dynamicCodeValue.value) return '' + return isDynamicCodeValid.value ? '' : 'Code invalide (6 à 10 caractères alphanumériques)' +}) +const dynamicCodeSuccess = computed(() => { + if (!dynamicCodeValue.value) return '' + return isDynamicCodeValid.value ? 'Code valide' : '' +}) const maskOptions = { mask: '@@-###-@@', diff --git a/app/components/malio/InputText.vue b/app/components/malio/InputText.vue index 982d052..3d0616a 100644 --- a/app/components/malio/InputText.vue +++ b/app/components/malio/InputText.vue @@ -69,7 +69,7 @@

@@ -96,7 +96,7 @@