@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,438 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import UserMenuBtn from './UserMenuBtn.vue'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Composants/Boutons/UserMenuBtn',
|
|
6
|
+
component: UserMenuBtn,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'fullscreen',
|
|
9
|
+
controls: { exclude: ['modelValue', 'label', 'icon', 'logoutIcon'] },
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
hideLogoutBtn: { control: 'boolean' },
|
|
13
|
+
hideUserIcon: { control: 'boolean' },
|
|
14
|
+
isMobileView: { control: 'boolean' },
|
|
15
|
+
fullName: { control: 'text' },
|
|
16
|
+
additionalInformation: { control: 'text' },
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof UserMenuBtn>
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof meta>
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
parameters: {
|
|
26
|
+
sourceCode: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Template',
|
|
29
|
+
code: `<template>
|
|
30
|
+
<UserMenuBtn
|
|
31
|
+
v-model="selected"
|
|
32
|
+
:menuItems="menuItems"
|
|
33
|
+
/>
|
|
34
|
+
</template>`,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Script',
|
|
38
|
+
code: `<script setup lang="ts">
|
|
39
|
+
import { ref } from 'vue'
|
|
40
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
41
|
+
|
|
42
|
+
const selected = ref(null)
|
|
43
|
+
const menuItems = ref([
|
|
44
|
+
{ text: 'Administration', value: 'Administration' },
|
|
45
|
+
{ text: 'Profil', value: 'Profil' },
|
|
46
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
47
|
+
])
|
|
48
|
+
</script>`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
args: {
|
|
53
|
+
menuItems: [
|
|
54
|
+
{ text: 'Administration', value: 'Administration' },
|
|
55
|
+
{ text: 'Profil', value: 'Profil' },
|
|
56
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
57
|
+
],
|
|
58
|
+
modelValue: null,
|
|
59
|
+
hideLogoutBtn: false,
|
|
60
|
+
hideUserIcon: false,
|
|
61
|
+
isMobileView: false,
|
|
62
|
+
vuetifyOptions: undefined,
|
|
63
|
+
},
|
|
64
|
+
render: (args) => {
|
|
65
|
+
return {
|
|
66
|
+
components: { UserMenuBtn },
|
|
67
|
+
setup() {
|
|
68
|
+
return { args }
|
|
69
|
+
},
|
|
70
|
+
template: `
|
|
71
|
+
<div class="pa-4">
|
|
72
|
+
<UserMenuBtn v-bind="args"/>
|
|
73
|
+
</div>`,
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
export const HideLogoutButton: Story = {
|
|
78
|
+
parameters: {
|
|
79
|
+
sourceCode: [
|
|
80
|
+
{
|
|
81
|
+
name: 'Template',
|
|
82
|
+
code: `<template>
|
|
83
|
+
<UserMenuBtn
|
|
84
|
+
v-model="selected"
|
|
85
|
+
:menuItems="menuItems"
|
|
86
|
+
:hide-logout-btn="hideLogOut"
|
|
87
|
+
/>
|
|
88
|
+
</template>`,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Script',
|
|
92
|
+
code: `<script setup lang="ts">
|
|
93
|
+
import { ref } from 'vue'
|
|
94
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
95
|
+
|
|
96
|
+
const selected = ref(null)
|
|
97
|
+
const menuItems = ref([
|
|
98
|
+
{ text: 'Administration', value: 'Administration' },
|
|
99
|
+
{ text: 'Profil', value: 'Profil' },
|
|
100
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
101
|
+
])
|
|
102
|
+
|
|
103
|
+
const hideLogOut = ref(true)
|
|
104
|
+
</script>`,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
args: {
|
|
109
|
+
...Default.args,
|
|
110
|
+
hideLogoutBtn: true,
|
|
111
|
+
},
|
|
112
|
+
render: (args) => {
|
|
113
|
+
return {
|
|
114
|
+
components: { UserMenuBtn },
|
|
115
|
+
setup() {
|
|
116
|
+
return { args }
|
|
117
|
+
},
|
|
118
|
+
template: `
|
|
119
|
+
<div class="pa-4">
|
|
120
|
+
<UserMenuBtn v-bind="args"/>
|
|
121
|
+
</div>`,
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const HideUserIcon: Story = {
|
|
127
|
+
parameters: {
|
|
128
|
+
sourceCode: [
|
|
129
|
+
{
|
|
130
|
+
name: 'Template',
|
|
131
|
+
code: `<template>
|
|
132
|
+
<UserMenuBtn
|
|
133
|
+
v-model="selected"
|
|
134
|
+
:menuItems="menuItems"
|
|
135
|
+
:hide-user-icon="hideUserIcon"
|
|
136
|
+
/>
|
|
137
|
+
</template>`,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'Script',
|
|
141
|
+
code: `<script setup lang="ts">
|
|
142
|
+
import { ref } from 'vue'
|
|
143
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
144
|
+
|
|
145
|
+
const selected = ref(null)
|
|
146
|
+
const menuItems = ref([
|
|
147
|
+
{ text: 'Administration', value: 'Administration' },
|
|
148
|
+
{ text: 'Profil', value: 'Profil' },
|
|
149
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
150
|
+
])
|
|
151
|
+
|
|
152
|
+
const hideUserIcon = ref(true)
|
|
153
|
+
</script>`,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
args: {
|
|
158
|
+
...Default.args,
|
|
159
|
+
hideUserIcon: true,
|
|
160
|
+
},
|
|
161
|
+
render: (args) => {
|
|
162
|
+
return {
|
|
163
|
+
components: { UserMenuBtn },
|
|
164
|
+
setup() {
|
|
165
|
+
return { args }
|
|
166
|
+
},
|
|
167
|
+
template: `
|
|
168
|
+
<div class="pa-4">
|
|
169
|
+
<UserMenuBtn v-bind="args"/>
|
|
170
|
+
</div>`,
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const MobileVersion: Story = {
|
|
176
|
+
parameters: {
|
|
177
|
+
sourceCode: [
|
|
178
|
+
{
|
|
179
|
+
name: 'Template',
|
|
180
|
+
code: `<template>
|
|
181
|
+
<UserMenuBtn
|
|
182
|
+
v-model="selected"
|
|
183
|
+
:menuItems="menuItems"
|
|
184
|
+
:is-mobile-view="isMobileVersion"
|
|
185
|
+
/>
|
|
186
|
+
</template>`,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'Script',
|
|
190
|
+
code: `<script setup lang="ts">
|
|
191
|
+
import { ref } from 'vue'
|
|
192
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
193
|
+
|
|
194
|
+
const selected = ref(null)
|
|
195
|
+
const menuItems = ref([
|
|
196
|
+
{ text: 'Administration', value: 'Administration' },
|
|
197
|
+
{ text: 'Profil', value: 'Profil' },
|
|
198
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
199
|
+
])
|
|
200
|
+
|
|
201
|
+
const isMobileVersion = ref(true)
|
|
202
|
+
</script>`,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
args: {
|
|
207
|
+
...Default.args,
|
|
208
|
+
isMobileView: true,
|
|
209
|
+
},
|
|
210
|
+
render: (args) => {
|
|
211
|
+
return {
|
|
212
|
+
components: { UserMenuBtn },
|
|
213
|
+
setup() {
|
|
214
|
+
return { args }
|
|
215
|
+
},
|
|
216
|
+
template: `
|
|
217
|
+
<div class="pa-4">
|
|
218
|
+
<UserMenuBtn v-bind="args"/>
|
|
219
|
+
</div>`,
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export const CustomFullName: Story = {
|
|
225
|
+
parameters: {
|
|
226
|
+
sourceCode: [
|
|
227
|
+
{
|
|
228
|
+
name: 'Template',
|
|
229
|
+
code: `<template>
|
|
230
|
+
<UserMenuBtn
|
|
231
|
+
v-model="selected"
|
|
232
|
+
:menuItems="menuItems"
|
|
233
|
+
:fullName="fullName"
|
|
234
|
+
/>
|
|
235
|
+
</template>`,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: 'Script',
|
|
239
|
+
code: `<script setup lang="ts">
|
|
240
|
+
import { ref } from 'vue'
|
|
241
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
242
|
+
|
|
243
|
+
const selected = ref(null)
|
|
244
|
+
const menuItems = ref([
|
|
245
|
+
{ text: 'Administration', value: 'Administration' },
|
|
246
|
+
{ text: 'Profil', value: 'Profil' },
|
|
247
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
248
|
+
])
|
|
249
|
+
|
|
250
|
+
const fullName = ref('John Doe')
|
|
251
|
+
</script>`,
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
args: {
|
|
256
|
+
...Default.args,
|
|
257
|
+
fullName: 'John Doe',
|
|
258
|
+
},
|
|
259
|
+
render: (args) => {
|
|
260
|
+
return {
|
|
261
|
+
components: { UserMenuBtn },
|
|
262
|
+
setup() {
|
|
263
|
+
return { args }
|
|
264
|
+
},
|
|
265
|
+
template: `
|
|
266
|
+
<div class="pa-4">
|
|
267
|
+
<UserMenuBtn v-bind="args"/>
|
|
268
|
+
</div>`,
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export const CustomAdditionalInformation: Story = {
|
|
274
|
+
parameters: {
|
|
275
|
+
sourceCode: [
|
|
276
|
+
{
|
|
277
|
+
name: 'Template',
|
|
278
|
+
code: `<template>
|
|
279
|
+
<UserMenuBtn
|
|
280
|
+
v-model="selected"
|
|
281
|
+
:menuItems="menuItems"
|
|
282
|
+
:additionalInformation="additionalInformation"
|
|
283
|
+
/>
|
|
284
|
+
</template>`,
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: 'Script',
|
|
288
|
+
code: `<script setup lang="ts">
|
|
289
|
+
import { ref } from 'vue'
|
|
290
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
291
|
+
|
|
292
|
+
const selected = ref(null)
|
|
293
|
+
const menuItems = ref([
|
|
294
|
+
{ text: 'Administration', value: 'Administration' },
|
|
295
|
+
{ text: 'Profil', value: 'Profil' },
|
|
296
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
297
|
+
])
|
|
298
|
+
|
|
299
|
+
const additionalInformation = ref('Custom Information')
|
|
300
|
+
</script>`,
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
},
|
|
304
|
+
args: {
|
|
305
|
+
...Default.args,
|
|
306
|
+
additionalInformation: 'Custom Information',
|
|
307
|
+
},
|
|
308
|
+
render: (args) => {
|
|
309
|
+
return {
|
|
310
|
+
components: { UserMenuBtn },
|
|
311
|
+
setup() {
|
|
312
|
+
return { args }
|
|
313
|
+
},
|
|
314
|
+
template: `
|
|
315
|
+
<div class="pa-4">
|
|
316
|
+
<UserMenuBtn v-bind="args"/>
|
|
317
|
+
</div>`,
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export const WithVuetifyOptions: Story = {
|
|
323
|
+
parameters: {
|
|
324
|
+
sourceCode: [
|
|
325
|
+
{
|
|
326
|
+
name: 'Template',
|
|
327
|
+
code: `<template>
|
|
328
|
+
<UserMenuBtn
|
|
329
|
+
v-model="selected"
|
|
330
|
+
:menuItems="menuItems"
|
|
331
|
+
:vuetify-options="vuetifyOptions"
|
|
332
|
+
/>
|
|
333
|
+
</template>`,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: 'Script',
|
|
337
|
+
code: `<script setup lang="ts">
|
|
338
|
+
import { ref } from 'vue'
|
|
339
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
340
|
+
|
|
341
|
+
const selected = ref(null)
|
|
342
|
+
const menuItems = ref([
|
|
343
|
+
{ text: 'Administration', value: 'Administration' },
|
|
344
|
+
{ text: 'Profil', value: 'Profil' },
|
|
345
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
346
|
+
])
|
|
347
|
+
|
|
348
|
+
const handleLogout = () => {
|
|
349
|
+
alert('User logged out')
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const vuetifyOptions = ref({
|
|
353
|
+
menu: { minWidth: '250px' },
|
|
354
|
+
btn: { variant: 'outlined' },
|
|
355
|
+
icon: { color: 'warning' },
|
|
356
|
+
logoutListItem: { class: 'text-warning' },
|
|
357
|
+
logoutIcon: { color: 'warning' },
|
|
358
|
+
})
|
|
359
|
+
</script>`,
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
},
|
|
363
|
+
args: {
|
|
364
|
+
...Default.args,
|
|
365
|
+
vuetifyOptions: {
|
|
366
|
+
menu: { minWidth: '250px' },
|
|
367
|
+
btn: { variant: 'outlined' },
|
|
368
|
+
icon: { color: 'warning' },
|
|
369
|
+
logoutListItem: { class: 'text-warning' },
|
|
370
|
+
logoutIcon: { color: 'warning' },
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
render: (args) => {
|
|
374
|
+
return {
|
|
375
|
+
components: { UserMenuBtn },
|
|
376
|
+
setup() {
|
|
377
|
+
return { args }
|
|
378
|
+
},
|
|
379
|
+
template: `
|
|
380
|
+
<div class="pa-4">
|
|
381
|
+
<UserMenuBtn v-bind="args"/>
|
|
382
|
+
</div>`,
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export const LogoutEvent: Story = {
|
|
388
|
+
parameters: {
|
|
389
|
+
sourceCode: [
|
|
390
|
+
{
|
|
391
|
+
name: 'Template',
|
|
392
|
+
code: `<template>
|
|
393
|
+
<UserMenuBtn
|
|
394
|
+
v-model="selected"
|
|
395
|
+
:menuItems="menuItems"
|
|
396
|
+
@logout="handleLogout"
|
|
397
|
+
/>
|
|
398
|
+
</template>`,
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
name: 'Script',
|
|
402
|
+
code: `<script setup lang="ts">
|
|
403
|
+
import { ref } from 'vue'
|
|
404
|
+
import UserMenuBtn from '@cnamts/synapse'
|
|
405
|
+
|
|
406
|
+
const selected = ref(null)
|
|
407
|
+
const menuItems = ref([
|
|
408
|
+
{ text: 'Administration', value: 'Administration' },
|
|
409
|
+
{ text: 'Profil', value: 'Profil' },
|
|
410
|
+
{ text: 'Paramètres', value: 'Paramètres' },
|
|
411
|
+
])
|
|
412
|
+
|
|
413
|
+
const handleLogout = () => {
|
|
414
|
+
alert('Logout event triggered')
|
|
415
|
+
}
|
|
416
|
+
</script>`,
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
},
|
|
420
|
+
args: {
|
|
421
|
+
...Default.args,
|
|
422
|
+
},
|
|
423
|
+
render: (args) => {
|
|
424
|
+
return {
|
|
425
|
+
components: { UserMenuBtn },
|
|
426
|
+
setup() {
|
|
427
|
+
const handleLogout = () => {
|
|
428
|
+
alert('Logout event triggered')
|
|
429
|
+
}
|
|
430
|
+
return { args, handleLogout }
|
|
431
|
+
},
|
|
432
|
+
template: `
|
|
433
|
+
<div class="pa-4">
|
|
434
|
+
<UserMenuBtn v-bind="args" @logout="handleLogout"/>
|
|
435
|
+
</div>`,
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { defineProps, defineEmits, withDefaults, computed } from 'vue'
|
|
3
|
+
import SyBtnSelect from '../Customs/SyBtnSelect/SyBtnSelect.vue'
|
|
4
|
+
import { useDisplay } from 'vuetify'
|
|
5
|
+
import { mdiAccount, mdiLoginVariant } from '@mdi/js'
|
|
6
|
+
import useCustomizableOptions, { type CustomizableOptions } from '@/composables/useCustomizableOptions'
|
|
7
|
+
import { defaultOptions } from './config'
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<CustomizableOptions & {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
11
|
+
modelValue: string | Record<string, any> | null | undefined
|
|
12
|
+
menuItems?: { text: string, value: string }[]
|
|
13
|
+
additionalInformation?: string
|
|
14
|
+
fullName?: string
|
|
15
|
+
hideLogoutBtn?: boolean
|
|
16
|
+
logoutIcon?: string
|
|
17
|
+
isMobileView?: boolean
|
|
18
|
+
hideUserIcon?: boolean
|
|
19
|
+
}>(), {
|
|
20
|
+
modelValue: null,
|
|
21
|
+
menuItems: () => [],
|
|
22
|
+
additionalInformation: 'Information supplémentaire',
|
|
23
|
+
fullName: 'Prénom Nom',
|
|
24
|
+
hideLogoutBtn: false,
|
|
25
|
+
logoutIcon: 'mdiLoginVariant',
|
|
26
|
+
isMobileView: false,
|
|
27
|
+
hideUserIcon: false,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits(['update:modelValue', 'logout'])
|
|
31
|
+
const { smAndDown } = useDisplay()
|
|
32
|
+
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
34
|
+
const options = useCustomizableOptions(defaultOptions, props) as any
|
|
35
|
+
|
|
36
|
+
const isMobileView = computed(() => {
|
|
37
|
+
return props.isMobileView || smAndDown.value
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
41
|
+
function updateModelValue(value: any) {
|
|
42
|
+
emit('update:modelValue', value)
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<SyBtnSelect
|
|
48
|
+
:is-mobile-view="isMobileView"
|
|
49
|
+
:icon-only="isMobileView"
|
|
50
|
+
:menu-items="menuItems"
|
|
51
|
+
:model-value="props.modelValue ?? undefined"
|
|
52
|
+
:options="options"
|
|
53
|
+
:primary-info="fullName"
|
|
54
|
+
:secondary-info="additionalInformation"
|
|
55
|
+
:hide-icon="hideUserIcon"
|
|
56
|
+
class="user-menu-btn"
|
|
57
|
+
@update:model-value="updateModelValue"
|
|
58
|
+
>
|
|
59
|
+
<template #append-icon>
|
|
60
|
+
<VIcon
|
|
61
|
+
v-if="!hideUserIcon"
|
|
62
|
+
:size="isMobileView ? 'x-large' : 'default'"
|
|
63
|
+
class="vd-user-icon mr-0 pa-2"
|
|
64
|
+
v-bind="options['icon']"
|
|
65
|
+
>
|
|
66
|
+
{{ mdiAccount }}
|
|
67
|
+
</VIcon>
|
|
68
|
+
</template>
|
|
69
|
+
<template #footer-list-item>
|
|
70
|
+
<VListItem
|
|
71
|
+
v-if="!hideLogoutBtn"
|
|
72
|
+
class="logout"
|
|
73
|
+
v-bind="options['logoutListItem']"
|
|
74
|
+
@click="$emit('logout')"
|
|
75
|
+
>
|
|
76
|
+
<div class="d-flex">
|
|
77
|
+
<VIcon
|
|
78
|
+
:icon="mdiLoginVariant"
|
|
79
|
+
class="mr-4"
|
|
80
|
+
v-bind="options['logoutIcon']"
|
|
81
|
+
/>
|
|
82
|
+
<VListItemTitle>
|
|
83
|
+
Logout
|
|
84
|
+
</VListItemTitle>
|
|
85
|
+
</div>
|
|
86
|
+
</VListItem>
|
|
87
|
+
</template>
|
|
88
|
+
</SyBtnSelect>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<style scoped>
|
|
92
|
+
@use '@/assets/tokens.scss';
|
|
93
|
+
.vd-user-icon {
|
|
94
|
+
width: 40px;
|
|
95
|
+
height: 40px;
|
|
96
|
+
background: tokens.$grey-lighten-90;
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
|
|
99
|
+
svg,
|
|
100
|
+
.v-icon__svg {
|
|
101
|
+
width: 24px;
|
|
102
|
+
height: 24px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const defaultOptions = {
|
|
2
|
+
menu: {
|
|
3
|
+
offsetY: true,
|
|
4
|
+
zIndex: 4,
|
|
5
|
+
minWidth: '198px',
|
|
6
|
+
maxWidth: 'auto',
|
|
7
|
+
nudgeRight: 0,
|
|
8
|
+
},
|
|
9
|
+
btn: {
|
|
10
|
+
variant: 'text',
|
|
11
|
+
height: 'auto',
|
|
12
|
+
},
|
|
13
|
+
icon: {
|
|
14
|
+
color: 'avatar',
|
|
15
|
+
},
|
|
16
|
+
logoutListItem: {
|
|
17
|
+
class: 'text-primary',
|
|
18
|
+
minWidth: '198px',
|
|
19
|
+
},
|
|
20
|
+
logoutIcon: {
|
|
21
|
+
color: 'primary',
|
|
22
|
+
class: 'mr-4',
|
|
23
|
+
},
|
|
24
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import UserMenuBtn from '../UserMenuBtn.vue'
|
|
4
|
+
import { vuetify } from '@tests/unit/setup'
|
|
5
|
+
import { nextTick } from 'vue'
|
|
6
|
+
|
|
7
|
+
describe('UserMenuBtn', () => {
|
|
8
|
+
it('renders the component', () => {
|
|
9
|
+
const wrapper = mount(UserMenuBtn, {
|
|
10
|
+
global: {
|
|
11
|
+
plugins: [vuetify],
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
modelValue: null,
|
|
15
|
+
menuItems: [{ text: 'Item 1', value: 'item1' }],
|
|
16
|
+
additionalInformation: 'Additional Info',
|
|
17
|
+
fullName: 'John Doe',
|
|
18
|
+
hideLogoutBtn: false,
|
|
19
|
+
isMobileView: false,
|
|
20
|
+
hideUserIcon: false,
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
expect(wrapper.exists()).toBe(true)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('displays the full name', () => {
|
|
27
|
+
const wrapper = mount(UserMenuBtn, {
|
|
28
|
+
global: {
|
|
29
|
+
plugins: [vuetify],
|
|
30
|
+
},
|
|
31
|
+
props: {
|
|
32
|
+
modelValue: null,
|
|
33
|
+
fullName: 'John Doe',
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
expect(wrapper.text()).toContain('John Doe')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('does not render logout button when hidden', () => {
|
|
40
|
+
const wrapper = mount(UserMenuBtn, {
|
|
41
|
+
global: {
|
|
42
|
+
plugins: [vuetify],
|
|
43
|
+
},
|
|
44
|
+
props: {
|
|
45
|
+
modelValue: null,
|
|
46
|
+
hideLogoutBtn: true,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
expect(wrapper.find('.logout').exists()).toBe(false)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('renders user icon when not hidden', () => {
|
|
53
|
+
const wrapper = mount(UserMenuBtn, {
|
|
54
|
+
global: {
|
|
55
|
+
plugins: [vuetify],
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
modelValue: null,
|
|
59
|
+
hideUserIcon: false,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
expect(wrapper.find('.vd-user-icon').exists()).toBe(true)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('does not render user icon when hidden', () => {
|
|
66
|
+
const wrapper = mount(UserMenuBtn, {
|
|
67
|
+
global: {
|
|
68
|
+
plugins: [vuetify],
|
|
69
|
+
},
|
|
70
|
+
props: {
|
|
71
|
+
modelValue: null,
|
|
72
|
+
hideUserIcon: true,
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
expect(wrapper.find('.vd-user-icon').exists()).toBe(false)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('emits "update:modelValue" when selected changes', async () => {
|
|
79
|
+
const wrapper = mount(UserMenuBtn, {
|
|
80
|
+
global: {
|
|
81
|
+
plugins: [vuetify],
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
modelValue: null,
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
wrapper.vm.$emit('update:modelValue', 'item1')
|
|
88
|
+
await nextTick()
|
|
89
|
+
const emitted = wrapper.emitted('update:modelValue')
|
|
90
|
+
expect(emitted).toBeTruthy()
|
|
91
|
+
if (emitted && emitted[0]) {
|
|
92
|
+
expect(emitted[0]).toEqual(['item1'])
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('computes mobile view correctly based on props and display', () => {
|
|
97
|
+
const wrapper = mount(UserMenuBtn, {
|
|
98
|
+
global: {
|
|
99
|
+
plugins: [vuetify],
|
|
100
|
+
},
|
|
101
|
+
props: {
|
|
102
|
+
modelValue: null,
|
|
103
|
+
isMobileView: true,
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
expect(wrapper.vm.isMobileView).toBe(true)
|
|
107
|
+
})
|
|
108
|
+
it('emits "update:modelValue" when updateModelValue is called via event', async () => {
|
|
109
|
+
const wrapper = mount(UserMenuBtn, {
|
|
110
|
+
global: {
|
|
111
|
+
plugins: [vuetify],
|
|
112
|
+
},
|
|
113
|
+
props: {
|
|
114
|
+
modelValue: null,
|
|
115
|
+
menuItems: [{ text: 'Item 1', value: 'item1' }],
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
const SyBtnSelect = wrapper.findComponent({ name: 'SyBtnSelect' })
|
|
120
|
+
await SyBtnSelect.vm.$emit('update:model-value', 'test-value')
|
|
121
|
+
|
|
122
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
123
|
+
expect(wrapper.emitted('update:modelValue')![0]).toEqual(['test-value'])
|
|
124
|
+
})
|
|
125
|
+
})
|