@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,140 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { expect, describe, it } from 'vitest'
|
|
3
|
+
import SyInputSelect from '../SyInputSelect.vue'
|
|
4
|
+
import { vuetify } from '@tests/unit/setup'
|
|
5
|
+
|
|
6
|
+
describe('SyInputSelect', () => {
|
|
7
|
+
it('renders the component with default props', () => {
|
|
8
|
+
const wrapper = mount(SyInputSelect, {
|
|
9
|
+
global: {
|
|
10
|
+
plugins: [vuetify],
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
expect(wrapper.exists()).toBe(true)
|
|
14
|
+
expect(wrapper.find('.sy-input-select').text()).toBe('Sélectionnez une option')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('displays the selected item text', async () => {
|
|
18
|
+
const items = [{ text: 'Option 1', value: '1' }, { text: 'Option 2', value: '2' }]
|
|
19
|
+
const wrapper = mount(SyInputSelect, {
|
|
20
|
+
props: { items, modelValue: { text: 'Option 1', value: '1' } },
|
|
21
|
+
global: {
|
|
22
|
+
plugins: [vuetify],
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
expect(wrapper.find('.sy-input-select').text()).toContain('Option 1')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('does not render error messages when not provided', () => {
|
|
29
|
+
const wrapper = mount(SyInputSelect, {
|
|
30
|
+
global: {
|
|
31
|
+
plugins: [vuetify],
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
expect(wrapper.find('.v-messages__message').exists()).toBe(false)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('does not render the label when not provided', () => {
|
|
38
|
+
const wrapper = mount(SyInputSelect, {
|
|
39
|
+
global: {
|
|
40
|
+
plugins: [vuetify],
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
expect(wrapper.find('label').exists()).toBe(false)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('formats items correctly', () => {
|
|
47
|
+
const items = ['Option 1', 'Option 2']
|
|
48
|
+
const wrapper = mount(SyInputSelect, {
|
|
49
|
+
props: { items, textKey: 'text', valueKey: 'value' },
|
|
50
|
+
global: {
|
|
51
|
+
plugins: [vuetify],
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
55
|
+
const formattedItems = (wrapper.vm as any).formattedItems
|
|
56
|
+
expect(formattedItems).toEqual([
|
|
57
|
+
{ text: 'Option 1', value: 'Option 1' },
|
|
58
|
+
{ text: 'Option 2', value: 'Option 2' },
|
|
59
|
+
])
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('applies the correct button class when outlined is true', () => {
|
|
63
|
+
const wrapper = mount(SyInputSelect, {
|
|
64
|
+
props: { outlined: true },
|
|
65
|
+
global: {
|
|
66
|
+
plugins: [vuetify],
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
expect(wrapper.find('.sy-input-select').classes()).toContain('v-btn--variant-outlined')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('toggles the menu when the button is clicked', async () => {
|
|
73
|
+
const wrapper = mount(SyInputSelect, {
|
|
74
|
+
global: {
|
|
75
|
+
plugins: [vuetify],
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
const button = wrapper.find('.sy-input-select')
|
|
79
|
+
await button.trigger('click')
|
|
80
|
+
expect(wrapper.vm.isOpen).toBe(true)
|
|
81
|
+
await button.trigger('click')
|
|
82
|
+
expect(wrapper.vm.isOpen).toBe(false)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('use closeList method', async () => {
|
|
86
|
+
const wrapper = mount(SyInputSelect, {
|
|
87
|
+
global: {
|
|
88
|
+
plugins: [vuetify],
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
await wrapper.vm.closeList()
|
|
92
|
+
expect(wrapper.vm.isOpen).toBe(false)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('selectItem method', async () => {
|
|
96
|
+
const wrapper = mount(SyInputSelect, {
|
|
97
|
+
global: {
|
|
98
|
+
plugins: [vuetify],
|
|
99
|
+
},
|
|
100
|
+
})
|
|
101
|
+
await wrapper.vm.selectItem({ text: 'Option 1', value: '1' })
|
|
102
|
+
expect(wrapper.vm.isOpen).toBe(false)
|
|
103
|
+
expect(wrapper.vm.selectedItem).toEqual({ text: 'Option 1', value: '1' })
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('getItemText method', async () => {
|
|
107
|
+
const wrapper = mount(SyInputSelect, {
|
|
108
|
+
global: {
|
|
109
|
+
plugins: [vuetify],
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
const item = { text: 'Option 1', value: '1' }
|
|
113
|
+
const text = wrapper.vm.getItemText(item)
|
|
114
|
+
expect(text).toBe('Option 1')
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
it('watch modelValue', async () => {
|
|
118
|
+
const wrapper = mount(SyInputSelect, {
|
|
119
|
+
props: { modelValue: { text: 'Option 1', value: '1' } },
|
|
120
|
+
global: {
|
|
121
|
+
plugins: [vuetify],
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
expect(wrapper.vm.selectedItem).toEqual({ text: 'Option 1', value: '1' })
|
|
125
|
+
await wrapper.setProps({ modelValue: { text: 'Option 2', value: '2' } })
|
|
126
|
+
expect(wrapper.vm.selectedItem).toEqual({ text: 'Option 2', value: '2' })
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('watch errorMessages', async () => {
|
|
130
|
+
const wrapper = mount(SyInputSelect, {
|
|
131
|
+
props: { errorMessages: ['Error message'] },
|
|
132
|
+
global: {
|
|
133
|
+
plugins: [vuetify],
|
|
134
|
+
},
|
|
135
|
+
})
|
|
136
|
+
expect(wrapper.find('.v-messages__message').exists()).toBe(true)
|
|
137
|
+
await wrapper.setProps({ errorMessages: [] })
|
|
138
|
+
expect(wrapper.find('.v-messages__message').exists()).toBe(false)
|
|
139
|
+
})
|
|
140
|
+
})
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Canvas, Meta, Controls, Story, Source } from '@storybook/blocks';
|
|
2
|
-
import * as
|
|
2
|
+
import * as SySelectStories from "./SySelect.stories";
|
|
3
3
|
|
|
4
|
-
<Meta of={
|
|
4
|
+
<Meta of={SySelectStories} />
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# SySelect
|
|
7
7
|
|
|
8
|
-
Le composant `
|
|
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.
|
|
9
9
|
|
|
10
|
-
<Canvas of={
|
|
10
|
+
<Canvas of={SySelectStories.Default} />
|
|
11
11
|
|
|
12
|
-
<Story of={
|
|
12
|
+
<Story of={SySelectStories.Info} />
|
|
13
13
|
|
|
14
14
|
# API
|
|
15
15
|
|
|
16
|
-
<Controls of={
|
|
16
|
+
<Controls of={SySelectStories.Default} />
|
|
17
17
|
|
|
18
18
|
# Exemple d'utilisation
|
|
19
19
|
|
|
20
20
|
<Source dark code={`
|
|
21
21
|
<script setup lang="ts">
|
|
22
22
|
import { ref } from 'vue'
|
|
23
|
-
import
|
|
23
|
+
import SySelect from '@cnamts/synapse'
|
|
24
24
|
|
|
25
25
|
const selectedValue = ref(undefined)
|
|
26
26
|
|
|
27
|
-
const items =
|
|
27
|
+
const items = [
|
|
28
28
|
{ text: 'Option 1', value: '1' },
|
|
29
29
|
{ text: 'Option 2', value: '2' },
|
|
30
|
-
]
|
|
30
|
+
]
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<template>
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import SySelect from '@/components/Customs/SySelect/SySelect.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: 'Composants/Formulaires/SySelect',
|
|
9
|
+
component: SySelect,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
controls: { exclude: ['selectedValue', 'isOpen', 'closeList'] },
|
|
13
|
+
},
|
|
14
|
+
argTypes: {
|
|
15
|
+
selectedValue: { control: 'text' },
|
|
16
|
+
items: { control: 'object' },
|
|
17
|
+
errorMessages: { control: 'object' },
|
|
18
|
+
required: { control: 'boolean' },
|
|
19
|
+
},
|
|
20
|
+
} as Meta<typeof SySelect>
|
|
21
|
+
|
|
22
|
+
export default meta
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
parameters: {
|
|
27
|
+
sourceCode: [
|
|
28
|
+
{
|
|
29
|
+
name: 'Template',
|
|
30
|
+
code: `
|
|
31
|
+
<template>
|
|
32
|
+
<SySelect
|
|
33
|
+
v-model="value"
|
|
34
|
+
:items="items"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Script',
|
|
41
|
+
code: `
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import SySelect from '@cnamts/SySelect'
|
|
44
|
+
|
|
45
|
+
const items = [
|
|
46
|
+
{ text: 'Option 1', value: '1' },
|
|
47
|
+
{ text: 'Option 2', value: '2' },
|
|
48
|
+
],
|
|
49
|
+
</script>
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
args: {
|
|
55
|
+
items: [
|
|
56
|
+
{ text: 'Option 1', value: '1' },
|
|
57
|
+
{ text: 'Option 2', value: '2' },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
render: (args) => {
|
|
61
|
+
return {
|
|
62
|
+
components: { SySelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
63
|
+
setup() {
|
|
64
|
+
return { args }
|
|
65
|
+
},
|
|
66
|
+
template: `
|
|
67
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
68
|
+
<SySelect
|
|
69
|
+
v-bind="args"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
<br/><br/><br/><br/>
|
|
73
|
+
`,
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Outlined: Story = {
|
|
79
|
+
parameters: {
|
|
80
|
+
sourceCode: [
|
|
81
|
+
{
|
|
82
|
+
name: 'Template',
|
|
83
|
+
code: `
|
|
84
|
+
<template>
|
|
85
|
+
<SySelect
|
|
86
|
+
v-model="value"
|
|
87
|
+
:items="items"
|
|
88
|
+
outlined
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
`,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'Script',
|
|
95
|
+
code: `
|
|
96
|
+
<script setup lang="ts">
|
|
97
|
+
import SySelect from '@cnamts/SySelect'
|
|
98
|
+
|
|
99
|
+
const items = [
|
|
100
|
+
{ text: 'Option 1', value: '1' },
|
|
101
|
+
{ text: 'Option 2', value: '2' },
|
|
102
|
+
],
|
|
103
|
+
</script>
|
|
104
|
+
`,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
args: {
|
|
109
|
+
items: [
|
|
110
|
+
{ text: 'Option 1', value: '1' },
|
|
111
|
+
{ text: 'Option 2', value: '2' },
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
render: (args) => {
|
|
115
|
+
return {
|
|
116
|
+
components: { SySelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
117
|
+
setup() {
|
|
118
|
+
return { args }
|
|
119
|
+
},
|
|
120
|
+
template: `
|
|
121
|
+
<div class="d-flex flex-wrap align-center pa-4" style="z-index: 99999">
|
|
122
|
+
<SySelect
|
|
123
|
+
v-bind="args"
|
|
124
|
+
outlined
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
`,
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const Required: Story = {
|
|
133
|
+
parameters: {
|
|
134
|
+
sourceCode: [
|
|
135
|
+
{
|
|
136
|
+
name: 'Template',
|
|
137
|
+
code: `
|
|
138
|
+
<template>
|
|
139
|
+
<SySelect
|
|
140
|
+
v-model="value"
|
|
141
|
+
:items="items"
|
|
142
|
+
required
|
|
143
|
+
/>
|
|
144
|
+
</template>
|
|
145
|
+
`,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'Script',
|
|
149
|
+
code: `
|
|
150
|
+
<script setup lang="ts">
|
|
151
|
+
import SySelect from '@cnamts/SySelect'
|
|
152
|
+
|
|
153
|
+
const items = [
|
|
154
|
+
{ text: 'Option 1', value: '1' },
|
|
155
|
+
{ text: 'Option 2', value: '2' },
|
|
156
|
+
],
|
|
157
|
+
</script>
|
|
158
|
+
`,
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
},
|
|
162
|
+
args: {
|
|
163
|
+
items: [
|
|
164
|
+
{ text: 'Option 1', value: '1' },
|
|
165
|
+
{ text: 'Option 2', value: '2' },
|
|
166
|
+
],
|
|
167
|
+
required: true,
|
|
168
|
+
},
|
|
169
|
+
render: (args) => {
|
|
170
|
+
return {
|
|
171
|
+
components: { SySelect },
|
|
172
|
+
setup() {
|
|
173
|
+
return { args }
|
|
174
|
+
},
|
|
175
|
+
template: `
|
|
176
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
177
|
+
<SySelect
|
|
178
|
+
v-bind="args"
|
|
179
|
+
:required="args.required"
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
`,
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const withCustomError: Story = {
|
|
188
|
+
parameters: {
|
|
189
|
+
sourceCode: [
|
|
190
|
+
{
|
|
191
|
+
name: 'Template',
|
|
192
|
+
code: `
|
|
193
|
+
<template>
|
|
194
|
+
<SySelect
|
|
195
|
+
v-model="value"
|
|
196
|
+
:items="items"
|
|
197
|
+
:error-messages="errorMessages"
|
|
198
|
+
/>
|
|
199
|
+
<VBtn @click="triggerError">
|
|
200
|
+
Trigger Error
|
|
201
|
+
</VBtn>
|
|
202
|
+
</template>
|
|
203
|
+
`,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'Script',
|
|
207
|
+
code: `
|
|
208
|
+
<script setup lang="ts">
|
|
209
|
+
import SySelect from '@cnamts/SySelect'
|
|
210
|
+
import { ref } from 'vue'
|
|
211
|
+
|
|
212
|
+
const items = [
|
|
213
|
+
{ text: 'Option 1', value: '1' },
|
|
214
|
+
{ text: 'Option 2', value: '2' },
|
|
215
|
+
],
|
|
216
|
+
|
|
217
|
+
const errorMessages = ref([])
|
|
218
|
+
|
|
219
|
+
const triggerError = () => {
|
|
220
|
+
errorMessages.value = ['This is a test error message']
|
|
221
|
+
}
|
|
222
|
+
</script>
|
|
223
|
+
`,
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
args: {
|
|
228
|
+
items: [
|
|
229
|
+
{ text: 'Option 1', value: '1' },
|
|
230
|
+
{ text: 'Option 2', value: '2' },
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
render: (args) => {
|
|
234
|
+
return {
|
|
235
|
+
components: { SySelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
236
|
+
setup() {
|
|
237
|
+
const errorMessages = ref([])
|
|
238
|
+
const triggerError = () => {
|
|
239
|
+
// @ts-expect-error test error message
|
|
240
|
+
errorMessages.value = ['This is a test error message']
|
|
241
|
+
}
|
|
242
|
+
return { args, errorMessages, triggerError }
|
|
243
|
+
},
|
|
244
|
+
template: `
|
|
245
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
246
|
+
<SySelect
|
|
247
|
+
v-bind="args"
|
|
248
|
+
:error-messages="errorMessages"
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
<div class="d-flex flex-wrap align-center px-4">
|
|
252
|
+
<VBtn @click="triggerError">
|
|
253
|
+
Trigger Error
|
|
254
|
+
</VBtn>
|
|
255
|
+
</div>
|
|
256
|
+
`,
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export const withCustomKey: Story = {
|
|
262
|
+
parameters: {
|
|
263
|
+
sourceCode: [
|
|
264
|
+
{
|
|
265
|
+
name: 'Template',
|
|
266
|
+
code: `
|
|
267
|
+
<template>
|
|
268
|
+
<SySelect
|
|
269
|
+
v-model="value"
|
|
270
|
+
:items="items"
|
|
271
|
+
text-key="customKey"
|
|
272
|
+
outlined
|
|
273
|
+
/>
|
|
274
|
+
</template>
|
|
275
|
+
`,
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: 'Script',
|
|
279
|
+
code: `
|
|
280
|
+
<script setup lang="ts">
|
|
281
|
+
import SySelect from '@cnamts/SySelect'
|
|
282
|
+
|
|
283
|
+
const items = [
|
|
284
|
+
{ customKey: 'Choix 1', value: '1' },
|
|
285
|
+
{ customKey: 'Choix 2', value: '2' },
|
|
286
|
+
],
|
|
287
|
+
</script>
|
|
288
|
+
`,
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
args: {
|
|
293
|
+
items: [
|
|
294
|
+
{ customKey: 'Choix 1', value: '1' },
|
|
295
|
+
{ customKey: 'Choix 2', value: '2' },
|
|
296
|
+
],
|
|
297
|
+
},
|
|
298
|
+
render: (args) => {
|
|
299
|
+
return {
|
|
300
|
+
components: { SySelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
|
|
301
|
+
setup() {
|
|
302
|
+
return { args }
|
|
303
|
+
},
|
|
304
|
+
template: `
|
|
305
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
306
|
+
<SySelect
|
|
307
|
+
v-bind="args"
|
|
308
|
+
outlined
|
|
309
|
+
text-key="customKey"
|
|
310
|
+
/>
|
|
311
|
+
</div>
|
|
312
|
+
`,
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export const Info: Story = {
|
|
318
|
+
render: (args) => {
|
|
319
|
+
return {
|
|
320
|
+
components: { Alert },
|
|
321
|
+
setup() {
|
|
322
|
+
return { args }
|
|
323
|
+
},
|
|
324
|
+
template: `
|
|
325
|
+
<Alert v-model="args.modelValue" :type="args.type" :variant="tonal" :closable="false">
|
|
326
|
+
<template #default>
|
|
327
|
+
<b>Format des items :</b>
|
|
328
|
+
<ul>
|
|
329
|
+
<li>- Si les items passés en props sont des objets, le composant les utilisera directement.</li>
|
|
330
|
+
<li>- Si les items sont un tableau de string, le composant les utilisera directement.</li>
|
|
331
|
+
</ul>
|
|
332
|
+
</template>
|
|
333
|
+
</Alert>
|
|
334
|
+
`,
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
tags: ['!dev'],
|
|
338
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { mdiMenuDown } from '@mdi/js'
|
|
2
|
+
import { mdiInformation, mdiMenuDown } from '@mdi/js'
|
|
3
3
|
import { ref, watch, computed, type PropType } from 'vue'
|
|
4
4
|
import { VIcon, VTextField, VList, VListItem, VListItemTitle } from 'vuetify/components'
|
|
5
5
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
menuId: {
|
|
28
28
|
type: String,
|
|
29
|
-
default: '
|
|
29
|
+
default: 'sy-select-menu',
|
|
30
30
|
},
|
|
31
31
|
outlined: {
|
|
32
32
|
type: Boolean,
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
const emit = defineEmits(['update:modelValue'])
|
|
46
46
|
|
|
47
47
|
const isOpen = ref(false)
|
|
48
|
-
const selectedItem = ref<Record<string, unknown > | string | null>(props.modelValue)
|
|
48
|
+
const selectedItem = ref<Record<string, unknown > | string | null | undefined>(props.modelValue)
|
|
49
|
+
const hasError = ref(false)
|
|
49
50
|
|
|
50
51
|
const toggleMenu = () => {
|
|
51
52
|
isOpen.value = !isOpen.value
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
const closeList = () => {
|
|
54
55
|
isOpen.value = false
|
|
55
56
|
}
|
|
56
|
-
const inputId = ref(`
|
|
57
|
+
const inputId = ref(`sy-select-${Math.random().toString(36).substring(7)}`)
|
|
57
58
|
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
59
60
|
const selectItem = (item: any) => {
|
|
@@ -91,10 +92,19 @@
|
|
|
91
92
|
watch(() => props.modelValue, (newValue) => {
|
|
92
93
|
selectedItem.value = newValue
|
|
93
94
|
})
|
|
95
|
+
|
|
96
|
+
watch(isOpen, (newValue) => {
|
|
97
|
+
hasError.value = !newValue && !selectedItem.value && isRequired.value
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
defineExpose({
|
|
101
|
+
isOpen,
|
|
102
|
+
closeList,
|
|
103
|
+
})
|
|
94
104
|
</script>
|
|
95
105
|
|
|
96
106
|
<template>
|
|
97
|
-
<div
|
|
107
|
+
<div>
|
|
98
108
|
<VTextField
|
|
99
109
|
:id="inputId"
|
|
100
110
|
ref="input"
|
|
@@ -109,12 +119,22 @@
|
|
|
109
119
|
:error-messages="errorMessages"
|
|
110
120
|
:variant="outlined ? 'outlined' : 'underlined'"
|
|
111
121
|
:rules="isRequired ? ['Le champ est requis.'] : []"
|
|
112
|
-
class="
|
|
122
|
+
class="sy-select"
|
|
113
123
|
@click="toggleMenu"
|
|
114
124
|
@keydown.enter.prevent="toggleMenu"
|
|
115
125
|
@keydown.space.prevent="toggleMenu"
|
|
116
126
|
>
|
|
117
|
-
<
|
|
127
|
+
<template #append-inner>
|
|
128
|
+
<VIcon
|
|
129
|
+
v-if="hasError"
|
|
130
|
+
class="mr-6"
|
|
131
|
+
>
|
|
132
|
+
{{ mdiInformation }}
|
|
133
|
+
</VIcon>
|
|
134
|
+
<VIcon>
|
|
135
|
+
{{ mdiMenuDown }}
|
|
136
|
+
</VIcon>
|
|
137
|
+
</template>
|
|
118
138
|
</VTextField>
|
|
119
139
|
<VList
|
|
120
140
|
v-if="isOpen"
|
|
@@ -143,9 +163,10 @@
|
|
|
143
163
|
<style scoped lang="scss">
|
|
144
164
|
@use '@/assets/tokens.scss';
|
|
145
165
|
|
|
146
|
-
.
|
|
166
|
+
.sy-select {
|
|
147
167
|
display: flex;
|
|
148
168
|
flex-direction: column;
|
|
169
|
+
min-width: 225px;
|
|
149
170
|
}
|
|
150
171
|
|
|
151
172
|
.v-field {
|
|
@@ -153,7 +174,7 @@
|
|
|
153
174
|
}
|
|
154
175
|
.v-field--focused {
|
|
155
176
|
.v-icon {
|
|
156
|
-
transform: rotateX(180deg)
|
|
177
|
+
transform: rotateX(180deg);
|
|
157
178
|
}
|
|
158
179
|
}
|
|
159
180
|
|
|
@@ -181,8 +202,10 @@
|
|
|
181
202
|
.v-icon {
|
|
182
203
|
position: absolute;
|
|
183
204
|
right: 10px;
|
|
184
|
-
top: 50%;
|
|
185
|
-
transform: translateY(-50%);
|
|
186
205
|
color: tokens.$grey-darken-20;
|
|
187
206
|
}
|
|
207
|
+
|
|
208
|
+
:deep(.v-field__input) {
|
|
209
|
+
color: tokens.$grey-darken-20
|
|
210
|
+
}
|
|
188
211
|
</style>
|