@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
|
@@ -5,7 +5,7 @@ import * as SyBtnSelectStories from "./SyBtnSelect.stories";
|
|
|
5
5
|
|
|
6
6
|
# SyBtnSelect
|
|
7
7
|
|
|
8
|
-
Le composant `SyBtnSelect` est utilisé pour proposer une sélection d'options avec un bouton personnalisé, conforme au style du Design System et qui respecte les règles d'accessibilité RGAA
|
|
8
|
+
Le composant `SyBtnSelect` est utilisé pour proposer une sélection d'options avec un bouton personnalisé, conforme au style du Design System et qui respecte les règles d'accessibilité <abbr title="Référentiel Général d’Amélioration de l’Accessibilité">RGAA</abbr>.<br/>
|
|
9
9
|
Il est basé sur un `v-btn`.
|
|
10
10
|
|
|
11
11
|
<Canvas of={SyBtnSelectStories.Default}/>
|
|
@@ -5,7 +5,7 @@ import * as SyInputSelectStories from "./SyInputSelect.stories";
|
|
|
5
5
|
|
|
6
6
|
# SyInputSelect
|
|
7
7
|
|
|
8
|
-
Le composant `SyInputSelect` est utilisé pour proposer une alternative au `v-select` de Vuetify qui ne respecte pas les règles RGAA
|
|
8
|
+
Le composant `SyInputSelect` est utilisé pour proposer une alternative au `v-select` de Vuetify qui ne respecte pas les règles <abbr title="Référentiel Général d’Amélioration de l’Accessibilité">RGAA</abbr>.<br/>
|
|
9
9
|
Il est basé sur un `v-input`.
|
|
10
10
|
|
|
11
11
|
<Canvas of={SyInputSelectStories.Default} />
|
|
@@ -20,6 +20,7 @@ const meta = {
|
|
|
20
20
|
textKey: { control: 'text' },
|
|
21
21
|
valueKey: { control: 'text' },
|
|
22
22
|
vuetifyOptions: { control: 'object' },
|
|
23
|
+
displayAsterisk: { control: 'boolean' },
|
|
23
24
|
},
|
|
24
25
|
} as Meta<typeof SyInputSelect>
|
|
25
26
|
|
|
@@ -149,6 +150,70 @@ export const Required: Story = {
|
|
|
149
150
|
},
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
export const RequiredWithAsterisk: Story = {
|
|
154
|
+
parameters: {
|
|
155
|
+
docs: {
|
|
156
|
+
description: {
|
|
157
|
+
story: 'Version du champ de sélection requis avec un astérisque visuel.',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
sourceCode: [
|
|
161
|
+
{
|
|
162
|
+
name: 'Template',
|
|
163
|
+
code: `
|
|
164
|
+
<template>
|
|
165
|
+
<SyInputSelect
|
|
166
|
+
v-model="value"
|
|
167
|
+
:items="items"
|
|
168
|
+
label="Sélectionnez une option"
|
|
169
|
+
required
|
|
170
|
+
display-asterisk
|
|
171
|
+
/>
|
|
172
|
+
</template>
|
|
173
|
+
`,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'Script',
|
|
177
|
+
code: `
|
|
178
|
+
<script setup lang="ts">
|
|
179
|
+
import { ref } from 'vue'
|
|
180
|
+
import SyInputSelect from '@cnamts/synapse'
|
|
181
|
+
|
|
182
|
+
const value = ref('')
|
|
183
|
+
const items = [
|
|
184
|
+
{ text: 'Option 1', value: '1' },
|
|
185
|
+
{ text: 'Option 2', value: '2' },
|
|
186
|
+
]
|
|
187
|
+
</script>
|
|
188
|
+
`,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
args: {
|
|
193
|
+
...Default.args,
|
|
194
|
+
label: 'Sélectionnez une option',
|
|
195
|
+
required: true,
|
|
196
|
+
displayAsterisk: true,
|
|
197
|
+
},
|
|
198
|
+
render: (args) => {
|
|
199
|
+
return {
|
|
200
|
+
components: { SyInputSelect },
|
|
201
|
+
setup() {
|
|
202
|
+
return { args }
|
|
203
|
+
},
|
|
204
|
+
template: `
|
|
205
|
+
<div class="pa-4">
|
|
206
|
+
<SyInputSelect
|
|
207
|
+
v-bind="args"
|
|
208
|
+
:required="args.required"
|
|
209
|
+
:display-asterisk="args.displayAsterisk"
|
|
210
|
+
/>
|
|
211
|
+
</div>
|
|
212
|
+
`,
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
}
|
|
216
|
+
|
|
152
217
|
export const withCustomError: Story = {
|
|
153
218
|
parameters: {
|
|
154
219
|
sourceCode: [
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
required?: boolean
|
|
15
15
|
errorMessages?: string | string[]
|
|
16
16
|
isHeaderToolbar?: boolean
|
|
17
|
+
displayAsterisk?: boolean
|
|
17
18
|
}>(), {
|
|
18
19
|
modelValue: null,
|
|
19
20
|
items: () => [],
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
required: false,
|
|
25
26
|
errorMessages: () => [],
|
|
26
27
|
isHeaderToolbar: false,
|
|
28
|
+
displayAsterisk: false,
|
|
27
29
|
})
|
|
28
30
|
|
|
29
31
|
const options = useCustomizableOptions(defaultOptions, props)
|
|
@@ -65,7 +67,15 @@
|
|
|
65
67
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
66
68
|
return (selectedItem.value as Record<string, any>)[props.textKey]
|
|
67
69
|
}
|
|
68
|
-
return
|
|
70
|
+
return labelWithAsterisk.value
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
const isShouldDisplayAsterisk = computed(() => {
|
|
74
|
+
return props.displayAsterisk && props.required
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
const labelWithAsterisk = computed(() => {
|
|
78
|
+
return isShouldDisplayAsterisk.value ? `${props.label} *` : props.label
|
|
69
79
|
})
|
|
70
80
|
|
|
71
81
|
watch(() => props.modelValue, (newValue) => {
|
|
@@ -144,8 +154,8 @@
|
|
|
144
154
|
:id="inputId"
|
|
145
155
|
v-model="selectedItem"
|
|
146
156
|
:error-messages="localErrorMessages"
|
|
147
|
-
:label="
|
|
148
|
-
:title="
|
|
157
|
+
:label="labelWithAsterisk"
|
|
158
|
+
:title="labelWithAsterisk"
|
|
149
159
|
role="menu"
|
|
150
160
|
@click="checkForErrors"
|
|
151
161
|
>
|
|
@@ -5,7 +5,7 @@ import * as SySelectStories from "./SySelect.stories";
|
|
|
5
5
|
|
|
6
6
|
# SySelect
|
|
7
7
|
|
|
8
|
-
Le composant `SySelect` est utilisé pour proposer une alternative au `v-select` de Vuetify qui ne respecte pas les règles d'accessibilité RGAA
|
|
8
|
+
Le composant `SySelect` est utilisé pour proposer une alternative au `v-select` de Vuetify qui ne respecte pas les règles d'accessibilité <abbr title="Référentiel Général d’Amélioration de l’Accessibilité">RGAA</abbr>.<br/>
|
|
9
9
|
Il est basé sur un `v-textfield`.
|
|
10
10
|
|
|
11
11
|
<Canvas of={SySelectStories.Default} />
|
|
@@ -3,6 +3,7 @@ import SySelect from '@/components/Customs/SySelect/SySelect.vue'
|
|
|
3
3
|
import SyAlert from '@/components/SyAlert/SyAlert.vue'
|
|
4
4
|
import { VBtn, VMenu, VList, VListItem, VListItemTitle } from 'vuetify/components'
|
|
5
5
|
import { ref } from 'vue'
|
|
6
|
+
import { fn } from '@storybook/test'
|
|
6
7
|
|
|
7
8
|
const meta: Meta<typeof SySelect> = {
|
|
8
9
|
title: 'Composants/Formulaires/SySelect',
|
|
@@ -16,6 +17,19 @@ const meta: Meta<typeof SySelect> = {
|
|
|
16
17
|
items: { control: 'object' },
|
|
17
18
|
errorMessages: { control: 'object' },
|
|
18
19
|
required: { control: 'boolean' },
|
|
20
|
+
displayAsterisk: { control: 'boolean' },
|
|
21
|
+
textKey: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Nom de la propriété qui contient le texte à afficher',
|
|
24
|
+
},
|
|
25
|
+
valueKey: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Nom de la propriété qui contient la valeur à retourner',
|
|
28
|
+
},
|
|
29
|
+
returnObject: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'Retourne l\'objet complet sélectionné',
|
|
32
|
+
},
|
|
19
33
|
},
|
|
20
34
|
} as Meta<typeof SySelect>
|
|
21
35
|
|
|
@@ -52,10 +66,11 @@ export const Default: Story = {
|
|
|
52
66
|
],
|
|
53
67
|
},
|
|
54
68
|
args: {
|
|
55
|
-
items: [
|
|
69
|
+
'items': [
|
|
56
70
|
{ text: 'Option 1', value: '1' },
|
|
57
71
|
{ text: 'Option 2', value: '2' },
|
|
58
72
|
],
|
|
73
|
+
'onUpdate:modelValue': fn(),
|
|
59
74
|
},
|
|
60
75
|
render: (args) => {
|
|
61
76
|
return {
|
|
@@ -106,11 +121,12 @@ export const Required: Story = {
|
|
|
106
121
|
],
|
|
107
122
|
},
|
|
108
123
|
args: {
|
|
109
|
-
items: [
|
|
124
|
+
'items': [
|
|
110
125
|
{ text: 'Option 1', value: '1' },
|
|
111
126
|
{ text: 'Option 2', value: '2' },
|
|
112
127
|
],
|
|
113
|
-
required: true,
|
|
128
|
+
'required': true,
|
|
129
|
+
'onUpdate:modelValue': fn(),
|
|
114
130
|
},
|
|
115
131
|
render: (args) => {
|
|
116
132
|
return {
|
|
@@ -130,6 +146,71 @@ export const Required: Story = {
|
|
|
130
146
|
},
|
|
131
147
|
}
|
|
132
148
|
|
|
149
|
+
export const RequiredWithAsterisk: Story = {
|
|
150
|
+
parameters: {
|
|
151
|
+
docs: {
|
|
152
|
+
description: {
|
|
153
|
+
story: 'Version du champ de sélection requis avec un astérisque visuel.',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
sourceCode: [
|
|
157
|
+
{
|
|
158
|
+
name: 'Template',
|
|
159
|
+
code: `
|
|
160
|
+
<template>
|
|
161
|
+
<SySelect
|
|
162
|
+
v-model="value"
|
|
163
|
+
:items="items"
|
|
164
|
+
label="Sélectionnez une option"
|
|
165
|
+
required
|
|
166
|
+
display-asterisk
|
|
167
|
+
/>
|
|
168
|
+
</template>
|
|
169
|
+
`,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'Script',
|
|
173
|
+
code: `
|
|
174
|
+
<script setup lang="ts">
|
|
175
|
+
import { ref } from 'vue'
|
|
176
|
+
import SySelect from '@cnamts/synapse'
|
|
177
|
+
|
|
178
|
+
const value = ref('')
|
|
179
|
+
const items = [
|
|
180
|
+
{ text: 'Option 1', value: '1' },
|
|
181
|
+
{ text: 'Option 2', value: '2' },
|
|
182
|
+
]
|
|
183
|
+
</script>
|
|
184
|
+
`,
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
args: {
|
|
189
|
+
...Default.args,
|
|
190
|
+
'label': 'Sélectionnez une option',
|
|
191
|
+
'required': true,
|
|
192
|
+
'displayAsterisk': true,
|
|
193
|
+
'onUpdate:modelValue': fn(),
|
|
194
|
+
},
|
|
195
|
+
render: (args) => {
|
|
196
|
+
return {
|
|
197
|
+
components: { SySelect },
|
|
198
|
+
setup() {
|
|
199
|
+
return { args }
|
|
200
|
+
},
|
|
201
|
+
template: `
|
|
202
|
+
<div class="pa-4">
|
|
203
|
+
<SySelect
|
|
204
|
+
v-bind="args"
|
|
205
|
+
:required="args.required"
|
|
206
|
+
:display-asterisk="args.displayAsterisk"
|
|
207
|
+
/>
|
|
208
|
+
</div>
|
|
209
|
+
`,
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
|
|
133
214
|
export const withCustomError: Story = {
|
|
134
215
|
parameters: {
|
|
135
216
|
sourceCode: [
|
|
@@ -171,10 +252,11 @@ export const withCustomError: Story = {
|
|
|
171
252
|
],
|
|
172
253
|
},
|
|
173
254
|
args: {
|
|
174
|
-
items: [
|
|
255
|
+
'items': [
|
|
175
256
|
{ text: 'Option 1', value: '1' },
|
|
176
257
|
{ text: 'Option 2', value: '2' },
|
|
177
258
|
],
|
|
259
|
+
'onUpdate:modelValue': fn(),
|
|
178
260
|
},
|
|
179
261
|
render: (args) => {
|
|
180
262
|
return {
|
|
@@ -235,10 +317,11 @@ export const withCustomKey: Story = {
|
|
|
235
317
|
],
|
|
236
318
|
},
|
|
237
319
|
args: {
|
|
238
|
-
items: [
|
|
320
|
+
'items': [
|
|
239
321
|
{ customKey: 'Choix 1', value: '1' },
|
|
240
322
|
{ customKey: 'Choix 2', value: '2' },
|
|
241
323
|
],
|
|
324
|
+
'onUpdate:modelValue': fn(),
|
|
242
325
|
},
|
|
243
326
|
render: (args) => {
|
|
244
327
|
return {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
label: {
|
|
16
16
|
type: String,
|
|
17
|
-
default: '',
|
|
17
|
+
default: 'Sélectionnez une option',
|
|
18
18
|
},
|
|
19
19
|
errorMessages: {
|
|
20
20
|
type: [String, Array] as PropType<string | readonly string[]>,
|
|
@@ -44,6 +44,18 @@
|
|
|
44
44
|
type: String,
|
|
45
45
|
default: 'value',
|
|
46
46
|
},
|
|
47
|
+
displayAsterisk: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
returnObject: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
disableErrorHandling: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
47
59
|
})
|
|
48
60
|
|
|
49
61
|
const emit = defineEmits(['update:modelValue'])
|
|
@@ -65,8 +77,14 @@
|
|
|
65
77
|
|
|
66
78
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
67
79
|
const selectItem = (item: any) => {
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
if (props.returnObject) {
|
|
81
|
+
selectedItem.value = item
|
|
82
|
+
emit('update:modelValue', item)
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
selectedItem.value = item[props.valueKey]
|
|
86
|
+
emit('update:modelValue', item[props.valueKey])
|
|
87
|
+
}
|
|
70
88
|
isOpen.value = false
|
|
71
89
|
}
|
|
72
90
|
|
|
@@ -76,11 +94,22 @@
|
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
const selectedItemText = computed(() => {
|
|
79
|
-
if (selectedItem.value
|
|
80
|
-
|
|
81
|
-
|
|
97
|
+
if (selectedItem.value) {
|
|
98
|
+
if (props.returnObject) {
|
|
99
|
+
return (selectedItem.value as Record<string, unknown>)[props.textKey]
|
|
100
|
+
}
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
return props.items.find((item: any) => item[props.valueKey] === selectedItem.value)?.[props.textKey]
|
|
82
103
|
}
|
|
83
|
-
return
|
|
104
|
+
return ''
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const isShouldDisplayAsterisk = computed(() => {
|
|
108
|
+
return props.displayAsterisk && props.required
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const labelWithAsterisk = computed(() => {
|
|
112
|
+
return isShouldDisplayAsterisk.value ? `${props.label} *` : props.label
|
|
84
113
|
})
|
|
85
114
|
|
|
86
115
|
const formattedItems = computed(() => {
|
|
@@ -93,6 +122,8 @@
|
|
|
93
122
|
})
|
|
94
123
|
|
|
95
124
|
const isRequired = computed(() => {
|
|
125
|
+
// Si la gestion des erreurs est désactivée, on ne considère jamais le champ comme requis
|
|
126
|
+
if (props.disableErrorHandling) return false
|
|
96
127
|
return (props.required || props.errorMessages.length > 0) && !selectedItem.value
|
|
97
128
|
})
|
|
98
129
|
|
|
@@ -104,7 +135,13 @@
|
|
|
104
135
|
|
|
105
136
|
watch([isOpen, hasError], ([newIsOpen, newHasError]) => {
|
|
106
137
|
if (!newIsOpen) {
|
|
107
|
-
|
|
138
|
+
// Si la gestion des erreurs est désactivée, on ne met jamais hasError à true
|
|
139
|
+
if (props.disableErrorHandling) {
|
|
140
|
+
hasError.value = false
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
hasError.value = (!selectedItem.value && isRequired.value) || props.errorMessages.length > 0
|
|
144
|
+
}
|
|
108
145
|
}
|
|
109
146
|
else {
|
|
110
147
|
hasError.value = newHasError
|
|
@@ -112,7 +149,10 @@
|
|
|
112
149
|
})
|
|
113
150
|
|
|
114
151
|
watch(() => props.errorMessages, (newValue) => {
|
|
115
|
-
|
|
152
|
+
// Si la gestion des erreurs est désactivée, on ne met jamais hasError à true
|
|
153
|
+
if (!props.disableErrorHandling) {
|
|
154
|
+
hasError.value = newValue.length > 0
|
|
155
|
+
}
|
|
116
156
|
})
|
|
117
157
|
|
|
118
158
|
onMounted(() => {
|
|
@@ -134,16 +174,17 @@
|
|
|
134
174
|
ref="input"
|
|
135
175
|
v-model="selectedItemText"
|
|
136
176
|
v-click-outside="closeList"
|
|
137
|
-
title="
|
|
177
|
+
:title="labelWithAsterisk"
|
|
138
178
|
color="primary"
|
|
139
179
|
tabindex="0"
|
|
140
180
|
readonly
|
|
141
181
|
:disabled="disabled"
|
|
142
|
-
:label="
|
|
143
|
-
:aria-label="
|
|
144
|
-
:error-messages="errorMessages"
|
|
182
|
+
:label="labelWithAsterisk"
|
|
183
|
+
:aria-label="labelWithAsterisk"
|
|
184
|
+
:error-messages="props.disableErrorHandling ? [] : errorMessages"
|
|
145
185
|
:variant="outlined ? 'outlined' : 'underlined'"
|
|
146
|
-
:rules="isRequired ? ['Le champ est requis.'] : []"
|
|
186
|
+
:rules="isRequired && !props.disableErrorHandling ? ['Le champ est requis.'] : []"
|
|
187
|
+
:display-asterisk="displayAsterisk"
|
|
147
188
|
class="sy-select"
|
|
148
189
|
:style="hasError ? { minWidth: `${labelWidth + 18}px`} : {minWidth: `${labelWidth}px`}"
|
|
149
190
|
@click="toggleMenu"
|
|
@@ -89,7 +89,11 @@ describe('SySelect.vue', () => {
|
|
|
89
89
|
|
|
90
90
|
it('returns the correct text when selectedItem is an object', async () => {
|
|
91
91
|
const wrapper = mount(SySelect, {
|
|
92
|
-
props: {
|
|
92
|
+
props: {
|
|
93
|
+
modelValue: { text: 'Option 1', value: '1' },
|
|
94
|
+
textKey: 'text',
|
|
95
|
+
returnObject: true,
|
|
96
|
+
},
|
|
93
97
|
global: {
|
|
94
98
|
plugins: [vuetify],
|
|
95
99
|
},
|
|
@@ -100,6 +104,24 @@ describe('SySelect.vue', () => {
|
|
|
100
104
|
expect(instance.selectedItemText).toBe('Option 1')
|
|
101
105
|
})
|
|
102
106
|
|
|
107
|
+
it('returns the correct text when selectedItem is a value', async () => {
|
|
108
|
+
const wrapper = mount(SySelect, {
|
|
109
|
+
props: {
|
|
110
|
+
items: [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }],
|
|
111
|
+
modelValue: '1',
|
|
112
|
+
textKey: 'text',
|
|
113
|
+
},
|
|
114
|
+
global: {
|
|
115
|
+
plugins: [vuetify],
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
119
|
+
const instance = wrapper.vm as any
|
|
120
|
+
await wrapper.setProps({ modelValue: '2' })
|
|
121
|
+
await wrapper.vm.$nextTick()
|
|
122
|
+
expect(instance.selectedItemText).toBe('Option 2')
|
|
123
|
+
})
|
|
124
|
+
|
|
103
125
|
it('formats items correctly', () => {
|
|
104
126
|
const items = ['Option 1', 'Option 2']
|
|
105
127
|
const wrapper = mount(SySelect, {
|
|
@@ -163,7 +185,7 @@ describe('SySelect.vue', () => {
|
|
|
163
185
|
const instance = wrapper.vm as any
|
|
164
186
|
instance.selectItem({ text: 'Option 1', value: '1' })
|
|
165
187
|
await wrapper.vm.$nextTick()
|
|
166
|
-
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
|
|
188
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['1'])
|
|
167
189
|
})
|
|
168
190
|
|
|
169
191
|
it('closes the menu when v-click-outside directive is called', async () => {
|
|
@@ -190,4 +212,115 @@ describe('SySelect.vue', () => {
|
|
|
190
212
|
await wrapper.vm.closeList()
|
|
191
213
|
expect(wrapper.vm.isOpen).toBe(false)
|
|
192
214
|
})
|
|
215
|
+
|
|
216
|
+
it('emit the value when returnObject is false', async () => {
|
|
217
|
+
const wrapper = mount(SySelect, {
|
|
218
|
+
props: {
|
|
219
|
+
returnObject: false,
|
|
220
|
+
items: [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }],
|
|
221
|
+
},
|
|
222
|
+
global: {
|
|
223
|
+
plugins: [vuetify],
|
|
224
|
+
},
|
|
225
|
+
})
|
|
226
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
227
|
+
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
228
|
+
await firstItem!.trigger('click')
|
|
229
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['1'])
|
|
230
|
+
|
|
231
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
232
|
+
const secondItem = wrapper.findAll('.v-list-item').at(1)
|
|
233
|
+
await secondItem!.trigger('click')
|
|
234
|
+
expect(wrapper.emitted()['update:modelValue'][1]).toEqual(['2'])
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
it('emit the object when returnObject is true', async () => {
|
|
238
|
+
const wrapper = mount(SySelect, {
|
|
239
|
+
props: {
|
|
240
|
+
returnObject: true,
|
|
241
|
+
items: [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }],
|
|
242
|
+
},
|
|
243
|
+
global: {
|
|
244
|
+
plugins: [vuetify],
|
|
245
|
+
},
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
249
|
+
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
250
|
+
await firstItem!.trigger('click')
|
|
251
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ text: 'Option 1', value: '1' }])
|
|
252
|
+
|
|
253
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
254
|
+
const secondItem = wrapper.findAll('.v-list-item').at(1)
|
|
255
|
+
await secondItem!.trigger('click')
|
|
256
|
+
expect(wrapper.emitted()['update:modelValue'][1]).toEqual([{ text: 'Option 2', value: '2' }])
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
it('emit the value when returnObject is false with textKey and keyValue set', async () => {
|
|
260
|
+
const wrapper = mount(SySelect, {
|
|
261
|
+
props: {
|
|
262
|
+
returnObject: false,
|
|
263
|
+
textKey: 'theText',
|
|
264
|
+
valueKey: 'theValue',
|
|
265
|
+
items: [{ theText: 'Option 1', theValue: '1' }, { theText: 'Option 2', theValue: '2' }],
|
|
266
|
+
},
|
|
267
|
+
global: {
|
|
268
|
+
plugins: [vuetify],
|
|
269
|
+
},
|
|
270
|
+
})
|
|
271
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
272
|
+
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
273
|
+
await firstItem!.trigger('click')
|
|
274
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['1'])
|
|
275
|
+
|
|
276
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
277
|
+
const secondItem = wrapper.findAll('.v-list-item').at(1)
|
|
278
|
+
await secondItem!.trigger('click')
|
|
279
|
+
expect(wrapper.emitted()['update:modelValue'][1]).toEqual(['2'])
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
it('emit the object when returnObject is true with textKey and keyValue set', async () => {
|
|
283
|
+
const wrapper = mount(SySelect, {
|
|
284
|
+
props: {
|
|
285
|
+
returnObject: true,
|
|
286
|
+
textKey: 'theText',
|
|
287
|
+
valueKey: 'theValue',
|
|
288
|
+
items: [{ theText: 'Option 1', theValue: '1' }, { theText: 'Option 2', theValue: '2' }],
|
|
289
|
+
},
|
|
290
|
+
global: {
|
|
291
|
+
plugins: [vuetify],
|
|
292
|
+
},
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
296
|
+
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
297
|
+
await firstItem!.trigger('click')
|
|
298
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ theText: 'Option 1', theValue: '1' }])
|
|
299
|
+
|
|
300
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
301
|
+
const secondItem = wrapper.findAll('.v-list-item').at(1)
|
|
302
|
+
await secondItem!.trigger('click')
|
|
303
|
+
expect(wrapper.emitted()['update:modelValue'][1]).toEqual([{ theText: 'Option 2', theValue: '2' }])
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
it('emit the value when items is an array of string', async () => {
|
|
307
|
+
const wrapper = mount(SySelect, {
|
|
308
|
+
props: {
|
|
309
|
+
items: ['Option 1', 'Option 2'],
|
|
310
|
+
},
|
|
311
|
+
global: {
|
|
312
|
+
plugins: [vuetify],
|
|
313
|
+
},
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
317
|
+
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
318
|
+
await firstItem!.trigger('click')
|
|
319
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['Option 1'])
|
|
320
|
+
|
|
321
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
322
|
+
const secondItem = wrapper.findAll('.v-list-item').at(1)
|
|
323
|
+
await secondItem!.trigger('click')
|
|
324
|
+
expect(wrapper.emitted()['update:modelValue'][1]).toEqual(['Option 2'])
|
|
325
|
+
})
|
|
193
326
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Meta, Canvas, Controls, Source } from '@storybook/blocks';
|
|
2
|
-
import * as SyTextFieldStories from "./SyTextField.stories";
|
|
2
|
+
import * as SyTextFieldStories from "./SyTextField.stories.ts";
|
|
3
3
|
|
|
4
4
|
<Meta of={SyTextFieldStories} />
|
|
5
5
|
|
|
6
6
|
# SyTextField
|
|
7
7
|
|
|
8
|
-
Le composant `SyTextField` est utilisé pour proposer une alternative au `TextField` de Vuetify, conforme au style du Design System et qui respecte les règles d'accessibilité RGAA
|
|
8
|
+
Le composant `SyTextField` est utilisé pour proposer une alternative au `TextField` de Vuetify, conforme au style du Design System et qui respecte les règles d'accessibilité <abbr title="Référentiel Général d’Amélioration de l’Accessibilité">RGAA</abbr>.
|
|
9
9
|
|
|
10
10
|
Il étend les fonctionnalités de base de Vuetify avec :
|
|
11
11
|
|