@cnamts/synapse 0.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/design-system-v3.d.ts +246 -0
- package/dist/design-system-v3.js +5425 -0
- package/dist/design-system-v3.umd.cjs +2 -0
- package/dist/style.css +1 -0
- package/package.json +104 -0
- package/src/assets/tokens.scss +500 -0
- package/src/components/Alert/Alert.mdx +36 -0
- package/src/components/Alert/Alert.stories.ts +115 -0
- package/src/components/Alert/Alert.vue +248 -0
- package/src/components/Alert/locales.ts +3 -0
- package/src/components/Alert/tests/Alert.spec.ts +105 -0
- package/src/components/Alert/tests/__snapshots__/Alert.spec.ts.snap +15 -0
- package/src/components/BackBtn/BackBtn.mdx +26 -0
- package/src/components/BackBtn/BackBtn.stories.ts +138 -0
- package/src/components/BackBtn/BackBtn.vue +60 -0
- package/src/components/BackBtn/locales.ts +3 -0
- package/src/components/BackBtn/tests/BackBtn.spec.ts +103 -0
- package/src/components/BackBtn/tests/__snapshots__/BackBtn.spec.ts.snap +9 -0
- package/src/components/BackToTopBtn/BackToTopBtn.mdx +52 -0
- package/src/components/BackToTopBtn/BackToTopBtn.stories.ts +188 -0
- package/src/components/BackToTopBtn/BackToTopBtn.vue +137 -0
- package/src/components/BackToTopBtn/config.ts +12 -0
- package/src/components/BackToTopBtn/locales.ts +3 -0
- package/src/components/BackToTopBtn/tests/BackToTopBtn.spec.ts +173 -0
- package/src/components/BackToTopBtn/tests/__snapshots__/BackToTopBtn.spec.ts.snap +17 -0
- package/src/components/Beta/beta.mdx +5 -0
- package/src/components/CopyBtn/CopyBtn.mdx +38 -0
- package/src/components/CopyBtn/CopyBtn.stories.ts +209 -0
- package/src/components/CopyBtn/CopyBtn.vue +103 -0
- package/src/components/CopyBtn/config.ts +17 -0
- package/src/components/CopyBtn/locales.ts +3 -0
- package/src/components/CopyBtn/tests/CopyBtn.spec.ts +99 -0
- package/src/components/CopyBtn/tests/__snapshots__/CopyBtn.spec.ts.snap +7 -0
- package/src/components/Deprecated/deprecated.mdx +5 -0
- package/src/components/DownloadBtn/DownloadBtn.mdx +94 -0
- package/src/components/DownloadBtn/DownloadBtn.stories.ts +211 -0
- package/src/components/DownloadBtn/DownloadBtn.vue +113 -0
- package/src/components/DownloadBtn/config.ts +13 -0
- package/src/components/DownloadBtn/tests/DownloadBtn.spec.ts +82 -0
- package/src/components/DownloadBtn/tests/__snapshots__/DownloadBtn.spec.ts.snap +17 -0
- package/src/components/DownloadBtn/tests/data/filePromise.ts +53 -0
- package/src/components/DownloadBtn/tests/data/test.json +0 -0
- package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +34 -0
- package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +92 -0
- package/src/components/FranceConnectBtn/FranceConnectBtn.vue +154 -0
- package/src/components/FranceConnectBtn/locales.ts +6 -0
- package/src/components/FranceConnectBtn/tests/FranceConnectBtn.spec.ts +62 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/FranceConnectBtn.spec.ts.snap +36 -0
- package/src/components/LangBtn/LangBtn.mdx +37 -0
- package/src/components/LangBtn/LangBtn.stories.ts +147 -0
- package/src/components/LangBtn/LangBtn.vue +167 -0
- package/src/components/LangBtn/config.ts +17 -0
- package/src/components/LangBtn/locales.ts +3 -0
- package/src/components/LangBtn/tests/Config.spec.ts +24 -0
- package/src/components/LangBtn/tests/LangBtn.spec.ts +283 -0
- package/src/components/LangBtn/tests/__snapshots__/LangBtn.spec.ts.snap +11 -0
- package/src/components/LangBtn/types.d.ts +7 -0
- package/src/components/NotificationBar/NotificationBar.mdx +94 -0
- package/src/components/NotificationBar/NotificationBar.stories.ts +366 -0
- package/src/components/NotificationBar/NotificationBar.vue +296 -0
- package/src/components/NotificationBar/options.ts +15 -0
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +332 -0
- package/src/components/NotificationBar/tests/__snapshots__/NotificationBar.spec.ts.snap +7 -0
- package/src/components/NotificationBar/types.ts +7 -0
- package/src/components/PageContainer/PageContainer.mdx +29 -0
- package/src/components/PageContainer/PageContainer.stories.ts +115 -0
- package/src/components/PageContainer/PageContainer.vue +68 -0
- package/src/components/PageContainer/tests/PageContainer.spec.ts +56 -0
- package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +7 -0
- package/src/components/SkipLink/SkipLink.mdx +55 -0
- package/src/components/SkipLink/SkipLink.stories.ts +70 -0
- package/src/components/SkipLink/SkipLink.vue +79 -0
- package/src/components/SkipLink/locales.ts +3 -0
- package/src/components/SkipLink/tests/__snapshots__/skipLink.spec.ts.snap +3 -0
- package/src/components/SkipLink/tests/skipLink.spec.ts +46 -0
- package/src/components/index.ts +8 -0
- package/src/composables/useCustomizableOptions.ts +23 -0
- package/src/designTokens/bootstrapColors.md +66 -0
- package/src/designTokens/cnamColors.md +193 -0
- package/src/designTokens/index.ts +15 -0
- package/src/designTokens/tokens/bootstrap/bootstrapColors.ts +158 -0
- package/src/designTokens/tokens/bootstrap/bootstrapLightTheme.ts +22 -0
- package/src/designTokens/tokens/cnam/cnamColors.ts +171 -0
- package/src/designTokens/tokens/cnam/cnamContextual.ts +58 -0
- package/src/designTokens/tokens/cnam/cnamLightTheme.ts +90 -0
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +87 -0
- package/src/designTokens/tokens/json/contextual-tokens.json +156 -0
- package/src/designTokens/tokens/json/primitives.json +209 -0
- package/src/designTokens/tokens/json/semantic.json +120 -0
- package/src/designTokens/utils/convertGaps.ts +11 -0
- package/src/designTokens/utils/convertSemanticsToken.ts +32 -0
- package/src/designTokens/utils/createFlattenTheme.ts +19 -0
- package/src/designTokens/utils/index.ts +4 -0
- package/src/main.ts +2 -0
- package/src/services/NotificationService.ts +27 -0
- package/src/stories/Fondamentaux/Accessibilite/Accessibilite.mdx +52 -0
- package/src/stories/Fondamentaux/Accessibilite/Accessibilite.stories.ts +36 -0
- package/src/stories/Fondamentaux/Accessibilite/AccessibiliteItems.ts +706 -0
- package/src/stories/Fondamentaux/Accessibilite/constants/ExpertiseLevelEnum.ts +5 -0
- package/src/stories/Fondamentaux/Accessibilite/constants/RGAALevelEnum.ts +4 -0
- package/src/stories/Fondamentaux/EcoConception/EcoConception.mdx +24 -0
- package/src/stories/Fondamentaux/EcoConception/Econception.stories.ts +30 -0
- package/src/stories/Fondamentaux/EcoConception/ecoDesignItems.ts +55 -0
- package/src/stories/GuideDuDev/CommentContribuer.mdx +22 -0
- package/src/stories/GuideDuDev/components.stories.ts +23 -0
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +182 -0
- package/src/stories/GuideDuDev/vuetifyOptions.mdx +72 -0
- package/src/stories/Guidelines/Colors.mdx +220 -0
- package/src/stories/Guidelines/CustomisationEtThemes.mdx +3 -0
- package/src/stories/Guidelines/Introduction.mdx +35 -0
- package/src/stories/Guidelines/Typo.mdx +53 -0
- package/src/stories/Home/Accueil.mdx +7 -0
- package/src/stories/Home/PolitiqueDeConfidentialite.mdx +4 -0
- package/src/stories/Home/synapse.webp +0 -0
- package/src/temp/TestA11y.vue +14 -0
- package/src/temp/TestComponent.vue +37 -0
- package/src/temp/TestDTComponent.vue +93 -0
- package/src/temp/customizableOptions.vue +18 -0
- package/src/temp/gridsTests.vue +54 -0
- package/src/temp/options.json +5 -0
- package/src/types/vuetifyTypes.ts +3 -0
- package/src/utils/convertToUnit/index.ts +16 -0
- package/src/utils/convertToUnit/test/convertToUnit.spec.ts +32 -0
- package/src/utils/functions/copyToClipboard/index.ts +38 -0
- package/src/utils/functions/copyToClipboard/tests/copyToClipboard.spec.ts +104 -0
- package/src/utils/functions/downloadFile/index.ts +37 -0
- package/src/utils/functions/downloadFile/tests/downloadFile.spec.ts +69 -0
- package/src/utils/functions/downloadFile/types.ts +1 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/addon-docs';
|
|
2
|
+
import * as EcoStories from './Econception.stories.ts';
|
|
3
|
+
|
|
4
|
+
<Meta of={EcoStories} />
|
|
5
|
+
|
|
6
|
+
# Éco-conception
|
|
7
|
+
|
|
8
|
+
<br></br>
|
|
9
|
+
|
|
10
|
+
### L’éco-conception est une approche méthodique qui prend en considération les aspects environnementaux du processus de conception et de développement dans le but de réduire les impacts environnementaux négatifs.
|
|
11
|
+
|
|
12
|
+
<br></br>
|
|
13
|
+
|
|
14
|
+
##### La liste suivante énumère les points auxquels vous devez faire attention pendant la conception ainsi que le développement de votre application.
|
|
15
|
+
|
|
16
|
+
<br></br>
|
|
17
|
+
|
|
18
|
+
<Story of={EcoStories.EcoPanel} />
|
|
19
|
+
|
|
20
|
+
<br></br>
|
|
21
|
+
|
|
22
|
+
### Évaluer son projet
|
|
23
|
+
|
|
24
|
+
Pour évaluer l’éco-conception de votre projet, vous pouvez utiliser [Ecoindex](http://www.ecoindex.fr/) ou [Ecometer](http://www.ecometer.org/).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { VExpansionPanels, VExpansionPanel } from 'vuetify/components'
|
|
2
|
+
import type { StoryObj } from '@storybook/vue3'
|
|
3
|
+
import { ecoDesignItems } from '@/stories/Fondamentaux/EcoConception/ecoDesignItems'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Fondamentaux/EcoConception',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const EcoPanel: StoryObj = {
|
|
10
|
+
render: () => {
|
|
11
|
+
return {
|
|
12
|
+
components: { VExpansionPanels, VExpansionPanel },
|
|
13
|
+
setup() {
|
|
14
|
+
return { ecoDesignItems }
|
|
15
|
+
},
|
|
16
|
+
template: `
|
|
17
|
+
<v-expansion-panels>
|
|
18
|
+
<v-expansion-panel
|
|
19
|
+
v-for="(item, index) in ecoDesignItems"
|
|
20
|
+
:key="index"
|
|
21
|
+
:text="item.description"
|
|
22
|
+
:title="item.title"
|
|
23
|
+
variant="accordion"
|
|
24
|
+
></v-expansion-panel>
|
|
25
|
+
</v-expansion-panels>
|
|
26
|
+
`,
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
tags: ['!dev'],
|
|
30
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const ecoDesignItems = [
|
|
2
|
+
{
|
|
3
|
+
title: 'Catégorie 1: Design',
|
|
4
|
+
description: `Privilégier un design épuré. Un bon design n’a pas besoin d’être chargé pour être agréable, au contraire.
|
|
5
|
+
|
|
6
|
+
Certains composants ne sont souvent pas utiles, et ne servent qu’à habiller une page.<br>
|
|
7
|
+
Le carrousel est un bon exemple\xa0: c’est un composant lourd, comportant à la fois du JavaScript et des images de grandes tailles.
|
|
8
|
+
Il est pourtant rarement indispensable à la navigation et fait souvent doublon avec le menu.`,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: 'Catégorie 2: Couleurs',
|
|
12
|
+
description: 'Le fond d’écran noir permet d’économiser de l’énergie sur les écrans OLED. Il est donc important de prévoir le mode sombre sur les nouveaux composants.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: 'Catégorie 3: Images',
|
|
16
|
+
description: `Le choix des images est important.
|
|
17
|
+
Pour les formats standards JPEG et PNG, il faudra trouver le bon taux de compression pour ne pas dégrader l’expérience utilisateur.
|
|
18
|
+
Une bonne alternative est de les remplacer par des images au format WEBP, en gardant les autres formats pour les navigateurs ne supportant pas ce format.
|
|
19
|
+
|
|
20
|
+
La taille est également importante. Pour économiser encore plus d’espace, les images doivent être rognées aux bonnes dimensions.
|
|
21
|
+
Le format vectoriel SVG est nettement plus léger: il doit être privilégié pour chaque image graphique compatible avec ce format.`,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: 'Catégorie 4: Vidéos',
|
|
25
|
+
description: `La première chose à faire avant d’ajouter une vidéo est de se demander si elle est vraiment nécessaire.
|
|
26
|
+
En effet, les vidéos demandent beaucoup de ressources: elles ne doivent donc pas être ajoutées juste pour illustrer ou pour remplir de l’espace.
|
|
27
|
+
|
|
28
|
+
Dans le cas où elles sont nécessaires, la lecture automatique doit être désactivée, surtout s’il y a du son dans la vidéo, et vous devez également mettre en place le chargement différé sur chaque vidéo.
|
|
29
|
+
|
|
30
|
+
L’utilisation de vidéos doit être privilégiée à la place des GIF.`,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: 'Catégorie 5: Animations',
|
|
34
|
+
description: `Comme pour les vidéos, la première chose concernant les animations est de se demander si elles sont vraiment nécessaires\xa0: servent-elles le design ou sont-elles seulement décoratives\xa0?
|
|
35
|
+
Si elles n’ont pas de réel intérêt, il vaut mieux ne pas les ajouter.
|
|
36
|
+
Le JavaScript est une technologie énergivore, il est donc important de le réserver aux tâches qui nécessitent vraiment de la logique.
|
|
37
|
+
|
|
38
|
+
Autant que possible, il vaut mieux privilégier les effets en CSS plutôt qu’en JavaScript.`,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
title: 'Catégorie 6: Librairies',
|
|
42
|
+
description: `L’accumulation de librairies est une cause récurrente de ralentissement des applications Web, et donc de consommation excessive d’énergie.
|
|
43
|
+
Le Design System est basé sur le framework Vuetify: il embarque donc la plupart des outils qui seront nécessaires au développement des applications.
|
|
44
|
+
|
|
45
|
+
Si toutefois vous ne trouvez pas ce dont vous avez besoin dans les librairies présentes dans le projet, l’installation d’une nouvelle librairie doit se faire avec beaucoup de prudence.
|
|
46
|
+
Il faudra trouver la librairie la plus légère et adaptée possible, l’outil [Bundlephobia](https://bundlephobia.com) permet d’évaluer rapidement la taille d’une librairie.`,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: 'Catégorie 7: Fonctionnalités',
|
|
50
|
+
description: `Comme toujours, la première question à se poser est\xa0: est-ce que ma fonctionnalité est vraiment nécessaire\xa0? Ne fait-elle pas doublon avec une déjà existante\xa0?
|
|
51
|
+
|
|
52
|
+
Dans le cas où elle est bien nécessaire, votre nouvelle fonctionnalité doit faire une chose précise. Moins elle enclenchera d’action, moins elle nécessitera d’énergie.
|
|
53
|
+
Il faut aussi faire attention à la façon de développer la fonctionnalité\xa0: les boucles inutiles ou les requêtes intempestives nécessitent là encore beaucoup de ressources, il faut donc veiller à le faire à bon escient.`,
|
|
54
|
+
},
|
|
55
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as ComponentStories from './components.stories.ts';
|
|
3
|
+
|
|
4
|
+
<Meta of={ComponentStories} />
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Rapport de bug
|
|
8
|
+
--------------
|
|
9
|
+
|
|
10
|
+
##### Lorsque vous constatez un bug dans l'un des packages du Design System, vous pouvez créer un rapport de bug pour notifier l'équipe de celui-ci.
|
|
11
|
+
|
|
12
|
+
##### Avant d'ouvrir un nouveau rapport de bug, vérifiez:
|
|
13
|
+
|
|
14
|
+
- Qu'un rapport similaire n'ait pas déjà été ouvert en cherchant dans les [rapports existants](https://github.com/assurance-maladie-digital/design-system-v3/issues)
|
|
15
|
+
- Que le bug est toujours présent dans la dernière version du package concerné
|
|
16
|
+
|
|
17
|
+
<br></br>
|
|
18
|
+
### Créer un rapport de bug
|
|
19
|
+
|
|
20
|
+
<Story of={ComponentStories.Info} />
|
|
21
|
+
|
|
22
|
+
Une fois ces vérifications effectuées, vous pouvez [créer un rapport de bug](https://github.com/assurance-maladie-digital/design-system-v3/issues/new?template=bug_report.md). Lors de l'écriture de votre rapport de bug, essayez de donner le plus de détails possible.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Alert from '../../components/Alert/Alert.vue'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Guide Du Dev/Rapport de bug',
|
|
5
|
+
component: Alert,
|
|
6
|
+
}
|
|
7
|
+
export const Info = {
|
|
8
|
+
render: () => {
|
|
9
|
+
return {
|
|
10
|
+
components: { Alert },
|
|
11
|
+
setup() {
|
|
12
|
+
return { }
|
|
13
|
+
},
|
|
14
|
+
template: `
|
|
15
|
+
<Alert type="info" variant="tonal" :closable="false">
|
|
16
|
+
<template #default>Lorsque vous créez une reproduction minimale, supprimez tous les éléments, propriétés, variables, données et autres qui ne sont pas nécessaires pour reproduire le bug. Cela facilitera le traitement du rapport et le temps qu’il faudra pour identifier puis résoudre le bug.
|
|
17
|
+
</template>
|
|
18
|
+
</Alert>
|
|
19
|
+
`,
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
tags: ['!dev'],
|
|
23
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Guide Du Dev/Services/useNotificationService" />
|
|
4
|
+
# useNotificationService
|
|
5
|
+
|
|
6
|
+
`useNotificationService` est un service Vue qui permet de gérer une file d'attente de notifications. Il fournit des méthodes pour ajouter, supprimer et effacer des notifications dans la file d'attente. Ce service est conçu pour être utilisé avec des composants de notification dans une application Vue.js.
|
|
7
|
+
|
|
8
|
+
## Importation et utilisation
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
import { useNotificationService } from '@/services/useNotificationService'
|
|
12
|
+
|
|
13
|
+
const { notificationQueue, addNotification, removeNotification, clearQueue } = useNotificationService()
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Propriétés et Méthodes:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
notificationQueue: Ref<Notification[]>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Une référence réactive à la file d'attente des notifications. Elle contient un tableau d'objets de type Notification.
|
|
23
|
+
|
|
24
|
+
``` addNotification(notification: Notification): void ```
|
|
25
|
+
|
|
26
|
+
Ajoute une nouvelle notification à la file d'attente, à condition qu'une notification avec le même id ne soit pas déjà présente.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
addNotification({
|
|
30
|
+
id: 'notif-1',
|
|
31
|
+
message: 'Notification 1',
|
|
32
|
+
type: 'info',
|
|
33
|
+
duration: 5000
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
removeNotification(id: string): void
|
|
39
|
+
```
|
|
40
|
+
Supprime une notification de la file d'attente en fonction de son id.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
removeNotification('notif-1')
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
clearQueue(): void
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Efface toutes les notifications de la file d'attente.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
clearQueue()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Typage de Notification
|
|
58
|
+
|
|
59
|
+
Le type Notification est défini comme suit :
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
type Notification = {
|
|
64
|
+
id: string
|
|
65
|
+
message: string
|
|
66
|
+
type: 'success' | 'error' | 'info' | 'warning'
|
|
67
|
+
duration?: number
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
Propriétés de Notification
|
|
71
|
+
```
|
|
72
|
+
id: string — Identifiant unique de la notification.
|
|
73
|
+
message: string — Le texte à afficher dans la notification.
|
|
74
|
+
type: 'success' | 'error' | 'info' | 'warning' — Le type de la notification, qui peut influencer son apparence.
|
|
75
|
+
duration?: number — Durée pendant laquelle la notification sera visible (en millisecondes).
|
|
76
|
+
```
|
|
77
|
+
Exemples d'utilisation
|
|
78
|
+
Ajouter une notification
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
const { addNotification } = useNotificationService()
|
|
83
|
+
|
|
84
|
+
addNotification({
|
|
85
|
+
id: 'notif-2',
|
|
86
|
+
message: 'Votre téléchargement est terminé',
|
|
87
|
+
type: 'success',
|
|
88
|
+
duration: 3000
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
Supprimer une notification
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
const { removeNotification } = useNotificationService()
|
|
95
|
+
|
|
96
|
+
removeNotification('notif-2')
|
|
97
|
+
```
|
|
98
|
+
Effacer la file d'attente de notifications
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
const { clearQueue } = useNotificationService()
|
|
103
|
+
|
|
104
|
+
clearQueue()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Accéder à la file d'attente
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
const { notificationQueue } = useNotificationService()
|
|
111
|
+
|
|
112
|
+
console.log(notificationQueue.value) // Affiche toutes les notifications présentes dans la file d'attente
|
|
113
|
+
```
|
|
114
|
+
Utilisation dans un composant Vue
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
<script setup lang="ts">
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
import { VBtn } from 'vuetify/components'
|
|
120
|
+
import NotificationBar from '@/components/NotificationBar/NotificationBar.vue'
|
|
121
|
+
import { useNotificationService } from '@/services/NotificationService'
|
|
122
|
+
import type { Notification } from '@/components/NotificationBar/types'
|
|
123
|
+
|
|
124
|
+
const { addNotification } = useNotificationService()
|
|
125
|
+
|
|
126
|
+
const envoyerNotification = (message: string, type: Notification['type']) => {
|
|
127
|
+
const notification: Notification = {
|
|
128
|
+
id: Date.now().toString(),
|
|
129
|
+
message,
|
|
130
|
+
type,
|
|
131
|
+
timeout: -1,
|
|
132
|
+
}
|
|
133
|
+
addNotification(notification)
|
|
134
|
+
}
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<template>
|
|
138
|
+
<div>
|
|
139
|
+
<NotificationBar
|
|
140
|
+
bottom
|
|
141
|
+
rounded="lg"
|
|
142
|
+
>
|
|
143
|
+
<template #action>
|
|
144
|
+
<VBtn variant="outlined">
|
|
145
|
+
Valider
|
|
146
|
+
</VBtn>
|
|
147
|
+
</template>
|
|
148
|
+
</NotificationBar>
|
|
149
|
+
|
|
150
|
+
<div class="button-group">
|
|
151
|
+
<VBtn
|
|
152
|
+
color="info"
|
|
153
|
+
@click="envoyerNotification('Première notification', 'info')"
|
|
154
|
+
>
|
|
155
|
+
Envoyer Notification 1
|
|
156
|
+
</VBtn>
|
|
157
|
+
<VBtn
|
|
158
|
+
color="success"
|
|
159
|
+
@click="envoyerNotification('Deuxième notification', 'success')"
|
|
160
|
+
>
|
|
161
|
+
Envoyer Notification 2
|
|
162
|
+
</VBtn>
|
|
163
|
+
<VBtn
|
|
164
|
+
color="error"
|
|
165
|
+
@click="envoyerNotification('Troisième notification', 'error')"
|
|
166
|
+
>
|
|
167
|
+
Envoyer Notification 3
|
|
168
|
+
</VBtn>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<style scoped>
|
|
174
|
+
.button-group {
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
gap: 16px;
|
|
178
|
+
margin-top: 20px;
|
|
179
|
+
}
|
|
180
|
+
</style>
|
|
181
|
+
|
|
182
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Guide Du Dev/VuetifyOptions" />
|
|
4
|
+
|
|
5
|
+
# VuetifyOptions
|
|
6
|
+
|
|
7
|
+
Notre design system propose un ensemble de composants Vuetify personnalisables.
|
|
8
|
+
Pour permettre une flexibilité maximale, chaque composant expose une prop vuetifyOptions qui permet de surcharger les options par défaut de Vuetify avec des options spécifiques à votre besoin.
|
|
9
|
+
|
|
10
|
+
La gestion de ces options est facilitée par un mécanisme interne qui fusionne les options par défaut du composant avec celles que vous fournissez, en veillant à ce que les deux ensembles d'options soient correctement combinés.
|
|
11
|
+
Utilisation de vuetifyOptions
|
|
12
|
+
|
|
13
|
+
Certains composants du design system acceptent une prop vuetifyOptions qui vous permet de personnaliser le comportement et le style du composant basé sur Vuetify.
|
|
14
|
+
Vous trouverez des exemples de configurations directement dans la documentation de chaque composant que nous proposons pour mieux comprendre comment les personnaliser.
|
|
15
|
+
|
|
16
|
+
Exemple d'utilisation dans un composant vuetify:
|
|
17
|
+
|
|
18
|
+
Prenons l'exemple d'un bouton (VBtn).
|
|
19
|
+
|
|
20
|
+
Voici un exemple d'utilisation du composant :
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
|
|
24
|
+
<MyButton
|
|
25
|
+
:title="'Cliquez ici'"
|
|
26
|
+
:vuetifyOptions="{ btn: { color: 'secondary', icon: true } }"
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
Dans cet exemple :
|
|
30
|
+
|
|
31
|
+
Le texte du bouton est défini via la prop title.
|
|
32
|
+
Vous pouvez passer un objet vuetifyOptions pour personnaliser les propriétés du composant Vuetify sous-jacent (ici, VBtn).
|
|
33
|
+
|
|
34
|
+
Explication
|
|
35
|
+
|
|
36
|
+
Propriétés de Vuetify : Vous pouvez configurer n'importe quelle option reconnue par Vuetify. Par exemple, pour un bouton (VBtn), vous pourriez ajuster sa couleur, son icône, son style (outlined, elevation, etc.).
|
|
37
|
+
|
|
38
|
+
Fusion des options : Le design system gère la fusion des options par défaut et celles que vous fournissez dans vuetifyOptions. Si vous ne définissez pas une option spécifique, la valeur par défaut sera utilisée.
|
|
39
|
+
|
|
40
|
+
Exemple détaillé
|
|
41
|
+
|
|
42
|
+
Voici un exemple plus complet :
|
|
43
|
+
```
|
|
44
|
+
vue
|
|
45
|
+
|
|
46
|
+
<MyButton
|
|
47
|
+
:title="'Valider'"
|
|
48
|
+
:vuetifyOptions="{ btn: { color: 'primary', outlined: false, icon: true } }"
|
|
49
|
+
/>
|
|
50
|
+
```
|
|
51
|
+
Dans cet exemple :
|
|
52
|
+
|
|
53
|
+
Le bouton sera bleu (color: 'primary').
|
|
54
|
+
Il n'aura pas de contour (outlined: false).
|
|
55
|
+
Une icône sera affichée sur le bouton (icon: true).
|
|
56
|
+
|
|
57
|
+
Options par défaut
|
|
58
|
+
|
|
59
|
+
Chaque composant du design system dispose d'options par défaut qui lui assurent un style et un comportement cohérents. Cependant, si vous souhaitez personnaliser ces options, vous pouvez utiliser la prop vuetifyOptions pour adapter ces composants à vos besoins spécifiques sans compromettre la structure de base du design system.
|
|
60
|
+
Exemple de bouton par défaut
|
|
61
|
+
|
|
62
|
+
Sans fournir de vuetifyOptions, le bouton pourrait ressembler à ceci :
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
|
|
66
|
+
<MyButton :title="'Par défaut'" />
|
|
67
|
+
```
|
|
68
|
+
Ce bouton utilisera les options par défaut définies dans le design system, telles que la couleur, le style de bordure ou les icônes.
|
|
69
|
+
|
|
70
|
+
Conclusion
|
|
71
|
+
|
|
72
|
+
L'intégration des vuetifyOptions dans les composants de ce design system vous offre une grande flexibilité pour personnaliser les composants en fonction de vos besoins spécifiques. Grâce à ce mécanisme, vous pouvez ajuster des propriétés telles que la couleur, les icônes et d'autres configurations Vuetify tout en vous appuyant sur des valeurs par défaut bien définies. Vous n'avez pas à vous soucier de la gestion interne des options : il vous suffit de passer les options personnalisées via la prop vuetifyOptions, et le composant s'adaptera automatiquement.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { Meta, ColorPalette, ColorItem } from '@storybook/addon-docs';
|
|
2
|
+
import { cnamLightTheme } from "@/designTokens/tokens/cnam/cnamLightTheme.ts";
|
|
3
|
+
import { cnamColorsTokens } from '@/designTokens/tokens/cnam/cnamColors.ts'
|
|
4
|
+
|
|
5
|
+
<Meta title="Guidelines/Couleurs" />
|
|
6
|
+
|
|
7
|
+
# Couleurs
|
|
8
|
+
|
|
9
|
+
Les couleurs contribuent à l’identification de nos applications ou services et font partie intégrante de la marque Assurance Maladie. Elles assurent l’homogénéité graphique des interfaces.
|
|
10
|
+
|
|
11
|
+
## Couleurs de base
|
|
12
|
+
<ColorPalette className="vertical-palette">
|
|
13
|
+
<ColorItem
|
|
14
|
+
colors={{
|
|
15
|
+
primary: cnamColorsTokens.blue.base,
|
|
16
|
+
secondary: cnamColorsTokens.cyan.darken40,
|
|
17
|
+
accent: cnamColorsTokens.cyan.base,
|
|
18
|
+
error: cnamColorsTokens.orange.darken20,
|
|
19
|
+
info: cnamColorsTokens.blue.base,
|
|
20
|
+
success: cnamColorsTokens.green.base,
|
|
21
|
+
warning: cnamColorsTokens.yellow.base,
|
|
22
|
+
risquePro: cnamColorsTokens.brick.base
|
|
23
|
+
}}
|
|
24
|
+
/>
|
|
25
|
+
</ColorPalette>
|
|
26
|
+
|
|
27
|
+
## Interactive Colors
|
|
28
|
+
<ColorPalette className="vertical-palette">
|
|
29
|
+
<ColorItem
|
|
30
|
+
colors={{
|
|
31
|
+
interactiveDefault: cnamLightTheme.interactiveDefault,
|
|
32
|
+
interactiveHover: cnamLightTheme.interactiveHover,
|
|
33
|
+
interactivePressed: cnamLightTheme.interactivePressed,
|
|
34
|
+
interactiveFocus: cnamLightTheme.interactiveFocus,
|
|
35
|
+
interactiveDisabled: cnamLightTheme.interactiveDisabled,
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
<ColorItem
|
|
39
|
+
colors={{
|
|
40
|
+
interactiveHoverOnSelected: cnamLightTheme.interactiveHoverOnSelected,
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
</ColorPalette>
|
|
44
|
+
|
|
45
|
+
## Border Colors
|
|
46
|
+
<ColorPalette className="vertical-palette">
|
|
47
|
+
<ColorItem
|
|
48
|
+
colors={{
|
|
49
|
+
borderDarker: cnamLightTheme.borderDarker,
|
|
50
|
+
borderBase: cnamLightTheme.borderBase,
|
|
51
|
+
borderSubdued: cnamLightTheme.borderSubdued,
|
|
52
|
+
borderAccent: cnamLightTheme.borderAccent,
|
|
53
|
+
borderAccentContrasted: cnamLightTheme.borderAccentContrasted,
|
|
54
|
+
borderAccentOnDark: cnamLightTheme.borderAccentOnDark
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<ColorItem
|
|
59
|
+
colors={{
|
|
60
|
+
borderInfo: cnamLightTheme.borderInfo,
|
|
61
|
+
borderSuccess: cnamLightTheme.borderSuccess,
|
|
62
|
+
borderWarning: cnamLightTheme.borderWarning,
|
|
63
|
+
borderError: cnamLightTheme.borderError,
|
|
64
|
+
borderOnDark: cnamLightTheme.borderOnDark,
|
|
65
|
+
borderDisabled: cnamLightTheme.borderDisabled,
|
|
66
|
+
borderDisabledOnDark: cnamLightTheme.borderDisabledOnDark
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</ColorPalette>
|
|
70
|
+
|
|
71
|
+
## Text Colors
|
|
72
|
+
<ColorPalette className="vertical-palette">
|
|
73
|
+
<ColorItem
|
|
74
|
+
colors={{
|
|
75
|
+
textBase: cnamLightTheme.textBase,
|
|
76
|
+
textAccent: cnamLightTheme.textAccent,
|
|
77
|
+
textAccentContrasted: cnamLightTheme.textAccentContrasted,
|
|
78
|
+
textSubdued: cnamLightTheme.textSubdued,
|
|
79
|
+
textInfo: cnamLightTheme.textInfo,
|
|
80
|
+
textSuccess: cnamLightTheme.textSuccess
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<ColorItem
|
|
85
|
+
colors={{
|
|
86
|
+
textWarning: cnamLightTheme.textWarning,
|
|
87
|
+
textError: cnamLightTheme.textError,
|
|
88
|
+
textDisabled: cnamLightTheme.textDisabled,
|
|
89
|
+
textOnDark: cnamLightTheme.textOnDark,
|
|
90
|
+
textSubduedOnDark: cnamLightTheme.textSubduedOnDark,
|
|
91
|
+
textDisabledOnDark: cnamLightTheme.textDisabledOnDark
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
</ColorPalette>
|
|
95
|
+
|
|
96
|
+
## Icons
|
|
97
|
+
<ColorPalette>
|
|
98
|
+
<ColorItem
|
|
99
|
+
colors={{
|
|
100
|
+
textBase: cnamLightTheme.iconBase,
|
|
101
|
+
textSubdued: cnamLightTheme.iconSubdued,
|
|
102
|
+
textSubduedOnDark: cnamLightTheme.iconSubduedOnDark,
|
|
103
|
+
textAccent: cnamLightTheme.iconAccent,
|
|
104
|
+
textAccentContrasted: cnamLightTheme.iconAccentContrasted
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<ColorItem
|
|
109
|
+
colors={{
|
|
110
|
+
textInfo: cnamLightTheme.iconInfo,
|
|
111
|
+
textSuccess: cnamLightTheme.iconSuccess,
|
|
112
|
+
textWarning: cnamLightTheme.iconWarning,
|
|
113
|
+
textError: cnamLightTheme.iconError,
|
|
114
|
+
textOnDark: cnamLightTheme.iconOnDark
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
<ColorItem
|
|
119
|
+
colors={{
|
|
120
|
+
textDisabled: cnamLightTheme.iconDisabled,
|
|
121
|
+
textDisabledOnDark: cnamLightTheme.iconDisabledOnDark
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
</ColorPalette>
|
|
125
|
+
|
|
126
|
+
## Background Colors
|
|
127
|
+
|
|
128
|
+
### Main Backgrounds
|
|
129
|
+
<ColorPalette className="vertical-palette">
|
|
130
|
+
<ColorItem
|
|
131
|
+
colors={{
|
|
132
|
+
backgroundMain: cnamLightTheme.backgroundMain,
|
|
133
|
+
backgroundSurface: cnamLightTheme.backgroundSurface,
|
|
134
|
+
backgroundSurfaceAlt: cnamLightTheme.backgroundSurfaceAlt
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
</ColorPalette>
|
|
138
|
+
|
|
139
|
+
### Alternative Backgrounds
|
|
140
|
+
<ColorPalette className="vertical-palette">
|
|
141
|
+
<ColorItem
|
|
142
|
+
colors={{
|
|
143
|
+
backgroungMainAlt: cnamLightTheme.backgroungMainAlt,
|
|
144
|
+
backgroungRaised: cnamLightTheme.backgroungRaised,
|
|
145
|
+
backgroundAccent: cnamLightTheme.backgroundAccent,
|
|
146
|
+
backgroungAccentContrasted: cnamLightTheme.backgroungAccentContrasted,
|
|
147
|
+
backgroundAccentAlt: cnamLightTheme.backgroundAccentAlt
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
</ColorPalette>
|
|
151
|
+
|
|
152
|
+
### Informational Backgrounds
|
|
153
|
+
<ColorPalette className="vertical-palette">
|
|
154
|
+
<ColorItem
|
|
155
|
+
colors={{
|
|
156
|
+
backgroundInfo: cnamLightTheme.backgroundInfo,
|
|
157
|
+
backgroundInfoSubdued: cnamLightTheme.backgroundInfoSubdued,
|
|
158
|
+
backgroundInfoContrasted: cnamLightTheme.backgroundInfoContrasted
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
</ColorPalette>
|
|
162
|
+
|
|
163
|
+
### Success Backgrounds
|
|
164
|
+
<ColorPalette className="vertical-palette">
|
|
165
|
+
<ColorItem
|
|
166
|
+
colors={{
|
|
167
|
+
backgroundSuccess: cnamLightTheme.backgroundSuccess,
|
|
168
|
+
backgroundSuccessSubdued: cnamLightTheme.backgroundSuccessSubdued,
|
|
169
|
+
backgroundSuccessContrasted: cnamLightTheme.backgroundSuccessContrasted
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
</ColorPalette>
|
|
173
|
+
|
|
174
|
+
### Warning Backgrounds
|
|
175
|
+
<ColorPalette className="vertical-palette">
|
|
176
|
+
<ColorItem
|
|
177
|
+
colors={{
|
|
178
|
+
backgroundWarning: cnamLightTheme.backgroundWarning,
|
|
179
|
+
backgroundWarningSubdued: cnamLightTheme.backgroundWarningSubdued,
|
|
180
|
+
backgroundWarningContrasted: cnamLightTheme.backgroundWarningContrasted
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
</ColorPalette>
|
|
184
|
+
|
|
185
|
+
### Error Backgrounds
|
|
186
|
+
<ColorPalette className="vertical-palette">
|
|
187
|
+
<ColorItem
|
|
188
|
+
colors={{
|
|
189
|
+
backgroundError: cnamLightTheme.backgroundError,
|
|
190
|
+
backgroundErrorSubdued: cnamLightTheme.backgroundErrorSubdued,
|
|
191
|
+
backgroundErrorContrasted: cnamLightTheme.backgroundErrorContrasted
|
|
192
|
+
}}
|
|
193
|
+
/>
|
|
194
|
+
</ColorPalette>
|
|
195
|
+
|
|
196
|
+
### Other Backgrounds
|
|
197
|
+
<ColorPalette className="vertical-palette">
|
|
198
|
+
<ColorItem
|
|
199
|
+
colors={{
|
|
200
|
+
backgroundDisabled: cnamLightTheme.backgroundDisabled,
|
|
201
|
+
backgroundDisabledOnDark: cnamLightTheme.backgroundDisabledOnDark,
|
|
202
|
+
backgroundAssure: cnamLightTheme.backgroundAssure,
|
|
203
|
+
backgroundProfessionnel: cnamLightTheme.backgroundProfessionnel,
|
|
204
|
+
backgroundEntreprise: cnamLightTheme.backgroundEntreprise
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
</ColorPalette>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## Transparent Background Colors
|
|
211
|
+
|
|
212
|
+
### Transparent Blues
|
|
213
|
+
<ColorPalette className="vertical-palette">
|
|
214
|
+
<ColorItem
|
|
215
|
+
colors={{
|
|
216
|
+
transparentBlue18: cnamLightTheme.transparentBlue18,
|
|
217
|
+
transparentBlue8: cnamLightTheme.transparentBlue8
|
|
218
|
+
}}
|
|
219
|
+
/>
|
|
220
|
+
</ColorPalette>
|