@cnamts/synapse 0.0.3-alpha → 0.0.5-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.d.ts +1461 -68
- package/dist/design-system-v3.js +4775 -1673
- package/dist/design-system-v3.umd.cjs +10 -1
- package/dist/style.css +1 -1
- package/package.json +6 -2
- package/src/assets/tokens.scss +0 -1
- package/src/components/Alert/Accessibilite.mdx +14 -0
- package/src/components/Alert/Accessibilite.stories.ts +166 -0
- package/src/components/Alert/AccessibiliteItems.ts +152 -0
- package/src/components/Alert/Alert.mdx +1 -1
- package/src/components/Alert/Alert.stories.ts +91 -1
- package/src/components/Alert/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/BackBtn/Accessibilite.mdx +14 -0
- package/src/components/BackBtn/Accessibilite.stories.ts +166 -0
- package/src/components/BackBtn/AccessibiliteItems.ts +132 -0
- package/src/components/BackBtn/BackBtn.mdx +1 -1
- package/src/components/BackBtn/BackBtn.stories.ts +84 -1
- package/src/components/BackBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/BackToTopBtn/Accessibilite.mdx +14 -0
- package/src/components/BackToTopBtn/Accessibilite.stories.ts +166 -0
- package/src/components/BackToTopBtn/AccessibiliteItems.ts +82 -0
- package/src/components/BackToTopBtn/BackToTopBtn.mdx +3 -3
- package/src/components/BackToTopBtn/BackToTopBtn.stories.ts +172 -11
- package/src/components/BackToTopBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/CollapsibleList/Accessibilite.mdx +14 -0
- package/src/components/CollapsibleList/Accessibilite.stories.ts +166 -0
- package/src/components/CollapsibleList/AccessibiliteItems.ts +129 -0
- package/src/components/CollapsibleList/CollapsibleList.mdx +2 -2
- package/src/components/CollapsibleList/CollapsibleList.stories.ts +37 -1
- package/src/components/CollapsibleList/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/CopyBtn/Accessibilite.mdx +14 -0
- package/src/components/CopyBtn/Accessibilite.stories.ts +166 -0
- package/src/components/CopyBtn/AccessibiliteItems.ts +135 -0
- package/src/components/CopyBtn/CopyBtn.mdx +1 -1
- package/src/components/CopyBtn/CopyBtn.stories.ts +120 -1
- package/src/components/CopyBtn/CopyBtn.vue +1 -1
- package/src/components/CopyBtn/config.ts +2 -0
- package/src/components/CopyBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +44 -0
- package/src/components/Customs/SyBtnSelect/SyBtnSelect.stories.ts +606 -0
- package/src/components/Customs/SyBtnSelect/SyBtnSelect.vue +246 -0
- package/src/components/Customs/SyBtnSelect/tests/SyBtnSelect.spec.ts +168 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +40 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +420 -0
- package/src/components/Customs/{CustomInputSelect/CustomInputSelect.vue → SyInputSelect/SyInputSelect.vue} +89 -54
- package/src/components/Customs/SyInputSelect/config.ts +10 -0
- package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +140 -0
- package/src/components/Customs/{CustomSelect/CustomSelect.mdx → SySelect/SySelect.mdx} +10 -10
- package/src/components/Customs/SySelect/SySelect.stories.ts +338 -0
- package/src/components/Customs/{CustomSelect/CustomSelect.vue → SySelect/SySelect.vue} +34 -11
- package/src/components/Customs/{CustomInputSelect/tests/CustomInputSelect.spec.ts → SySelect/tests/SySelect.spec.ts} +48 -71
- package/src/components/Customs/SyTextField/SyTextField.mdx +44 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +403 -0
- package/src/components/Customs/SyTextField/SyTextField.vue +110 -0
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +93 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +57 -0
- package/src/components/Customs/SyTextField/types.d.ts +3 -0
- package/src/components/DataList/DataList.mdx +77 -0
- package/src/components/DataList/DataList.stories.ts +960 -0
- package/src/components/DataList/DataList.vue +140 -0
- package/src/components/DataList/DataListLoading/DataListLoading.vue +56 -0
- package/src/components/DataList/DataListLoading/tests/DataListLoading.spec.ts +23 -0
- package/src/components/DataList/locales.ts +3 -0
- package/src/components/DataList/tests/DataList.spec.ts +194 -0
- package/src/components/DataList/types.d.ts +23 -0
- package/src/components/DataListGroup/DataListGroup.mdx +77 -0
- package/src/components/DataListGroup/DataListGroup.stories.ts +987 -0
- package/src/components/DataListGroup/DataListGroup.vue +59 -0
- package/src/components/DataListGroup/tests/DataListGroup.spec.ts +54 -0
- package/src/components/DataListGroup/tests/data/dataListGroupItems.ts +41 -0
- package/src/components/DataListGroup/types.d.ts +15 -0
- package/src/components/DataListItem/DataListItem.vue +135 -0
- package/src/components/DataListItem/config.ts +17 -0
- package/src/components/DataListItem/locales.ts +3 -0
- package/src/components/DataListItem/tests/DataListItem.spec.ts +156 -0
- package/src/components/DataListItem/types.d.ts +23 -0
- package/src/components/DialogBox/DialogBox.mdx +14 -0
- package/src/components/DialogBox/DialogBox.stories.ts +798 -0
- package/src/components/DialogBox/DialogBox.vue +181 -0
- package/src/components/DialogBox/config.ts +25 -0
- package/src/components/DialogBox/locales.ts +5 -0
- package/src/components/DialogBox/tests/DialogBox.spec.ts +329 -0
- package/src/components/DialogBox/tests/__snapshots__/DialogBox.spec.ts.snap +46 -0
- package/src/components/DownloadBtn/Accessibilite.mdx +14 -0
- package/src/components/DownloadBtn/Accessibilite.stories.ts +166 -0
- package/src/components/DownloadBtn/AccessibiliteItems.ts +129 -0
- package/src/components/DownloadBtn/DownloadBtn.mdx +5 -6
- package/src/components/DownloadBtn/DownloadBtn.stories.ts +207 -2
- package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/ErrorPage/ErrorPage.mdx +21 -0
- package/src/components/ErrorPage/ErrorPage.stories.ts +133 -0
- package/src/components/ErrorPage/ErrorPage.vue +93 -0
- package/src/components/ErrorPage/locales.ts +5 -0
- package/src/components/ErrorPage/tests/ErrorPage.spec.ts +40 -0
- package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +78 -0
- package/src/components/FooterBar/FooterBar.mdx +2 -2
- package/src/components/FooterBar/FooterBar.stories.ts +557 -9
- package/src/components/FooterBar/config.ts +2 -3
- package/src/components/FooterBar/tests/FooterBar.spec.ts +1 -1
- package/src/components/FooterBar/tests/FooterBarConfig.spec.ts +1 -1
- package/src/components/FooterBar/tests/__snapshots__/FooterBar.spec.ts.snap +2 -2
- package/src/components/FranceConnectBtn/Accessibilite.mdx +14 -0
- package/src/components/FranceConnectBtn/Accessibilite.stories.ts +194 -0
- package/src/components/FranceConnectBtn/AccessibiliteItems.ts +199 -0
- package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +1 -1
- package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +58 -1
- package/src/components/FranceConnectBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/HeaderBar/HeaderBar.mdx +164 -45
- package/src/components/HeaderBar/HeaderBar.stories.ts +618 -16
- package/src/components/HeaderBar/HeaderBar.vue +60 -22
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.mdx +433 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.stories.ts +1089 -0
- package/src/components/HeaderBar/{HeaderComplexMenu/HeaderComplexMenu.vue → HeaderBurgerMenu/HeaderBurgerMenu.vue} +74 -45
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.mdx +38 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +89 -0
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/__snapshots__/HeaderMenuItem.spec.ts.snap +1 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.mdx +17 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +121 -0
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/HeaderMenuSection.vue +2 -2
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/tests/HeaderMenuSection.spec.ts +1 -3
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.mdx +43 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +261 -0
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/HeaderSubMenu.vue +17 -3
- package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/tests/HeaderSubMenu.spec.ts +1 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +180 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderBurgerMenu.spec.ts.snap +13 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +13 -0
- package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +62 -25
- package/src/components/HeaderBar/HeaderLogo/tests/HeaderLogo.spec.ts +49 -1
- package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +19 -23
- package/src/components/HeaderBar/HeaderMenuBtn/tests/HeaderMenuBtn.spec.ts +70 -0
- package/src/components/HeaderBar/Usages.mdx +85 -0
- package/src/components/HeaderBar/consts.scss +0 -1
- package/src/components/HeaderBar/tests/HeaderBar.spec.ts +8 -2
- package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +5 -10
- package/src/components/HeaderLoading/HeaderLoading.mdx +28 -0
- package/src/components/HeaderLoading/HeaderLoading.stories.ts +62 -0
- package/src/components/HeaderLoading/HeaderLoading.vue +45 -0
- package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +22 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +128 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +784 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +194 -0
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +74 -0
- package/src/components/HeaderNavigationBar/HorizontalNavbar/config.ts +18 -0
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +127 -0
- package/src/components/HeaderNavigationBar/types.ts +7 -0
- package/src/components/HeaderToolbar/HeaderToolbar.mdx +31 -0
- package/src/components/HeaderToolbar/HeaderToolbar.stories.ts +343 -0
- package/src/components/HeaderToolbar/HeaderToolbar.vue +487 -0
- package/src/components/HeaderToolbar/tests/HeaderToolbar.spec.ts +230 -0
- package/src/components/HeaderToolbar/types.d.ts +20 -0
- package/src/components/LangBtn/Accessibilite.mdx +14 -0
- package/src/components/LangBtn/Accessibilite.stories.ts +166 -0
- package/src/components/LangBtn/AccessibiliteItems.ts +132 -0
- package/src/components/LangBtn/LangBtn.mdx +1 -1
- package/src/components/LangBtn/LangBtn.stories.ts +125 -8
- package/src/components/LangBtn/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/LangBtn/tests/LangBtn.spec.ts +1 -1
- package/src/components/LangBtn/tests/__snapshots__/LangBtn.spec.ts.snap +1 -1
- package/src/components/Logo/Logo.mdx +2 -2
- package/src/components/Logo/Logo.stories.ts +147 -1
- package/src/components/LogoBrandSection/LogoBrandSection.mdx +14 -0
- package/src/components/LogoBrandSection/LogoBrandSection.stories.ts +158 -0
- package/src/components/LogoBrandSection/LogoBrandSection.vue +312 -0
- package/src/components/LogoBrandSection/assets/ameli-pro.svg +1 -0
- package/src/components/LogoBrandSection/assets/ameli.svg +1 -0
- package/src/components/LogoBrandSection/assets/cnam.svg +1 -0
- package/src/components/LogoBrandSection/assets/compte-ameli.svg +1 -0
- package/src/components/LogoBrandSection/dividerDimensionsMapping.ts +14 -0
- package/src/components/LogoBrandSection/locales.ts +14 -0
- package/src/components/LogoBrandSection/secondaryLogoMapping.ts +24 -0
- package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +365 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +14 -0
- package/src/components/LogoBrandSection/types.ts +8 -0
- package/src/components/MaintenancePage/MaintenancePage.mdx +11 -0
- package/src/components/MaintenancePage/MaintenancePage.stories.ts +41 -0
- package/src/components/MaintenancePage/MaintenancePage.vue +25 -0
- package/src/components/MaintenancePage/assets/maintenance.svg +1 -0
- package/src/components/MaintenancePage/index.ts +3 -0
- package/src/components/MaintenancePage/locales.ts +5 -0
- package/src/components/MaintenancePage/tests/MaintenancePage.spec.ts +12 -0
- package/src/components/MaintenancePage/tests/__snapshots__/MaintenancePage.spec.ts.snap +3 -0
- package/src/components/NotFoundPage/NotFoundPage.mdx +19 -0
- package/src/components/NotFoundPage/NotFoundPage.stories.ts +76 -0
- package/src/components/NotFoundPage/NotFoundPage.vue +52 -0
- package/src/components/NotFoundPage/assets/not-found.svg +1 -0
- package/src/components/NotFoundPage/locales.ts +6 -0
- package/src/components/NotFoundPage/tests/NotFoundPage.spec.ts +38 -0
- package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +76 -0
- package/src/components/NotificationBar/Accessibilite.mdx +14 -0
- package/src/components/NotificationBar/Accessibilite.stories.ts +166 -0
- package/src/components/NotificationBar/AccessibiliteItems.ts +174 -0
- package/src/components/NotificationBar/NotificationBar.mdx +6 -6
- package/src/components/NotificationBar/NotificationBar.stories.ts +1 -1
- package/src/components/NotificationBar/NotificationBar.vue +2 -2
- package/src/components/NotificationBar/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/NotificationBar/options.ts +1 -0
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +1 -1
- package/src/components/PageContainer/Accessibilite.mdx +14 -0
- package/src/components/PageContainer/Accessibilite.stories.ts +166 -0
- package/src/components/PageContainer/AccessibiliteItems.ts +52 -0
- package/src/components/PageContainer/PageContainer.mdx +1 -1
- package/src/components/PageContainer/PageContainer.stories.ts +86 -1
- package/src/components/PageContainer/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/PhoneField/PhoneField.mdx +49 -0
- package/src/components/PhoneField/PhoneField.stories.ts +869 -0
- package/src/components/PhoneField/PhoneField.vue +230 -0
- package/src/components/PhoneField/indicatifs.ts +104 -0
- package/src/components/PhoneField/locales.ts +4 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +179 -0
- package/src/components/SkipLink/Accessibilite.mdx +14 -0
- package/src/components/SkipLink/Accessibilite.stories.ts +167 -0
- package/src/components/SkipLink/AccessibiliteItems.ts +77 -0
- package/src/components/SkipLink/SkipLink.stories.ts +50 -1
- package/src/components/SkipLink/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +33 -2
- package/src/components/SocialMediaLinks/SocialMediaLinks.stories.ts +38 -1
- package/src/components/SocialMediaLinks/tests/SocialMediaLinks.spec.ts +1 -1
- package/src/components/SocialMediaLinks/tests/__snapshots__/SocialMediaLinks.spec.ts.snap +2 -2
- package/src/components/SubHeader/SubHeader.mdx +31 -0
- package/src/components/SubHeader/SubHeader.stories.ts +1032 -0
- package/src/components/SubHeader/SubHeader.vue +185 -0
- package/src/components/SubHeader/config.ts +12 -0
- package/src/components/SubHeader/locales.ts +3 -0
- package/src/components/SubHeader/tests/SubHeader.spec.ts +144 -0
- package/src/components/UserMenuBtn/UserMenuBtn.mdx +35 -0
- package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +438 -0
- package/src/components/UserMenuBtn/UserMenuBtn.vue +105 -0
- package/src/components/UserMenuBtn/config.ts +24 -0
- package/src/components/UserMenuBtn/tests/UserMenuBtn.spec.ts +125 -0
- package/src/components/index.ts +33 -7
- package/src/composables/index.ts +8 -0
- package/src/composables/rules/tests/useFieldValidation.spec.ts +82 -0
- package/src/composables/rules/useFieldValidation.ts +53 -0
- package/src/composables/widthable/index.ts +29 -0
- package/src/composables/widthable/tests/widthable.spec.ts +52 -0
- package/src/designTokens/index.ts +2 -0
- package/src/designTokens/tokens/cnam/cnamDarkTheme.ts +5 -0
- package/src/designTokens/tokens/cnam/cnamLightTheme.ts +3 -2
- package/src/main.ts +3 -0
- package/src/modules.d.ts +4 -0
- package/src/services/index.ts +1 -0
- package/src/stories/Demarrer/Accueil.mdx +10 -0
- package/src/stories/Demarrer/Accueil.stories.ts +76 -0
- package/src/stories/Demarrer/PolitiqueDeConfidentialite.mdx +9 -0
- package/src/stories/Demarrer/PolitiqueDeConfidentialite.stories.ts +20 -0
- package/src/stories/Fondamentaux/Arrondis.mdx +24 -0
- package/src/stories/{Guidelines → Fondamentaux}/Colors.mdx +1 -1
- package/src/stories/Fondamentaux/Conteneurs.mdx +7 -0
- package/src/stories/Fondamentaux/CustomisationEtThemes.mdx +7 -0
- package/src/stories/Fondamentaux/Elevations.mdx +14 -0
- package/src/stories/Fondamentaux/Espacements.mdx +29 -0
- package/src/stories/{Guidelines → Fondamentaux}/Introduction.mdx +1 -1
- package/src/stories/Fondamentaux/StylesTypographiques.mdx +33 -0
- package/src/stories/Fondamentaux/Typographie.mdx +58 -0
- package/src/stories/GuideDuDev/CommentUtiliserLesRules.mdx +132 -0
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +52 -48
- package/src/stories/GuideDuDev/vuetifyOptions.mdx +31 -28
- package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/Accessibilite.mdx +1 -2
- package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/Accessibilite.stories.ts +1 -1
- package/src/stories/{Fondamentaux → Guidelines}/EcoConception/Econception.stories.ts +2 -2
- package/src/utils/functions/throttleDisplayFn/tests/throttleDisplayFn.spec.ts +47 -0
- package/src/utils/functions/throttleDisplayFn/throttleDisplayFn.ts +26 -0
- package/src/utils/rules/exactLength/index.ts +33 -0
- package/src/utils/rules/exactLength/locales.ts +6 -0
- package/src/utils/rules/required/index.ts +25 -0
- package/src/utils/rules/required/locales.ts +5 -0
- package/src/utils/rules/required/ruleMessageHelper.ts +14 -0
- package/src/utils/rules/required/tests/index.spec.ts +47 -0
- package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +22 -0
- package/src/utils/rules/types.d.ts +15 -0
- package/src/components/Beta/beta.mdx +0 -5
- package/src/components/Customs/CustomInputSelect/CustomInputSelect.mdx +0 -42
- package/src/components/Customs/CustomInputSelect/CustomInputSelect.stories.ts +0 -154
- package/src/components/Customs/CustomSelect/CustomSelect.stories.ts +0 -182
- package/src/components/Customs/CustomSelect/tests/CustomSelect.spec.ts +0 -236
- package/src/components/Deprecated/deprecated.mdx +0 -5
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderComplexMenu.stories.ts +0 -272
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +0 -49
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +0 -56
- package/src/components/HeaderBar/HeaderComplexMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +0 -137
- package/src/components/HeaderBar/HeaderComplexMenu/tests/HeaderComplexMenu.spec.ts +0 -129
- package/src/components/HeaderBar/HeaderComplexMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +0 -18
- package/src/stories/Guidelines/CustomisationEtThemes.mdx +0 -3
- package/src/stories/Guidelines/Typo.mdx +0 -53
- package/src/stories/Home/Accueil.mdx +0 -7
- package/src/stories/Home/PolitiqueDeConfidentialite.mdx +0 -4
- package/src/stories/Home/synapse.webp +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/HeaderMenuItem.vue +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/HeaderMenuItem.spec.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/conts.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/locals.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/tests/useHandleSubMenus.spec.ts +0 -0
- /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/useHandleSubMenus.ts +0 -0
- /package/src/components/Logo/{types.d.ts → types.ts} +0 -0
- /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/AccessibiliteItems.ts +0 -0
- /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/constants/ExpertiseLevelEnum.ts +0 -0
- /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/constants/RGAALevelEnum.ts +0 -0
- /package/src/stories/{Fondamentaux → Guidelines}/EcoConception/EcoConception.mdx +0 -0
- /package/src/stories/{Fondamentaux → Guidelines}/EcoConception/ecoDesignItems.ts +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ruleMessage } from '../ruleMessageHelper'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
|
|
4
|
+
describe('ruleMessage', () => {
|
|
5
|
+
it('returns the correct message for a string error message', () => {
|
|
6
|
+
const errorMessages = { required: 'This field is required' }
|
|
7
|
+
const result = ruleMessage(errorMessages, 'required')
|
|
8
|
+
expect(result).toBe('This field is required')
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('returns the correct message for a function error message', () => {
|
|
12
|
+
const errorMessages = { minLength: (min: number) => `Minimum length is ${min}` }
|
|
13
|
+
const result = ruleMessage(errorMessages, 'minLength', [5])
|
|
14
|
+
expect(result).toBe('Minimum length is 5')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('handles multiple arguments for a function error message', () => {
|
|
18
|
+
const errorMessages = { range: (min: number, max: number) => `Value must be between ${min} and ${max}` }
|
|
19
|
+
const result = ruleMessage(errorMessages, 'range', [1, 10])
|
|
20
|
+
expect(result).toBe('Value must be between 1 and 10')
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Value = string | null
|
|
2
|
+
export type ValidationResult = string | boolean
|
|
3
|
+
export type ValidationRule<T = Value> = (value: T) => ValidationResult
|
|
4
|
+
|
|
5
|
+
export interface ValidationRules {
|
|
6
|
+
[key: string]: ValidationRule
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type GenericFnOpt<T> = (arg?: T) => string
|
|
10
|
+
export type GenericFn<T> = (arg: T) => string
|
|
11
|
+
|
|
12
|
+
export interface ErrorMessages<T = string> {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
14
|
+
[key: string]: GenericFn<T> | GenericFnOpt<T> | any
|
|
15
|
+
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Controls, Story, Source } from '@storybook/blocks';
|
|
2
|
-
import * as CustomInputSelectStories from "./CustomInputSelect.stories.ts";
|
|
3
|
-
|
|
4
|
-
<Meta of={CustomInputSelectStories} />
|
|
5
|
-
|
|
6
|
-
# CustomSelect
|
|
7
|
-
|
|
8
|
-
Le composant `CustomInputSelect` est utilisé pour proposer une alternative au `v-select` de Vuetify qui ne respecte pas les règles RGAA.
|
|
9
|
-
|
|
10
|
-
<Canvas of={CustomInputSelectStories.Default} />
|
|
11
|
-
|
|
12
|
-
<Story of={CustomInputSelectStories.Info} />
|
|
13
|
-
|
|
14
|
-
# API
|
|
15
|
-
|
|
16
|
-
<Controls of={CustomInputSelectStories.Default} />
|
|
17
|
-
|
|
18
|
-
# Exemple d'utilisation
|
|
19
|
-
|
|
20
|
-
<Source dark code={`
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
import CustomInputSelect from '@/components/Customs/CustomInputSelect/CustomInputSelect.vue'
|
|
23
|
-
import { ref } from 'vue'
|
|
24
|
-
|
|
25
|
-
const value = ref('fr')
|
|
26
|
-
const items = ['fr', 'en', 'co']
|
|
27
|
-
const ariaLabel = 'Choix de la langue'
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<main>
|
|
32
|
-
<div class="mt-12 ml-12">
|
|
33
|
-
<CustomInputSelect
|
|
34
|
-
v-model="value"
|
|
35
|
-
:items="items"
|
|
36
|
-
:label="ariaLabel"
|
|
37
|
-
aria-label="Choix de la langue"
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
|
-
</main>
|
|
41
|
-
</template>
|
|
42
|
-
`} />
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import CustomInputSelect from './CustomInputSelect.vue'
|
|
3
|
-
import { VBtn, VMenu, VList, VListItem, VListItemTitle } from 'vuetify/components'
|
|
4
|
-
import { ref } from 'vue'
|
|
5
|
-
import Alert from '../../Alert/Alert.vue'
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components/CustomInputSelect',
|
|
9
|
-
component: CustomInputSelect,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'fullscreen',
|
|
12
|
-
controls: { exclude: ['selectedValue'] },
|
|
13
|
-
},
|
|
14
|
-
argTypes: {
|
|
15
|
-
selectedValue: { control: 'text' },
|
|
16
|
-
items: { control: 'object' },
|
|
17
|
-
errorMessages: { control: 'object' },
|
|
18
|
-
},
|
|
19
|
-
} as Meta<typeof CustomInputSelect>
|
|
20
|
-
|
|
21
|
-
export default meta
|
|
22
|
-
|
|
23
|
-
type Story = StoryObj<typeof meta>
|
|
24
|
-
export const Default: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
items: [
|
|
27
|
-
{ text: 'Option 1', value: '1' },
|
|
28
|
-
{ text: 'Option 2', value: '2' },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
render: (args) => {
|
|
32
|
-
return {
|
|
33
|
-
components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
34
|
-
setup() {
|
|
35
|
-
return { args }
|
|
36
|
-
},
|
|
37
|
-
template: `
|
|
38
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
39
|
-
<CustomInputSelect
|
|
40
|
-
v-bind="args"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
<br/><br/><br/><br/>
|
|
44
|
-
`,
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const Outlined: Story = {
|
|
50
|
-
args: {
|
|
51
|
-
items: [
|
|
52
|
-
{ text: 'Option 1', value: '1' },
|
|
53
|
-
{ text: 'Option 2', value: '2' },
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
render: (args) => {
|
|
57
|
-
return {
|
|
58
|
-
components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
59
|
-
setup() {
|
|
60
|
-
return { args }
|
|
61
|
-
},
|
|
62
|
-
template: `
|
|
63
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
64
|
-
<CustomInputSelect
|
|
65
|
-
v-bind="args"
|
|
66
|
-
outlined
|
|
67
|
-
/>
|
|
68
|
-
</div>
|
|
69
|
-
`,
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const withError: Story = {
|
|
75
|
-
args: {
|
|
76
|
-
items: [
|
|
77
|
-
{ text: 'Option 1', value: '1' },
|
|
78
|
-
{ text: 'Option 2', value: '2' },
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
render: (args) => {
|
|
82
|
-
return {
|
|
83
|
-
components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
84
|
-
setup() {
|
|
85
|
-
const errorMessages = ref([])
|
|
86
|
-
const triggerError = () => {
|
|
87
|
-
// @ts-expect-error test error message
|
|
88
|
-
errorMessages.value = ['This is a test error message']
|
|
89
|
-
}
|
|
90
|
-
return { args, errorMessages, triggerError }
|
|
91
|
-
},
|
|
92
|
-
template: `
|
|
93
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
94
|
-
<CustomInputSelect
|
|
95
|
-
v-bind="args"
|
|
96
|
-
:error-messages="errorMessages"
|
|
97
|
-
/>
|
|
98
|
-
<VBtn @click="triggerError">
|
|
99
|
-
Trigger Error
|
|
100
|
-
</VBtn>
|
|
101
|
-
</div>
|
|
102
|
-
`,
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export const withCustomKey: Story = {
|
|
108
|
-
args: {
|
|
109
|
-
items: [
|
|
110
|
-
{ customKey: 'Option 1', value: '1' },
|
|
111
|
-
{ customKey: 'Option 2', value: '2' },
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
render: (args) => {
|
|
115
|
-
return {
|
|
116
|
-
components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
117
|
-
setup() {
|
|
118
|
-
return { args }
|
|
119
|
-
},
|
|
120
|
-
template: `
|
|
121
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
122
|
-
<CustomInputSelect
|
|
123
|
-
v-bind="args"
|
|
124
|
-
outlined
|
|
125
|
-
text-key="customKey"
|
|
126
|
-
/>
|
|
127
|
-
</div>
|
|
128
|
-
`,
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export const Info: Story = {
|
|
134
|
-
render: (args) => {
|
|
135
|
-
return {
|
|
136
|
-
components: { Alert },
|
|
137
|
-
setup() {
|
|
138
|
-
return { args }
|
|
139
|
-
},
|
|
140
|
-
template: `
|
|
141
|
-
<Alert v-model="args.modelValue" :type="args.type" :variant="tonal" :closable="false">
|
|
142
|
-
<template #default>
|
|
143
|
-
<b>Format des items :</b>
|
|
144
|
-
<ul>
|
|
145
|
-
<li>- Si les items passés en props sont des objets, le composant les utilisera directement.</li>
|
|
146
|
-
<li>- Si les items sont un tableau de string, le composant les utilisera directement.</li>
|
|
147
|
-
</ul>
|
|
148
|
-
</template>
|
|
149
|
-
</Alert>
|
|
150
|
-
`,
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
tags: ['!dev'],
|
|
154
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
-
import CustomSelect from '@/components/Customs/CustomSelect/CustomSelect.vue'
|
|
3
|
-
import { VBtn, VMenu, VList, VListItem, VListItemTitle } from 'vuetify/components'
|
|
4
|
-
import { ref } from 'vue'
|
|
5
|
-
import Alert from '../../Alert/Alert.vue'
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components/CustomSelect',
|
|
9
|
-
component: CustomSelect,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'fullscreen',
|
|
12
|
-
controls: { exclude: ['selectedValue'] },
|
|
13
|
-
},
|
|
14
|
-
argTypes: {
|
|
15
|
-
selectedValue: { control: 'text' },
|
|
16
|
-
items: { control: 'object' },
|
|
17
|
-
errorMessages: { control: 'object' },
|
|
18
|
-
required: { control: 'boolean' },
|
|
19
|
-
},
|
|
20
|
-
} as Meta<typeof CustomSelect>
|
|
21
|
-
|
|
22
|
-
export default meta
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof meta>
|
|
25
|
-
export const Default: Story = {
|
|
26
|
-
args: {
|
|
27
|
-
items: [
|
|
28
|
-
{ text: 'Option 1', value: '1' },
|
|
29
|
-
{ text: 'Option 2', value: '2' },
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
render: (args) => {
|
|
33
|
-
return {
|
|
34
|
-
components: { CustomSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
35
|
-
setup() {
|
|
36
|
-
return { args }
|
|
37
|
-
},
|
|
38
|
-
template: `
|
|
39
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
40
|
-
<CustomSelect
|
|
41
|
-
v-bind="args"
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
<br/><br/><br/><br/>
|
|
45
|
-
`,
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const Outlined: Story = {
|
|
51
|
-
args: {
|
|
52
|
-
items: [
|
|
53
|
-
{ text: 'Option 1', value: '1' },
|
|
54
|
-
{ text: 'Option 2', value: '2' },
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
render: (args) => {
|
|
58
|
-
return {
|
|
59
|
-
components: { CustomSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
60
|
-
setup() {
|
|
61
|
-
return { args }
|
|
62
|
-
},
|
|
63
|
-
template: `
|
|
64
|
-
<div class="d-flex flex-wrap align-center pa-4" style="z-index: 99999">
|
|
65
|
-
<CustomSelect
|
|
66
|
-
v-bind="args"
|
|
67
|
-
outlined
|
|
68
|
-
/>
|
|
69
|
-
</div>
|
|
70
|
-
`,
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export const Required: Story = {
|
|
76
|
-
args: {
|
|
77
|
-
items: [
|
|
78
|
-
{ text: 'Option 1', value: '1' },
|
|
79
|
-
{ text: 'Option 2', value: '2' },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
render: (args) => {
|
|
83
|
-
return {
|
|
84
|
-
components: { CustomSelect },
|
|
85
|
-
setup() {
|
|
86
|
-
return { args }
|
|
87
|
-
},
|
|
88
|
-
template: `
|
|
89
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
90
|
-
<CustomSelect
|
|
91
|
-
v-bind="args"
|
|
92
|
-
required
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
|
-
`,
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export const withCustomError: Story = {
|
|
101
|
-
args: {
|
|
102
|
-
items: [
|
|
103
|
-
{ text: 'Option 1', value: '1' },
|
|
104
|
-
{ text: 'Option 2', value: '2' },
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
render: (args) => {
|
|
108
|
-
return {
|
|
109
|
-
components: { CustomSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
110
|
-
setup() {
|
|
111
|
-
const errorMessages = ref([])
|
|
112
|
-
const triggerError = () => {
|
|
113
|
-
// @ts-expect-error test error message
|
|
114
|
-
errorMessages.value = ['This is a test error message']
|
|
115
|
-
}
|
|
116
|
-
return { args, errorMessages, triggerError }
|
|
117
|
-
},
|
|
118
|
-
template: `
|
|
119
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
120
|
-
<CustomSelect
|
|
121
|
-
v-bind="args"
|
|
122
|
-
:error-messages="errorMessages"
|
|
123
|
-
/>
|
|
124
|
-
</div>
|
|
125
|
-
<div class="d-flex flex-wrap align-center px-4">
|
|
126
|
-
<VBtn @click="triggerError">
|
|
127
|
-
Trigger Error
|
|
128
|
-
</VBtn>
|
|
129
|
-
</div>
|
|
130
|
-
`,
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export const withCustomKey: Story = {
|
|
136
|
-
args: {
|
|
137
|
-
items: [
|
|
138
|
-
{ customKey: 'Choix 1', value: '1' },
|
|
139
|
-
{ customKey: 'Choix 2', value: '2' },
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
render: (args) => {
|
|
143
|
-
return {
|
|
144
|
-
components: { CustomSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
145
|
-
setup() {
|
|
146
|
-
return { args }
|
|
147
|
-
},
|
|
148
|
-
template: `
|
|
149
|
-
<div class="d-flex flex-wrap align-center pa-4">
|
|
150
|
-
<CustomSelect
|
|
151
|
-
v-bind="args"
|
|
152
|
-
outlined
|
|
153
|
-
text-key="customKey"
|
|
154
|
-
/>
|
|
155
|
-
</div>
|
|
156
|
-
`,
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export const Info: Story = {
|
|
162
|
-
render: (args) => {
|
|
163
|
-
return {
|
|
164
|
-
components: { Alert },
|
|
165
|
-
setup() {
|
|
166
|
-
return { args }
|
|
167
|
-
},
|
|
168
|
-
template: `
|
|
169
|
-
<Alert v-model="args.modelValue" :type="args.type" :variant="tonal" :closable="false">
|
|
170
|
-
<template #default>
|
|
171
|
-
<b>Format des items :</b>
|
|
172
|
-
<ul>
|
|
173
|
-
<li>- Si les items passés en props sont des objets, le composant les utilisera directement.</li>
|
|
174
|
-
<li>- Si les items sont un tableau de string, le composant les utilisera directement.</li>
|
|
175
|
-
</ul>
|
|
176
|
-
</template>
|
|
177
|
-
</Alert>
|
|
178
|
-
`,
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
tags: ['!dev'],
|
|
182
|
-
}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import { expect, describe, it } from 'vitest'
|
|
3
|
-
import CustomSelect from '../CustomSelect.vue'
|
|
4
|
-
import { vuetify } from '@tests/unit/setup'
|
|
5
|
-
|
|
6
|
-
describe('customSelect.vue', () => {
|
|
7
|
-
it('renders the component with default props', () => {
|
|
8
|
-
const wrapper = mount(CustomSelect, {
|
|
9
|
-
global: {
|
|
10
|
-
plugins: [vuetify],
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
expect(wrapper.exists()).toBe(true)
|
|
14
|
-
expect(wrapper.find('.custom-select').text()).toBe('')
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
it('toggles the menu when clicked', async () => {
|
|
18
|
-
const wrapper = mount(CustomSelect, {
|
|
19
|
-
global: {
|
|
20
|
-
plugins: [vuetify],
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
24
|
-
expect(wrapper.find('.v-list').exists()).toBe(true)
|
|
25
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
26
|
-
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('selects an item when clicked', async () => {
|
|
30
|
-
const items = [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }]
|
|
31
|
-
const wrapper = mount(CustomSelect, {
|
|
32
|
-
props: { items },
|
|
33
|
-
global: {
|
|
34
|
-
plugins: [vuetify],
|
|
35
|
-
},
|
|
36
|
-
})
|
|
37
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
38
|
-
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
39
|
-
if (firstItem) {
|
|
40
|
-
await firstItem.trigger('click')
|
|
41
|
-
}
|
|
42
|
-
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ text: 'Option 1', value: '1' }])
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('closes the menu when an item is selected', async () => {
|
|
46
|
-
const items = [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }]
|
|
47
|
-
const wrapper = mount(CustomSelect, {
|
|
48
|
-
props: { items },
|
|
49
|
-
global: {
|
|
50
|
-
plugins: [vuetify],
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
54
|
-
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
55
|
-
if (firstItem) {
|
|
56
|
-
await firstItem.trigger('click')
|
|
57
|
-
}
|
|
58
|
-
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('displays the selected item text', async () => {
|
|
62
|
-
const items = [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }]
|
|
63
|
-
const wrapper = mount(CustomSelect, {
|
|
64
|
-
props: { items, modelValue: { text: 'Option 1', value: '1' } },
|
|
65
|
-
global: {
|
|
66
|
-
plugins: [vuetify],
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
70
|
-
const firstItem = wrapper.findAll('.v-list-item').at(0)
|
|
71
|
-
if (firstItem) {
|
|
72
|
-
await firstItem.trigger('click')
|
|
73
|
-
}
|
|
74
|
-
expect(wrapper.find('input').element.value).toBe('Option 1')
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('closes the menu on escape key press', async () => {
|
|
78
|
-
const items = [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }]
|
|
79
|
-
const wrapper = mount(CustomSelect, {
|
|
80
|
-
props: { items },
|
|
81
|
-
global: {
|
|
82
|
-
plugins: [vuetify],
|
|
83
|
-
},
|
|
84
|
-
})
|
|
85
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
86
|
-
await wrapper.find('.v-list').trigger('keydown.esc')
|
|
87
|
-
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('renders error messages when provided', () => {
|
|
91
|
-
const errorMessages = ['Error 1']
|
|
92
|
-
const wrapper = mount(CustomSelect, {
|
|
93
|
-
props: { errorMessages },
|
|
94
|
-
global: {
|
|
95
|
-
plugins: [vuetify],
|
|
96
|
-
},
|
|
97
|
-
})
|
|
98
|
-
expect(wrapper.find('.v-messages__message').text()).toContain('Error 1')
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it('does not render error messages when not provided', () => {
|
|
102
|
-
const wrapper = mount(CustomSelect, {
|
|
103
|
-
global: {
|
|
104
|
-
plugins: [vuetify],
|
|
105
|
-
},
|
|
106
|
-
})
|
|
107
|
-
expect(wrapper.find('.v-messages__message').exists()).toBe(false)
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
it('does not render the label when not provided', () => {
|
|
111
|
-
const wrapper = mount(CustomSelect, {
|
|
112
|
-
global: {
|
|
113
|
-
plugins: [vuetify],
|
|
114
|
-
},
|
|
115
|
-
})
|
|
116
|
-
expect(wrapper.find('.v-label').text()).toBe('')
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
it('returns the correct item text using getItemText', () => {
|
|
120
|
-
const wrapper = mount(CustomSelect, {
|
|
121
|
-
props: { textKey: 'text' },
|
|
122
|
-
global: {
|
|
123
|
-
plugins: [vuetify],
|
|
124
|
-
},
|
|
125
|
-
})
|
|
126
|
-
const item = { text: 'Option 1', value: '1' }
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
128
|
-
const instance = wrapper.vm as any
|
|
129
|
-
expect(instance.getItemText(item)).toBe('Option 1')
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
it('returns default text when selectedItem is null', () => {
|
|
133
|
-
const wrapper = mount(CustomSelect, {
|
|
134
|
-
global: {
|
|
135
|
-
plugins: [vuetify],
|
|
136
|
-
},
|
|
137
|
-
})
|
|
138
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
139
|
-
const instance = wrapper.vm as any
|
|
140
|
-
expect(instance.selectedItemText).toBe('Sélectionnez une option')
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it('returns the correct text when selectedItem is an object', async () => {
|
|
144
|
-
const wrapper = mount(CustomSelect, {
|
|
145
|
-
props: { modelValue: { text: 'Option 1', value: '1' }, textKey: 'text' },
|
|
146
|
-
global: {
|
|
147
|
-
plugins: [vuetify],
|
|
148
|
-
},
|
|
149
|
-
})
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
151
|
-
const instance = wrapper.vm as any
|
|
152
|
-
await wrapper.setProps({ modelValue: { text: 'Option 1', value: '1' } })
|
|
153
|
-
expect(instance.selectedItemText).toBe('Option 1')
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
it('formats items correctly', () => {
|
|
157
|
-
const items = ['Option 1', 'Option 2']
|
|
158
|
-
const wrapper = mount(CustomSelect, {
|
|
159
|
-
props: { items, textKey: 'text', valueKey: 'value' },
|
|
160
|
-
global: {
|
|
161
|
-
plugins: [vuetify],
|
|
162
|
-
},
|
|
163
|
-
})
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
165
|
-
const formattedItems = (wrapper.vm as any).formattedItems
|
|
166
|
-
expect(formattedItems).toEqual([
|
|
167
|
-
{ text: 'Option 1', value: 'Option 1' },
|
|
168
|
-
{ text: 'Option 2', value: 'Option 2' },
|
|
169
|
-
])
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
it('applies the correct button class when outlined is true', () => {
|
|
173
|
-
const wrapper = mount(CustomSelect, {
|
|
174
|
-
props: { outlined: true },
|
|
175
|
-
global: {
|
|
176
|
-
plugins: [vuetify],
|
|
177
|
-
},
|
|
178
|
-
})
|
|
179
|
-
expect(wrapper.find('.v-field--variant-outlined').exists()).toBe(true)
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
it('does not apply the outlined button class when outlined is false', () => {
|
|
183
|
-
const wrapper = mount(CustomSelect, {
|
|
184
|
-
props: { outlined: false },
|
|
185
|
-
global: {
|
|
186
|
-
plugins: [vuetify],
|
|
187
|
-
},
|
|
188
|
-
})
|
|
189
|
-
expect(wrapper.find('.custom-select').classes()).not.toContain('v-btn--variant-outlined')
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
it('updates selectedItem when v-model changes', async () => {
|
|
193
|
-
const wrapper = mount(CustomSelect, {
|
|
194
|
-
props: { modelValue: { text: 'Option 1', value: '1' }, textKey: 'text' },
|
|
195
|
-
global: {
|
|
196
|
-
plugins: [vuetify],
|
|
197
|
-
},
|
|
198
|
-
})
|
|
199
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
200
|
-
const instance = wrapper.vm as any
|
|
201
|
-
expect(instance.selectedItem).toEqual({ text: 'Option 1', value: '1' })
|
|
202
|
-
|
|
203
|
-
await wrapper.setProps({ modelValue: { text: 'Option 2', value: '2' } })
|
|
204
|
-
expect(instance.selectedItem).toEqual({ text: 'Option 2', value: '2' })
|
|
205
|
-
})
|
|
206
|
-
|
|
207
|
-
it('emits update:modelValue when selectedItem changes', async () => {
|
|
208
|
-
const wrapper = mount(CustomSelect, {
|
|
209
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
210
|
-
props: { modelValue: null as any, textKey: 'text' },
|
|
211
|
-
global: {
|
|
212
|
-
plugins: [vuetify],
|
|
213
|
-
},
|
|
214
|
-
})
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
216
|
-
const instance = wrapper.vm as any
|
|
217
|
-
instance.selectItem({ text: 'Option 1', value: '1' })
|
|
218
|
-
await wrapper.vm.$nextTick()
|
|
219
|
-
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([{ text: 'Option 1', value: '1' }])
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
it('closes the menu when v-click-outside directive is called', async () => {
|
|
223
|
-
const wrapper = mount(CustomSelect, {
|
|
224
|
-
global: {
|
|
225
|
-
plugins: [vuetify],
|
|
226
|
-
},
|
|
227
|
-
})
|
|
228
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
229
|
-
expect(wrapper.find('.v-list').exists()).toBe(true)
|
|
230
|
-
await wrapper.find('.custom-select').trigger('mouseleave')
|
|
231
|
-
await wrapper.find('.custom-select').trigger('click')
|
|
232
|
-
await wrapper.vm.$nextTick()
|
|
233
|
-
|
|
234
|
-
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
235
|
-
})
|
|
236
|
-
})
|