@cnamts/synapse 0.0.11-alpha → 0.0.13-alpha
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/design-system-v3.js +5394 -3813
- package/dist/design-system-v3.umd.cjs +1 -1
- package/dist/src/components/Amelipro/types/types.d.ts +38 -0
- package/dist/src/components/CookieBanner/CookieBanner.d.ts +1 -1
- package/dist/src/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
- package/dist/src/components/Customs/SyTextField/SyTextField.d.ts +31 -23
- package/dist/src/components/Customs/SyTextField/types.d.ts +1 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +105 -102
- package/dist/src/components/DatePicker/DateTextInput.d.ts +82 -74
- package/dist/src/components/ErrorPage/ErrorPage.d.ts +1 -1
- package/dist/src/components/FileList/FileList.d.ts +1 -0
- package/dist/src/components/FileList/UploadItem/UploadItem.d.ts +1 -1
- package/dist/src/components/FilterInline/AccessibiliteItems.d.ts +30 -0
- package/dist/src/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/FilterSideBar/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/FilterSideBar/FilterSideBar.d.ts +31 -0
- package/dist/src/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/FilterSideBar/locales.d.ts +7 -0
- package/dist/src/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/src/components/NirField/NirField.d.ts +952 -0
- package/dist/src/components/NotificationBar/NotificationBar.d.ts +6 -6
- package/dist/src/components/PasswordField/PasswordField.d.ts +42 -8
- package/dist/src/components/PeriodField/PeriodField.d.ts +259 -235
- package/dist/src/components/PhoneField/PhoneField.d.ts +33 -3
- package/dist/src/components/RatingPicker/EmotionPicker/EmotionPicker.d.ts +1 -1
- package/dist/src/components/RatingPicker/NumberPicker/NumberPicker.d.ts +1 -1
- package/dist/src/components/RatingPicker/StarsPicker/StarsPicker.d.ts +1 -1
- package/dist/src/components/UploadWorkflow/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/config.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/UploadWorkflow/locales.d.ts +7 -0
- package/dist/src/components/UploadWorkflow/types.d.ts +19 -0
- package/dist/src/components/UploadWorkflow/useFileList.d.ts +10 -0
- package/dist/src/components/UploadWorkflow/useFileUploadJourney.d.ts +9 -0
- package/dist/src/components/Usages/Usages.d.ts +10 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/composables/date/tests/useDateFormat.spec.d.ts +1 -0
- package/dist/src/composables/date/tests/useDateInitialization.spec.d.ts +1 -0
- package/dist/src/composables/date/tests/useDatePickerAccessibility.spec.d.ts +1 -0
- package/dist/src/composables/date/useDateFormat.d.ts +26 -0
- package/dist/src/composables/date/useDateInitialization.d.ts +18 -0
- package/dist/src/composables/date/useDatePickerAccessibility.d.ts +8 -0
- package/dist/src/composables/rules/useFieldValidation.d.ts +1 -0
- package/dist/src/composables/useFilterable/useFilterable.d.ts +1 -1
- package/dist/src/composables/validation/tests/useValidation.spec.d.ts +1 -0
- package/dist/src/composables/validation/useValidation.d.ts +40 -0
- package/dist/src/designTokens/index.d.ts +3 -1
- package/dist/src/main.d.ts +1 -0
- package/dist/src/utils/formatDate/index.d.ts +3 -0
- package/dist/src/utils/formatDate/tests/formatDate.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateAfter/index.d.ts +2 -0
- package/dist/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateBefore/index.d.ts +2 -0
- package/dist/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateInRange/index.d.ts +3 -0
- package/dist/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateValid/index.d.ts +9 -0
- package/dist/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isEmailValid/tests/isEmailValid.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isWeekend/index.d.ts +3 -0
- package/dist/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.d.ts +1 -0
- package/dist/src/utils/parseDate/index.d.ts +3 -0
- package/dist/src/utils/parseDate/tests/parseDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/doMatchPattern/index.d.ts +3 -0
- package/dist/src/utils/rules/doMatchPattern/tests/matchPattern.spec.d.ts +1 -0
- package/dist/src/utils/rules/index.d.ts +11 -0
- package/dist/src/utils/rules/isDateValid/index.d.ts +4 -0
- package/dist/src/utils/rules/isDateValid/tests/isDateValid.spec.d.ts +1 -0
- package/dist/src/utils/rules/isExactLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isExactLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isExactLength/tests/exactLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isMaxLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isMaxLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isMaxLength/tests/isMaxLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isMinLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isMinLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isMinLength/tests/isMinLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotAfterDate/index.d.ts +3 -0
- package/dist/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotAfterToday/index.d.ts +4 -0
- package/dist/src/utils/rules/isNotAfterToday/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotBeforeDate/index.d.ts +3 -0
- package/dist/src/utils/rules/isNotBeforeDate/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotBeforeToday/index.d.ts +4 -0
- package/dist/src/utils/rules/isNotBeforeToday/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.d.ts +1 -0
- package/dist/src/utils/rules/isRequired/index.d.ts +4 -0
- package/dist/src/utils/rules/isRequired/locales.d.ts +2 -0
- package/dist/src/utils/rules/isRequired/tests/isRequred.spec.d.ts +1 -0
- package/dist/src/utils/rules/isValidEmail/index.d.ts +4 -0
- package/dist/src/utils/rules/isValidEmail/locales.d.ts +2 -0
- package/dist/src/utils/rules/isValidEmail/tests/isValidEmail.spec.d.ts +1 -0
- package/dist/src/vuetifyConfig.d.ts +81 -0
- package/dist/style.css +1 -1
- package/package.json +3 -1
- package/src/assets/_elevations.scss +89 -0
- package/src/assets/_fonts.scss +6 -0
- package/src/assets/_radius.scss +92 -0
- package/src/assets/_spacers.scss +149 -0
- package/src/assets/settings.scss +15 -3
- package/src/assets/tokens.scss +32 -29
- package/src/components/Amelipro/types/types.ts +40 -0
- package/src/components/ChipList/ChipList.stories.ts +26 -27
- package/src/components/ChipList/ChipList.vue +5 -1
- package/src/components/ChipList/config.ts +1 -0
- package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -2
- package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +65 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +13 -3
- package/src/components/Customs/SySelect/SySelect.mdx +1 -1
- package/src/components/Customs/SySelect/SySelect.stories.ts +88 -5
- package/src/components/Customs/SySelect/SySelect.vue +55 -14
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +135 -2
- package/src/components/Customs/SyTextField/SyTextField.mdx +2 -2
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +809 -79
- package/src/components/Customs/SyTextField/SyTextField.vue +135 -104
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +190 -38
- package/src/components/Customs/SyTextField/types.d.ts +1 -0
- package/src/components/DatePicker/DatePicker.stories.ts +177 -5
- package/src/components/DatePicker/DatePicker.vue +302 -233
- package/src/components/DatePicker/DateTextInput.vue +101 -246
- package/src/components/DatePicker/tests/DatePicker.spec.ts +123 -60
- package/src/components/DatePicker/tests/DateTextInput.spec.ts +202 -6
- package/src/components/FileList/Accessibilite.stories.ts +1 -1
- package/src/components/FileList/AccessibiliteItems.ts +22 -0
- package/src/components/FileList/FileList.vue +2 -1
- package/src/components/FileList/UploadItem/UploadItem.vue +10 -0
- package/src/components/FileUpload/FileUpload.stories.ts +93 -7
- package/src/components/FileUpload/FileUpload.vue +1 -0
- package/src/components/FileUpload/tests/FileUpload.spec.ts +4 -4
- package/src/components/FilterInline/Accessibilite.mdx +14 -0
- package/src/components/FilterInline/Accessibilite.stories.ts +216 -0
- package/src/components/FilterInline/AccessibiliteItems.ts +132 -0
- package/src/components/FilterInline/FilterInline.mdx +180 -34
- package/src/components/FilterInline/FilterInline.stories.ts +363 -6
- package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FilterSideBar/Accessibilite.mdx +14 -0
- package/src/components/FilterSideBar/Accessibilite.stories.ts +216 -0
- package/src/components/FilterSideBar/AccessibiliteItems.ts +153 -0
- package/src/components/FilterSideBar/FilterSideBar.mdx +237 -0
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +798 -0
- package/src/components/FilterSideBar/FilterSideBar.vue +193 -0
- package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FilterSideBar/locales.ts +8 -0
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +305 -0
- package/src/components/FilterSideBar/tests/__snapshots__/FilterSideBar.spec.ts.snap +39 -0
- package/src/components/HeaderBar/Usages.mdx +1 -1
- package/src/components/NirField/NirField.stories.ts +738 -29
- package/src/components/NirField/NirField.vue +401 -359
- package/src/components/NirField/examples//342/200/257dataset/342/200/257.md +12 -0
- package/src/components/NirField/tests/NirField.spec.ts +88 -52
- package/src/components/NirField/tests/config.spec.ts +65 -0
- package/src/components/NotificationBar/Accessibilite.stories.ts +4 -0
- package/src/components/NotificationBar/NotificationBar.mdx +2 -2
- package/src/components/NotificationBar/NotificationBar.stories.ts +66 -13
- package/src/components/NotificationBar/NotificationBar.vue +42 -114
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +28 -33
- package/src/components/NotificationBar/tests/__snapshots__/NotificationBar.spec.ts.snap +1 -1
- package/src/components/PaginatedTable/PaginatedTable.vue +6 -10
- package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +4 -4
- package/src/components/PasswordField/PasswordField.mdx +129 -47
- package/src/components/PasswordField/PasswordField.stories.ts +1111 -120
- package/src/components/PasswordField/PasswordField.vue +212 -99
- package/src/components/PasswordField/tests/PasswordField.spec.ts +138 -9
- package/src/components/PeriodField/PeriodField.stories.ts +214 -118
- package/src/components/PeriodField/PeriodField.vue +238 -190
- package/src/components/PeriodField/tests/PeriodField.spec.ts +146 -0
- package/src/components/PhoneField/PhoneField.stories.ts +170 -0
- package/src/components/PhoneField/PhoneField.vue +76 -17
- package/src/components/PhoneField/indicatifs.ts +1 -1
- package/src/components/PhoneField/tests/PhoneField.spec.ts +40 -0
- package/src/components/RatingPicker/RatingPicker.stories.ts +7 -7
- package/src/components/SearchListField/SearchListField.stories.ts +1 -1
- package/src/components/UploadWorkflow/Accessibilite.mdx +14 -0
- package/src/components/UploadWorkflow/Accessibilite.stories.ts +216 -0
- package/src/components/UploadWorkflow/AccessibiliteItems.ts +192 -0
- package/src/components/UploadWorkflow/UploadWorkflow.mdx +75 -0
- package/src/components/UploadWorkflow/UploadWorkflow.stories.ts +943 -0
- package/src/components/UploadWorkflow/UploadWorkflow.vue +230 -0
- package/src/components/UploadWorkflow/config.ts +29 -0
- package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/UploadWorkflow/locales.ts +8 -0
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +257 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/UploadWorkflow.spec.ts.snap +54 -0
- package/src/components/UploadWorkflow/types.ts +21 -0
- package/src/components/UploadWorkflow/useFileList.ts +84 -0
- package/src/components/UploadWorkflow/useFileUploadJourney.ts +18 -0
- package/src/components/Usages/tests/Usages.spec.ts +183 -0
- package/src/components/index.ts +5 -0
- package/src/composables/date/tests/useDateFormat.spec.ts +67 -0
- package/src/composables/date/tests/useDateInitialization.spec.ts +89 -0
- package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +102 -0
- package/src/composables/date/useDateFormat.ts +94 -0
- package/src/composables/date/useDateInitialization.ts +92 -0
- package/src/composables/date/useDatePickerAccessibility.ts +78 -0
- package/src/composables/rules/tests/useFieldValidation.spec.ts +385 -4
- package/src/composables/rules/useFieldValidation.ts +5 -2
- package/src/composables/useFilterable/useFilterable.ts +5 -4
- package/src/composables/validation/tests/useValidation.spec.ts +154 -0
- package/src/composables/validation/useValidation.ts +180 -0
- package/src/designTokens/index.ts +4 -0
- package/src/main.ts +1 -0
- package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +28 -0
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +2 -2
- package/src/stories/Accessibilite/Audit/RGAA.mdx +6 -6
- package/src/stories/Accessibilite/Introduction.mdx +2 -1
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +1 -1
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +1 -1
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +8 -11
- package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +77 -0
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +9 -3
- package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +2 -2
- package/src/stories/Demarrer/Accueil.mdx +1 -1
- package/src/stories/Demarrer/Introduction.stories.ts +3 -3
- package/src/stories/Demarrer/Releases.mdx +8 -0
- package/src/stories/Demarrer/Releases.stories.ts +66 -0
- package/src/stories/DesignTokens/Conteneurs.stories.ts +3 -3
- package/src/stories/DesignTokens/ThemePA.mdx +4 -30
- package/src/stories/GuideDuDev/LesBreackingChanges.mdx +36 -0
- package/src/stories/GuideDuDev/UtiliserLesRules.mdx +321 -78
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +1 -1
- package/src/utils/formatDate/index.ts +6 -0
- package/src/utils/formatDate/tests/formatDate.spec.ts +18 -0
- package/src/utils/functions/validation/isDateAfter/index.ts +9 -0
- package/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.ts +18 -0
- package/src/utils/functions/validation/isDateBefore/index.ts +9 -0
- package/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.ts +23 -0
- package/src/utils/functions/validation/isDateInRange/index.ts +22 -0
- package/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.ts +28 -0
- package/src/utils/functions/validation/isDateValid/index.ts +67 -0
- package/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.ts +46 -0
- package/src/utils/functions/validation/isEmailValid/index.ts +9 -0
- package/src/utils/functions/validation/isWeekend/index.ts +10 -0
- package/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.ts +16 -0
- package/src/utils/parseDate/index.ts +29 -0
- package/src/utils/parseDate/tests/parseDate.spec.ts +52 -0
- package/src/utils/rules/Rules.mdx +16 -0
- package/src/utils/rules/doMatchPattern/DoMachPattern.mdx +66 -0
- package/src/utils/rules/doMatchPattern/DoMatchPattern.stories.ts +106 -0
- package/src/utils/rules/doMatchPattern/index.ts +28 -0
- package/src/utils/rules/doMatchPattern/locales.ts +5 -0
- package/src/utils/rules/doMatchPattern/tests/matchPattern.spec.ts +38 -0
- package/src/utils/rules/index.ts +11 -0
- package/src/utils/rules/isDateValid/IsDateValid.mdx +87 -0
- package/src/utils/rules/isDateValid/IsDateValid.stories.ts +113 -0
- package/src/utils/rules/isDateValid/index.ts +32 -0
- package/src/utils/rules/isDateValid/locales.ts +10 -0
- package/src/utils/rules/isDateValid/tests/isDateValid.spec.ts +27 -0
- package/src/utils/rules/isExactLength/IsExactLenght.mdx +68 -0
- package/src/utils/rules/isExactLength/IsExactLength.stories.ts +151 -0
- package/src/utils/rules/{exactLength → isExactLength}/index.ts +2 -4
- package/src/utils/rules/isExactLength/tests/exactLength.spec.ts +48 -0
- package/src/utils/rules/isMaxLength/IsMaxLength.mdx +68 -0
- package/src/utils/rules/isMaxLength/IsMaxLength.stories.ts +152 -0
- package/src/utils/rules/isMaxLength/index.ts +30 -0
- package/src/utils/rules/isMaxLength/locales.ts +6 -0
- package/src/utils/rules/isMaxLength/tests/isMaxLength.spec.ts +42 -0
- package/src/utils/rules/isMinLength/IsMinLength.mdx +68 -0
- package/src/utils/rules/isMinLength/IsMinLength.stories.ts +152 -0
- package/src/utils/rules/isMinLength/index.ts +30 -0
- package/src/utils/rules/isMinLength/locales.ts +6 -0
- package/src/utils/rules/isMinLength/tests/isMinLength.spec.ts +42 -0
- package/src/utils/rules/isNotAfterDate/IsNotAfterDate.mdx +68 -0
- package/src/utils/rules/isNotAfterDate/IsNotAfterDate.stories.ts +109 -0
- package/src/utils/rules/isNotAfterDate/index.ts +25 -0
- package/src/utils/rules/isNotAfterDate/locales.ts +6 -0
- package/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.ts +25 -0
- package/src/utils/rules/isNotAfterToday/IsNotAfterToday.mdx +83 -0
- package/src/utils/rules/isNotAfterToday/IsNotAfterToday.stories.ts +110 -0
- package/src/utils/rules/isNotAfterToday/index.ts +28 -0
- package/src/utils/rules/isNotAfterToday/locales.ts +5 -0
- package/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.ts +30 -0
- package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.mdx +68 -0
- package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.stories.ts +114 -0
- package/src/utils/rules/isNotBeforeDate/index.ts +25 -0
- package/src/utils/rules/isNotBeforeDate/locales.ts +6 -0
- package/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.ts +25 -0
- package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.mdx +83 -0
- package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.stories.ts +110 -0
- package/src/utils/rules/isNotBeforeToday/index.ts +28 -0
- package/src/utils/rules/isNotBeforeToday/locales.ts +5 -0
- package/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.ts +36 -0
- package/src/utils/rules/isRequired/IsRequired.mdx +81 -0
- package/src/utils/rules/isRequired/IsRequired.stories.ts +101 -0
- package/src/utils/rules/{required → isRequired}/index.ts +3 -3
- package/src/utils/rules/{required/tests/index.spec.ts → isRequired/tests/isRequred.spec.ts} +9 -9
- package/src/utils/rules/isValidEmail/IsValidEmail.mdx +81 -0
- package/src/utils/rules/isValidEmail/IsValidEmail.stories.ts +101 -0
- package/src/utils/rules/{email → isValidEmail}/index.ts +3 -5
- package/src/utils/rules/{email/tests/email.spec.ts → isValidEmail/tests/isValidEmail.spec.ts} +5 -5
- package/src/vuetifyConfig.ts +61 -0
- package/dist/src/utils/rules/email/index.d.ts +0 -4
- package/dist/src/utils/rules/exactLength/index.d.ts +0 -4
- package/dist/src/utils/rules/required/index.d.ts +0 -4
- package/dist/src/utils/rules/required/ruleMessageHelper.d.ts +0 -3
- package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +0 -58
- package/src/composables/useFilterable/__snapshots__/useFilterable.spec.ts.snap +0 -3
- package/src/utils/functions/isEmailValid/index.ts +0 -8
- package/src/utils/rules/required/ruleMessageHelper.ts +0 -14
- package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +0 -22
- /package/dist/src/{utils/functions/isEmailValid/tests/isEmailValid.spec.d.ts → components/FilterSideBar/tests/FilterSideBar.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/email/tests/email.spec.d.ts → components/NirField/tests/config.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/index.spec.d.ts → components/UploadWorkflow/tests/UploadWorkflow.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/rulesMessageHelper.spec.d.ts → components/Usages/tests/Usages.spec.d.ts} +0 -0
- /package/dist/src/utils/functions/{isEmailValid → validation/isEmailValid}/index.d.ts +0 -0
- /package/dist/src/utils/rules/{exactLength → doMatchPattern}/locales.d.ts +0 -0
- /package/dist/src/utils/rules/{email → isDateValid}/locales.d.ts +0 -0
- /package/dist/src/utils/rules/{required → isNotAfterDate}/locales.d.ts +0 -0
- /package/src/utils/functions/{isEmailValid → validation/isEmailValid}/tests/isEmailValid.spec.ts +0 -0
- /package/src/utils/rules/{exactLength → isExactLength}/locales.ts +0 -0
- /package/src/utils/rules/{required → isRequired}/locales.ts +0 -0
- /package/src/utils/rules/{email → isValidEmail}/locales.ts +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, ref, watch } from 'vue'
|
|
3
3
|
import type { IconType, VariantStyle, ColorType } from './types'
|
|
4
|
-
import {
|
|
5
|
-
import type { RuleOptions } from '@/composables/rules/useFieldValidation'
|
|
4
|
+
import { useValidation, type ValidationRule } from '@/composables/validation/useValidation'
|
|
6
5
|
import {
|
|
7
6
|
mdiAlertOutline,
|
|
8
7
|
mdiCheck,
|
|
@@ -19,6 +18,9 @@
|
|
|
19
18
|
appendIcon?: IconType
|
|
20
19
|
prependInnerIcon?: IconType
|
|
21
20
|
appendInnerIcon?: IconType
|
|
21
|
+
prependTooltip?: string
|
|
22
|
+
appendTooltip?: string
|
|
23
|
+
tooltipLocation?: 'top' | 'bottom' | 'start' | 'end'
|
|
22
24
|
variantStyle?: VariantStyle
|
|
23
25
|
color?: ColorType
|
|
24
26
|
isClearable?: boolean
|
|
@@ -70,9 +72,12 @@
|
|
|
70
72
|
width?: string | number
|
|
71
73
|
displayAsterisk?: boolean
|
|
72
74
|
noIcon?: boolean
|
|
73
|
-
customRules?:
|
|
74
|
-
customWarningRules?:
|
|
75
|
+
customRules?: ValidationRule[]
|
|
76
|
+
customWarningRules?: ValidationRule[]
|
|
77
|
+
customSuccessRules?: ValidationRule[]
|
|
75
78
|
showSuccessMessages?: boolean
|
|
79
|
+
isValidateOnBlur?: boolean
|
|
80
|
+
disableErrorHandling?: boolean
|
|
76
81
|
}>(),
|
|
77
82
|
{
|
|
78
83
|
modelValue: undefined,
|
|
@@ -80,6 +85,9 @@
|
|
|
80
85
|
appendIcon: undefined,
|
|
81
86
|
appendInnerIcon: undefined,
|
|
82
87
|
prependInnerIcon: undefined,
|
|
88
|
+
prependTooltip: undefined,
|
|
89
|
+
appendTooltip: undefined,
|
|
90
|
+
tooltipLocation: 'top',
|
|
83
91
|
variantStyle: 'outlined',
|
|
84
92
|
color: 'primary',
|
|
85
93
|
label: 'custom label',
|
|
@@ -106,7 +114,7 @@
|
|
|
106
114
|
hint: undefined,
|
|
107
115
|
id: undefined,
|
|
108
116
|
loading: false,
|
|
109
|
-
maxErrors:
|
|
117
|
+
maxErrors: undefined,
|
|
110
118
|
maxWidth: undefined,
|
|
111
119
|
messages: undefined,
|
|
112
120
|
minWidth: undefined,
|
|
@@ -130,7 +138,10 @@
|
|
|
130
138
|
noIcon: false,
|
|
131
139
|
customRules: () => [],
|
|
132
140
|
customWarningRules: () => [],
|
|
141
|
+
customSuccessRules: () => [],
|
|
133
142
|
showSuccessMessages: true,
|
|
143
|
+
isValidateOnBlur: true,
|
|
144
|
+
disableErrorHandling: false,
|
|
134
145
|
},
|
|
135
146
|
)
|
|
136
147
|
|
|
@@ -143,137 +154,119 @@
|
|
|
143
154
|
calendar: mdiCalendar,
|
|
144
155
|
}
|
|
145
156
|
|
|
157
|
+
const emit = defineEmits([
|
|
158
|
+
'update:modelValue',
|
|
159
|
+
'clear',
|
|
160
|
+
'prepend-icon-click',
|
|
161
|
+
'append-icon-click',
|
|
162
|
+
])
|
|
163
|
+
|
|
146
164
|
const model = computed({
|
|
147
|
-
get
|
|
148
|
-
|
|
149
|
-
|
|
165
|
+
get() {
|
|
166
|
+
return props.modelValue
|
|
167
|
+
},
|
|
168
|
+
set(value) {
|
|
169
|
+
emit('update:modelValue', value)
|
|
150
170
|
},
|
|
151
171
|
})
|
|
152
172
|
|
|
153
173
|
const isBlurred = ref(false)
|
|
154
|
-
const errors = ref<string[]>([])
|
|
155
|
-
const warnings = ref<string[]>([])
|
|
156
|
-
const successes = ref<string[]>([])
|
|
157
174
|
|
|
175
|
+
// Initialisation du composable de validation
|
|
176
|
+
const validation = useValidation({
|
|
177
|
+
customRules: props.customRules,
|
|
178
|
+
warningRules: props.customWarningRules,
|
|
179
|
+
successRules: props.customSuccessRules,
|
|
180
|
+
showSuccessMessages: props.showSuccessMessages,
|
|
181
|
+
fieldIdentifier: props.label,
|
|
182
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
// Synchronisation des messages externes
|
|
158
186
|
watch(() => props.errorMessages, (newVal) => {
|
|
159
|
-
errors.value = newVal || []
|
|
187
|
+
validation.errors.value = newVal || []
|
|
160
188
|
}, { immediate: true })
|
|
161
189
|
|
|
162
190
|
watch(() => props.warningMessages, (newVal) => {
|
|
163
|
-
warnings.value = newVal || []
|
|
191
|
+
validation.warnings.value = newVal || []
|
|
164
192
|
}, { immediate: true })
|
|
165
193
|
|
|
166
194
|
watch(() => props.successMessages, (newVal) => {
|
|
167
|
-
successes.value = newVal || []
|
|
195
|
+
validation.successes.value = newVal || []
|
|
168
196
|
}, { immediate: true })
|
|
169
197
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
options: {
|
|
182
|
-
message: `Le champ ${props.label || 'ce champ'} est requis.`,
|
|
183
|
-
fieldIdentifier: props.label,
|
|
184
|
-
},
|
|
185
|
-
}]
|
|
186
|
-
: []
|
|
187
|
-
|
|
188
|
-
return generateRules([...defaultRules, ...customRules.value])
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
const warningValidationRules = computed(() => {
|
|
192
|
-
const rulesWithWarning = customWarningRules.value.map(rule => ({
|
|
193
|
-
type: rule.type,
|
|
194
|
-
options: { ...(rule.options || {}), isWarning: true },
|
|
195
|
-
}))
|
|
196
|
-
return generateRules(rulesWithWarning)
|
|
197
|
-
})
|
|
198
|
+
// Construction des règles de validation
|
|
199
|
+
const defaultRules = computed<ValidationRule[]>(() => props.required
|
|
200
|
+
? [{
|
|
201
|
+
type: 'required',
|
|
202
|
+
options: {
|
|
203
|
+
message: `Le champ ${props.label || 'ce champ'} est requis.`,
|
|
204
|
+
fieldIdentifier: props.label,
|
|
205
|
+
},
|
|
206
|
+
}]
|
|
207
|
+
: [],
|
|
208
|
+
)
|
|
198
209
|
|
|
199
210
|
const validateField = (value: string | number | null) => {
|
|
200
|
-
errors.value = []
|
|
201
|
-
warnings.value = []
|
|
202
|
-
successes.value = []
|
|
203
|
-
|
|
204
211
|
// Si le champ est vide et non requis, on ne fait pas de validation
|
|
205
212
|
if (!value && !props.required) {
|
|
213
|
+
validation.clearValidation()
|
|
206
214
|
return true
|
|
207
215
|
}
|
|
208
216
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (result.error) {
|
|
215
|
-
errors.value.push(result.error)
|
|
216
|
-
}
|
|
217
|
-
else if (props.showSuccessMessages && result.success && !errors.value.length && !hasSuccess) {
|
|
218
|
-
successes.value = [result.success]
|
|
219
|
-
hasSuccess = true
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
// Si on a des erreurs, on n'affiche pas les warnings ni les succès
|
|
224
|
-
if (errors.value.length) {
|
|
225
|
-
warnings.value = []
|
|
226
|
-
successes.value = []
|
|
227
|
-
return false
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Validation des règles d'avertissement
|
|
231
|
-
warningValidationRules.value.forEach((rule) => {
|
|
232
|
-
const result = rule(value)
|
|
233
|
-
if (result.warning) {
|
|
234
|
-
warnings.value.push(result.warning)
|
|
235
|
-
}
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
// Si on a des warnings, on n'affiche pas les succès
|
|
239
|
-
if (warnings.value.length) {
|
|
240
|
-
successes.value = []
|
|
241
|
-
}
|
|
217
|
+
const result = validation.validateField(
|
|
218
|
+
value,
|
|
219
|
+
[...defaultRules.value, ...props.customRules],
|
|
220
|
+
props.customWarningRules,
|
|
221
|
+
)
|
|
242
222
|
|
|
243
|
-
return
|
|
223
|
+
return !result.hasError
|
|
244
224
|
}
|
|
245
225
|
|
|
246
226
|
const validateOnSubmit = () => {
|
|
247
227
|
isBlurred.value = true
|
|
248
|
-
// On s'assure que model.value n'est pas undefined
|
|
249
228
|
return validateField(model.value ?? null)
|
|
250
229
|
}
|
|
251
230
|
|
|
252
|
-
const hasError = computed(() => errors.value.length > 0)
|
|
253
|
-
const hasWarning = computed(() => warnings.value.length > 0)
|
|
254
|
-
const hasSuccess = computed(() => successes.value.length > 0 && !hasError.value && !hasWarning.value)
|
|
255
|
-
|
|
256
231
|
const checkErrorOnBlur = () => {
|
|
257
232
|
isBlurred.value = true
|
|
258
233
|
validateField(model.value ?? null)
|
|
234
|
+
emit('update:modelValue', model.value)
|
|
259
235
|
}
|
|
260
236
|
|
|
261
237
|
watch(model, (newValue) => {
|
|
262
|
-
|
|
238
|
+
if (!props.isValidateOnBlur) {
|
|
239
|
+
validateField(newValue ?? null)
|
|
240
|
+
}
|
|
263
241
|
if (props.isClearable && newValue === '') {
|
|
264
242
|
emit('clear')
|
|
265
243
|
}
|
|
266
244
|
})
|
|
267
245
|
|
|
246
|
+
// Computed pour l'affichage des états
|
|
247
|
+
const hasError = computed(() => validation.hasError.value)
|
|
248
|
+
const hasWarning = computed(() => validation.hasWarning.value)
|
|
249
|
+
const hasSuccess = computed(() => validation.hasSuccess.value)
|
|
250
|
+
|
|
251
|
+
const errors = computed(() => validation.errors.value)
|
|
252
|
+
const warnings = computed(() => validation.warnings.value)
|
|
253
|
+
const successes = computed(() => validation.successes.value)
|
|
254
|
+
|
|
255
|
+
// Computed pour les icônes
|
|
268
256
|
const appendInnerIconColor = computed(() => {
|
|
269
|
-
if (
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
return props.appendInnerIcon === 'error' || props.appendInnerIcon === 'success' || props.appendInnerIcon === 'warning'
|
|
273
|
-
? props.appendInnerIcon
|
|
274
|
-
: 'black'
|
|
257
|
+
if (props.appendInnerIcon === 'error') return 'error'
|
|
258
|
+
if (props.appendInnerIcon === 'success') return 'success'
|
|
259
|
+
return 'rgba(0, 0, 0, 1)'
|
|
275
260
|
})
|
|
276
261
|
|
|
262
|
+
const handlePrependIconClick = () => {
|
|
263
|
+
emit('prepend-icon-click')
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const handleAppendIconClick = () => {
|
|
267
|
+
emit('append-icon-click')
|
|
268
|
+
}
|
|
269
|
+
|
|
277
270
|
const validationIcon = computed(() => {
|
|
278
271
|
if (hasError.value) return ICONS['error']
|
|
279
272
|
if (hasWarning.value) return ICONS['warning']
|
|
@@ -296,14 +289,10 @@
|
|
|
296
289
|
opacity: '1',
|
|
297
290
|
}
|
|
298
291
|
|
|
299
|
-
const emit = defineEmits(['update:model-value', 'clear', 'prepend-icon-click', 'append-icon-click'])
|
|
300
|
-
|
|
301
292
|
defineExpose({
|
|
302
|
-
|
|
293
|
+
validation,
|
|
303
294
|
validateOnSubmit,
|
|
304
|
-
|
|
305
|
-
warnings,
|
|
306
|
-
successes,
|
|
295
|
+
checkErrorOnBlur,
|
|
307
296
|
})
|
|
308
297
|
</script>
|
|
309
298
|
|
|
@@ -312,6 +301,7 @@
|
|
|
312
301
|
:id="props.id"
|
|
313
302
|
v-model="model"
|
|
314
303
|
:active="props.isActive"
|
|
304
|
+
:title="props.label"
|
|
315
305
|
:aria-label="props.label"
|
|
316
306
|
:base-color="props.baseColor"
|
|
317
307
|
:bg-color="props.bgColor"
|
|
@@ -336,7 +326,7 @@
|
|
|
336
326
|
:loading="props.loading"
|
|
337
327
|
:max-errors="props.maxErrors"
|
|
338
328
|
:max-width="props.maxWidth"
|
|
339
|
-
:messages="hasWarning ? warnings : (hasSuccess && props.showSuccessMessages ? successes : [])"
|
|
329
|
+
:messages="hasError ? errors : (hasWarning ? warnings : (hasSuccess && props.showSuccessMessages ? successes : []))"
|
|
340
330
|
:min-width="props.minWidth"
|
|
341
331
|
:name="props.name"
|
|
342
332
|
:no-icon="props.noIcon"
|
|
@@ -360,35 +350,70 @@
|
|
|
360
350
|
:class="{
|
|
361
351
|
'error-field': hasError,
|
|
362
352
|
'warning-field': hasWarning,
|
|
363
|
-
'success-field': hasSuccess
|
|
353
|
+
'success-field': hasSuccess,
|
|
354
|
+
'basic-field': !hasError && !hasWarning && !hasSuccess
|
|
364
355
|
}"
|
|
365
356
|
@blur="checkErrorOnBlur"
|
|
366
357
|
>
|
|
367
358
|
<template
|
|
368
|
-
v-if="props.prependIcon
|
|
359
|
+
v-if="props.prependIcon || props.prependTooltip"
|
|
369
360
|
#prepend
|
|
370
361
|
>
|
|
371
362
|
<slot name="prepend">
|
|
363
|
+
<template v-if="props.prependTooltip">
|
|
364
|
+
<VTooltip
|
|
365
|
+
:text="props.prependTooltip"
|
|
366
|
+
:location="props.tooltipLocation"
|
|
367
|
+
>
|
|
368
|
+
<template #activator="{ props: tooltipProps }">
|
|
369
|
+
<VIcon
|
|
370
|
+
v-bind="tooltipProps"
|
|
371
|
+
:aria-label="props.label ? `${props.label} - info` : 'Info'"
|
|
372
|
+
:color="appendInnerIconColor"
|
|
373
|
+
:icon="ICONS.info"
|
|
374
|
+
role="button"
|
|
375
|
+
/>
|
|
376
|
+
</template>
|
|
377
|
+
</VTooltip>
|
|
378
|
+
</template>
|
|
372
379
|
<VIcon
|
|
380
|
+
v-else-if="props.prependIcon"
|
|
373
381
|
:aria-label="props.label ? `${props.label} - bouton ${props.prependIcon}` : `Bouton ${props.prependIcon}`"
|
|
374
382
|
:color="appendInnerIconColor"
|
|
375
383
|
:icon="ICONS[props.prependIcon]"
|
|
376
384
|
role="button"
|
|
377
|
-
@click="
|
|
385
|
+
@click="handlePrependIconClick"
|
|
378
386
|
/>
|
|
379
387
|
</slot>
|
|
380
388
|
</template>
|
|
381
389
|
<template
|
|
382
|
-
v-if="props.appendIcon
|
|
390
|
+
v-if="props.appendIcon || props.appendTooltip"
|
|
383
391
|
#append
|
|
384
392
|
>
|
|
385
393
|
<slot name="append">
|
|
394
|
+
<template v-if="props.appendTooltip">
|
|
395
|
+
<VTooltip
|
|
396
|
+
:text="props.appendTooltip"
|
|
397
|
+
:location="props.tooltipLocation"
|
|
398
|
+
>
|
|
399
|
+
<template #activator="{ props: tooltipProps }">
|
|
400
|
+
<VIcon
|
|
401
|
+
v-bind="tooltipProps"
|
|
402
|
+
:aria-label="props.label ? `${props.label} - info` : 'Info'"
|
|
403
|
+
:color="appendInnerIconColor"
|
|
404
|
+
:icon="ICONS.info"
|
|
405
|
+
role="button"
|
|
406
|
+
/>
|
|
407
|
+
</template>
|
|
408
|
+
</VTooltip>
|
|
409
|
+
</template>
|
|
386
410
|
<VIcon
|
|
411
|
+
v-else-if="props.appendIcon"
|
|
387
412
|
:aria-label="props.label ? `${props.label} - bouton ${props.appendIcon}` : `Bouton ${props.appendIcon}`"
|
|
388
413
|
:color="appendInnerIconColor"
|
|
389
414
|
:icon="ICONS[props.appendIcon]"
|
|
390
415
|
role="button"
|
|
391
|
-
@click="
|
|
416
|
+
@click="handleAppendIconClick"
|
|
392
417
|
/>
|
|
393
418
|
</slot>
|
|
394
419
|
</template>
|
|
@@ -494,4 +519,10 @@
|
|
|
494
519
|
}
|
|
495
520
|
}
|
|
496
521
|
}
|
|
522
|
+
|
|
523
|
+
.basic-field {
|
|
524
|
+
:deep(.v-icon__svg) {
|
|
525
|
+
fill: rgb(0 0 0 / 100%);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
497
528
|
</style>
|
|
@@ -1,36 +1,56 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest'
|
|
1
2
|
import { mount } from '@vue/test-utils'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
3
|
+
import { createVuetify } from 'vuetify'
|
|
4
|
+
import * as components from 'vuetify/components'
|
|
5
|
+
import * as directives from 'vuetify/directives'
|
|
4
6
|
import { VIcon } from 'vuetify/components'
|
|
5
|
-
import { vuetify } from '@tests/unit/setup'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import SyTextField from '../SyTextField.vue'
|
|
9
|
+
import type { IconType } from '../types'
|
|
10
|
+
|
|
11
|
+
const vuetify = createVuetify({
|
|
12
|
+
components,
|
|
13
|
+
directives,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
describe('SyTextField.vue', () => {
|
|
17
|
+
let wrapper: ReturnType<typeof mount<typeof SyTextField>>
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
wrapper = mount(SyTextField, {
|
|
12
21
|
global: {
|
|
13
22
|
plugins: [vuetify],
|
|
14
23
|
},
|
|
24
|
+
props: {
|
|
25
|
+
modelValue: undefined,
|
|
26
|
+
required: true,
|
|
27
|
+
showSuccessMessages: true,
|
|
28
|
+
outlined: true,
|
|
29
|
+
},
|
|
15
30
|
})
|
|
16
|
-
}
|
|
31
|
+
})
|
|
17
32
|
|
|
18
33
|
it('renders correctly with default props', () => {
|
|
19
|
-
const wrapper = factory()
|
|
20
34
|
expect(wrapper.exists()).toBe(true)
|
|
21
|
-
expect(wrapper.findComponent(VIcon).exists()).toBe(false) // No icons by default
|
|
35
|
+
expect(wrapper.findComponent({ name: 'VIcon' }).exists()).toBe(false) // No icons by default
|
|
22
36
|
})
|
|
23
37
|
|
|
24
38
|
it('applies the correct variant style', () => {
|
|
25
|
-
|
|
39
|
+
wrapper = mount(SyTextField, {
|
|
40
|
+
global: { plugins: [vuetify] },
|
|
41
|
+
props: { variantStyle: 'filled' },
|
|
42
|
+
})
|
|
26
43
|
const textField = wrapper.findComponent({ name: 'VTextField' })
|
|
27
44
|
expect(textField.props('variant')).toBe('filled')
|
|
28
45
|
})
|
|
29
46
|
|
|
30
47
|
it('renders default slots correctly', () => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
wrapper = mount(SyTextField, {
|
|
49
|
+
global: { plugins: [vuetify] },
|
|
50
|
+
slots: {
|
|
51
|
+
prepend: '<div data-testid="prepend-slot">Prepend Slot Content</div>',
|
|
52
|
+
append: '<div data-testid="append-slot">Append Slot Content</div>',
|
|
53
|
+
},
|
|
34
54
|
})
|
|
35
55
|
|
|
36
56
|
const prependSlot = wrapper.find('.v-field--prepended')
|
|
@@ -41,9 +61,12 @@ describe('SyTextField', () => {
|
|
|
41
61
|
})
|
|
42
62
|
|
|
43
63
|
it('renders inner slots correctly', () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
wrapper = mount(SyTextField, {
|
|
65
|
+
global: { plugins: [vuetify] },
|
|
66
|
+
slots: {
|
|
67
|
+
'prepend-inner': '<div data-testid="prepend-inner-slot">Prepend Inner Slot Content</div>',
|
|
68
|
+
'append-inner': '<div data-testid="append-inner-slot">Append Inner Slot Content</div>',
|
|
69
|
+
},
|
|
47
70
|
})
|
|
48
71
|
|
|
49
72
|
const prependInnerSlot = wrapper.find('[data-testid="prepend-inner-slot"]')
|
|
@@ -55,38 +78,167 @@ describe('SyTextField', () => {
|
|
|
55
78
|
expect(appendInnerSlot.text()).toBe('Append Inner Slot Content')
|
|
56
79
|
})
|
|
57
80
|
|
|
58
|
-
it('
|
|
81
|
+
it('should update icon when validation state changes', async () => {
|
|
82
|
+
wrapper = mount(SyTextField, {
|
|
83
|
+
global: { plugins: [vuetify] },
|
|
84
|
+
props: { appendInnerIcon: 'success' as IconType },
|
|
85
|
+
})
|
|
86
|
+
expect(wrapper.props('appendInnerIcon')).toBe('success')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('should update icon when validation state changes with warning', async () => {
|
|
90
|
+
wrapper = mount(SyTextField, {
|
|
91
|
+
global: { plugins: [vuetify] },
|
|
92
|
+
props: { appendInnerIcon: 'warning' as IconType },
|
|
93
|
+
})
|
|
94
|
+
expect(wrapper.props('appendInnerIcon')).toBe('warning')
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it('should update icon when validation state changes with error', async () => {
|
|
98
|
+
wrapper = mount(SyTextField, {
|
|
99
|
+
global: { plugins: [vuetify] },
|
|
100
|
+
props: { appendInnerIcon: 'error' as IconType },
|
|
101
|
+
})
|
|
102
|
+
expect(wrapper.props('appendInnerIcon')).toBe('error')
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('should update icon when validation state changes with success', async () => {
|
|
106
|
+
wrapper = mount(SyTextField, {
|
|
107
|
+
global: { plugins: [vuetify] },
|
|
108
|
+
props: { appendInnerIcon: 'success' as IconType },
|
|
109
|
+
})
|
|
110
|
+
expect(wrapper.props('appendInnerIcon')).toBe('success')
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('emits prepend-icon-click event when prepend icon is clicked', async () => {
|
|
114
|
+
const wrapper = mount(SyTextField, {
|
|
115
|
+
global: { plugins: [vuetify] },
|
|
116
|
+
props: { prependIcon: 'info' as IconType },
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
await wrapper.vm.$nextTick()
|
|
120
|
+
const prependIcon = wrapper.findComponent(VIcon)
|
|
121
|
+
expect(prependIcon.exists()).toBe(true)
|
|
122
|
+
await prependIcon.trigger('click')
|
|
123
|
+
await wrapper.vm.$nextTick()
|
|
124
|
+
expect(wrapper.emitted('prepend-icon-click')).toBeTruthy()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('emits append-icon-click event when append icon is clicked', async () => {
|
|
128
|
+
const wrapper = mount(SyTextField, {
|
|
129
|
+
global: { plugins: [vuetify] },
|
|
130
|
+
props: { appendIcon: 'info' as IconType },
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
await wrapper.vm.$nextTick()
|
|
134
|
+
const appendIcon = wrapper.findComponent(VIcon)
|
|
135
|
+
expect(appendIcon.exists()).toBe(true)
|
|
136
|
+
await appendIcon.trigger('click')
|
|
137
|
+
await wrapper.vm.$nextTick()
|
|
138
|
+
expect(wrapper.emitted('append-icon-click')).toBeTruthy()
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it('shows validation error message', async () => {
|
|
59
142
|
const wrapper = mount(SyTextField, {
|
|
143
|
+
global: { plugins: [vuetify] },
|
|
60
144
|
props: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
errorMessages: ['Test error message'],
|
|
145
|
+
required: true,
|
|
146
|
+
label: 'Test Field',
|
|
64
147
|
},
|
|
65
|
-
|
|
66
|
-
|
|
148
|
+
})
|
|
149
|
+
await wrapper.find('input').trigger('blur')
|
|
150
|
+
await wrapper.vm.$nextTick()
|
|
151
|
+
expect(wrapper.find('.v-messages').text()).toContain('Le champ Test Field est requis')
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('validates field with custom rules', async () => {
|
|
155
|
+
const customRule = {
|
|
156
|
+
type: 'custom',
|
|
157
|
+
options: {
|
|
158
|
+
validate: (value: string) => value.length > 2,
|
|
159
|
+
message: 'Test error message',
|
|
67
160
|
},
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
wrapper = mount(SyTextField, {
|
|
164
|
+
global: { plugins: [vuetify] },
|
|
165
|
+
props: { customRules: [customRule] },
|
|
68
166
|
})
|
|
69
167
|
|
|
70
|
-
|
|
71
|
-
|
|
168
|
+
await wrapper.setProps({ modelValue: 'ab' })
|
|
169
|
+
await wrapper.find('input').trigger('blur')
|
|
170
|
+
await wrapper.vm.$nextTick()
|
|
72
171
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
expect(wrapper.vm.appendInnerIconColor).toBe('error')
|
|
172
|
+
const messages = wrapper.find('.v-messages')
|
|
173
|
+
expect(messages.text()).toContain('Test error message')
|
|
76
174
|
})
|
|
77
175
|
|
|
78
|
-
it('
|
|
79
|
-
const
|
|
80
|
-
|
|
176
|
+
it('validates field with custom warning rules', async () => {
|
|
177
|
+
const warningRule = {
|
|
178
|
+
type: 'custom',
|
|
179
|
+
options: {
|
|
180
|
+
validate: (value: string) => value.length <= 3,
|
|
181
|
+
message: 'Test warning message',
|
|
182
|
+
isWarning: true,
|
|
183
|
+
},
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const wrapper = mount(SyTextField, {
|
|
187
|
+
global: { plugins: [vuetify] },
|
|
188
|
+
props: {
|
|
189
|
+
modelValue: 'test',
|
|
190
|
+
customWarningRules: [warningRule],
|
|
191
|
+
showSuccessMessages: true,
|
|
192
|
+
label: 'Test Field',
|
|
193
|
+
},
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
await wrapper.vm.$nextTick()
|
|
197
|
+
await wrapper.find('input').trigger('blur')
|
|
198
|
+
await wrapper.vm.$nextTick()
|
|
199
|
+
|
|
200
|
+
const messages = wrapper.find('.v-messages')
|
|
201
|
+
expect(messages.exists()).toBe(true)
|
|
202
|
+
expect(messages.text()).toContain('Attention : Test Field peut contenir une erreur')
|
|
81
203
|
})
|
|
82
204
|
|
|
83
|
-
it('
|
|
84
|
-
|
|
85
|
-
|
|
205
|
+
it('maintains input value without validation rules', async () => {
|
|
206
|
+
wrapper = mount(SyTextField, {
|
|
207
|
+
global: { plugins: [vuetify] },
|
|
208
|
+
})
|
|
209
|
+
const input = wrapper.find('input')
|
|
210
|
+
|
|
211
|
+
await input.setValue('test value')
|
|
212
|
+
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual(['test value'])
|
|
86
213
|
})
|
|
87
214
|
|
|
88
|
-
it('
|
|
89
|
-
const
|
|
90
|
-
|
|
215
|
+
it('validates field immediately when isValidateOnBlur is false', async () => {
|
|
216
|
+
const customRule = {
|
|
217
|
+
type: 'custom',
|
|
218
|
+
options: {
|
|
219
|
+
validate: (value: string) => value.length > 2,
|
|
220
|
+
message: 'Test error message',
|
|
221
|
+
},
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
wrapper = mount(SyTextField, {
|
|
225
|
+
global: { plugins: [vuetify] },
|
|
226
|
+
props: {
|
|
227
|
+
customRules: [customRule],
|
|
228
|
+
isValidateOnBlur: false,
|
|
229
|
+
},
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
await wrapper.setProps({ modelValue: 'ab' })
|
|
233
|
+
await wrapper.vm.$nextTick()
|
|
234
|
+
|
|
235
|
+
const messages = wrapper.find('.v-messages')
|
|
236
|
+
expect(messages.text()).toContain('Test error message')
|
|
237
|
+
|
|
238
|
+
// Vérifie que l'erreur disparaît quand la valeur devient valide
|
|
239
|
+
await wrapper.setProps({ modelValue: 'abc' })
|
|
240
|
+
await wrapper.vm.$nextTick()
|
|
241
|
+
|
|
242
|
+
expect(messages.text()).not.toContain('Test error message')
|
|
91
243
|
})
|
|
92
244
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export type IconType = 'info' | 'success' | 'warning' | 'error' | 'close' | 'calendar' | undefined
|
|
2
2
|
export type VariantStyle = 'outlined' | 'filled' | 'solo' | 'solo-inverted' | 'solo-filled' | 'underlined'
|
|
3
3
|
export type ColorType = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error'
|
|
4
|
+
export type ValidateOnType = 'eager' | 'lazy' | 'blur' | 'input' | 'submit' | 'invalid-input' | 'blur lazy' | 'input lazy' | 'submit lazy' | 'invalid-input lazy' | 'blur eager' | 'input eager' | 'submit eager' | 'invalid-input eager' | 'lazy blur' | 'lazy input' | 'lazy submit' | 'lazy invalid-input' | 'eager blur' | 'eager input' | 'eager submit' | 'eager invalid-input' | undefined
|