@cnamts/synapse 0.0.5-alpha → 0.0.7-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.
Files changed (229) hide show
  1. package/dist/design-system-v3.d.ts +487 -415
  2. package/dist/design-system-v3.js +2954 -2203
  3. package/dist/design-system-v3.umd.cjs +6 -6
  4. package/dist/style.css +1 -1
  5. package/package.json +17 -17
  6. package/src/assets/settings.scss +3 -0
  7. package/src/assets/tokens.scss +16 -16
  8. package/src/components/BackBtn/AccessibiliteItems.ts +0 -30
  9. package/src/components/BackBtn/BackBtn.mdx +1 -1
  10. package/src/components/BackBtn/BackBtn.stories.ts +12 -9
  11. package/src/components/BackBtn/BackBtn.vue +0 -1
  12. package/src/components/BackToTopBtn/AccessibiliteItems.ts +0 -30
  13. package/src/components/BackToTopBtn/BackToTopBtn.mdx +1 -1
  14. package/src/components/BackToTopBtn/BackToTopBtn.stories.ts +3 -3
  15. package/src/components/CollapsibleList/Accessibilite.stories.ts +4 -0
  16. package/src/components/CollapsibleList/AccessibiliteItems.ts +55 -62
  17. package/src/components/CollapsibleList/CollapsibleList.stories.ts +1 -1
  18. package/src/components/CookieBanner/Accessibilite.stories.ts +219 -0
  19. package/src/components/CookieBanner/AccessibiliteItems.ts +356 -0
  20. package/src/components/CookieBanner/CookieBanner.mdx +219 -0
  21. package/src/components/CookieBanner/CookieBanner.stories.ts +680 -0
  22. package/src/components/CookieBanner/CookieBanner.vue +225 -0
  23. package/src/components/CookieBanner/config.ts +38 -0
  24. package/src/components/CookieBanner/locales.ts +12 -0
  25. package/src/components/CookieBanner/tests/CookieBanner.spec.ts +129 -0
  26. package/src/components/CookieBanner/tests/__snapshots__/CookieBanner.spec.ts.snap +197 -0
  27. package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +123 -0
  28. package/src/components/CookiesSelection/CookiesInformation/locales.ts +21 -0
  29. package/src/components/CookiesSelection/CookiesInformation/tests/CookiesInformation.spec.ts +121 -0
  30. package/src/components/CookiesSelection/CookiesSelection.vue +127 -0
  31. package/src/components/CookiesSelection/CookiesTable/CookiesTable.vue +47 -0
  32. package/src/components/CookiesSelection/CookiesTable/headers.ts +14 -0
  33. package/src/components/CookiesSelection/CookiesTable/tests/CookiesTable.spec.ts +30 -0
  34. package/src/components/CookiesSelection/CookiesTable/tests/__snapshots__/CookiesTable.spec.ts.snap +3 -0
  35. package/src/components/CookiesSelection/locales.ts +10 -0
  36. package/src/components/CookiesSelection/tests/CookiesSelection.spec.ts +184 -0
  37. package/src/components/CookiesSelection/tests/__snapshots__/CookiesSelection.spec.ts.snap +192 -0
  38. package/src/components/CookiesSelection/types.ts +15 -0
  39. package/src/components/CopyBtn/AccessibiliteItems.ts +0 -30
  40. package/src/components/CopyBtn/CopyBtn.mdx +1 -1
  41. package/src/components/CopyBtn/CopyBtn.stories.ts +9 -6
  42. package/src/components/CopyBtn/CopyBtn.vue +0 -1
  43. package/src/components/Customs/SyBtnSelect/Accessibilite.mdx +14 -0
  44. package/src/components/Customs/SyBtnSelect/Accessibilite.stories.ts +193 -0
  45. package/src/components/Customs/SyBtnSelect/AccessibiliteItems.ts +139 -0
  46. package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +3 -2
  47. package/src/components/Customs/SyBtnSelect/SyBtnSelect.stories.ts +30 -14
  48. package/src/components/Customs/SyBtnSelect/SyBtnSelect.vue +21 -13
  49. package/src/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.ts +4 -0
  50. package/src/components/Customs/SyInputSelect/Accessibilite.mdx +14 -0
  51. package/src/components/Customs/SyInputSelect/Accessibilite.stories.ts +166 -0
  52. package/src/components/Customs/SyInputSelect/AccessibiliteItems.ts +96 -0
  53. package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +7 -3
  54. package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +24 -65
  55. package/src/components/Customs/SyInputSelect/SyInputSelect.vue +36 -4
  56. package/src/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.ts +4 -0
  57. package/src/components/Customs/SySelect/Accessibilite.mdx +14 -0
  58. package/src/components/Customs/SySelect/Accessibilite.stories.ts +217 -0
  59. package/src/components/Customs/SySelect/AccessibiliteItems.ts +173 -0
  60. package/src/components/Customs/SySelect/SySelect.mdx +4 -4
  61. package/src/components/Customs/SySelect/SySelect.stories.ts +4 -60
  62. package/src/components/Customs/SySelect/SySelect.vue +35 -8
  63. package/src/components/Customs/SySelect/constants/ExpertiseLevelEnum.ts +4 -0
  64. package/src/components/Customs/SyTextField/Accessibilite.mdx +14 -0
  65. package/src/components/Customs/SyTextField/Accessibilite.stories.ts +224 -0
  66. package/src/components/Customs/SyTextField/AccessibiliteItems.ts +198 -0
  67. package/src/components/Customs/SyTextField/SyTextField.mdx +1 -1
  68. package/src/components/Customs/SyTextField/SyTextField.stories.ts +118 -7
  69. package/src/components/Customs/SyTextField/SyTextField.vue +27 -7
  70. package/src/components/Customs/SyTextField/constants/ExpertiseLevelEnum.ts +4 -0
  71. package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +2 -1
  72. package/src/components/DataList/Accessibilite.mdx +14 -0
  73. package/src/components/DataList/Accessibilite.stories.ts +166 -0
  74. package/src/components/DataList/AccessibiliteItems.ts +47 -0
  75. package/src/components/DataList/DataList.mdx +1 -1
  76. package/src/components/DataList/DataList.stories.ts +10 -10
  77. package/src/components/DataList/constants/ExpertiseLevelEnum.ts +4 -0
  78. package/src/components/DataListGroup/Accessibilite.mdx +14 -0
  79. package/src/components/DataListGroup/Accessibilite.stories.ts +225 -0
  80. package/src/components/DataListGroup/AccessibiliteItems.ts +79 -0
  81. package/src/components/DataListGroup/DataListGroup.mdx +1 -1
  82. package/src/components/DataListGroup/DataListGroup.stories.ts +7 -7
  83. package/src/components/DataListGroup/constants/ExpertiseLevelEnum.ts +4 -0
  84. package/src/components/DialogBox/Accessibilite.mdx +14 -0
  85. package/src/components/DialogBox/Accessibilite.stories.ts +189 -0
  86. package/src/components/DialogBox/AccessibiliteItems.ts +167 -0
  87. package/src/components/DialogBox/constants/ExpertiseLevelEnum.ts +4 -0
  88. package/src/components/DownloadBtn/AccessibiliteItems.ts +1 -31
  89. package/src/components/DownloadBtn/DownloadBtn.mdx +5 -6
  90. package/src/components/DownloadBtn/DownloadBtn.stories.ts +25 -26
  91. package/src/components/ErrorPage/Accessibilite.mdx +14 -0
  92. package/src/components/ErrorPage/Accessibilite.stories.ts +189 -0
  93. package/src/components/ErrorPage/AccessibiliteItems.ts +205 -0
  94. package/src/components/ErrorPage/ErrorPage.vue +1 -1
  95. package/src/components/ErrorPage/constants/ExpertiseLevelEnum.ts +4 -0
  96. package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +4 -4
  97. package/src/components/FooterBar/Accessibilite.mdx +14 -0
  98. package/src/components/FooterBar/Accessibilite.stories.ts +223 -0
  99. package/src/components/FooterBar/AccessibiliteItems.ts +257 -0
  100. package/src/components/FooterBar/FooterBar.mdx +2 -2
  101. package/src/components/FooterBar/FooterBar.stories.ts +14 -14
  102. package/src/components/FooterBar/FooterBar.vue +86 -75
  103. package/src/components/FooterBar/constants/ExpertiseLevelEnum.ts +4 -0
  104. package/src/components/FooterBar/tests/__snapshots__/FooterBar.spec.ts.snap +22 -20
  105. package/src/components/FranceConnectBtn/AccessibiliteItems.ts +0 -30
  106. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +1 -1
  107. package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +5 -4
  108. package/src/components/HeaderBar/Accessibilite.mdx +14 -0
  109. package/src/components/HeaderBar/Accessibilite.stories.ts +223 -0
  110. package/src/components/HeaderBar/AccessibiliteItems.ts +194 -0
  111. package/src/components/HeaderBar/HeaderBar.stories.ts +19 -12
  112. package/src/components/HeaderBar/HeaderBar.vue +9 -12
  113. package/src/components/HeaderBar/HeaderBurgerMenu/Accessibilite.mdx +14 -0
  114. package/src/components/HeaderBar/HeaderBurgerMenu/Accessibilite.stories.ts +223 -0
  115. package/src/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.ts +174 -0
  116. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.vue +1 -0
  117. package/src/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.ts +4 -0
  118. package/src/components/HeaderBar/constants/ExpertiseLevelEnum.ts +4 -0
  119. package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +1 -1
  120. package/src/components/HeaderLoading/Accessibilite.mdx +14 -0
  121. package/src/components/HeaderLoading/Accessibilite.stories.ts +167 -0
  122. package/src/components/HeaderLoading/AccessibiliteItems.ts +29 -0
  123. package/src/components/HeaderLoading/HeaderLoading.mdx +1 -1
  124. package/src/components/HeaderLoading/HeaderLoading.stories.ts +1 -1
  125. package/src/components/HeaderLoading/constants/ExpertiseLevelEnum.ts +4 -0
  126. package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +104 -32
  127. package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +35 -33
  128. package/src/components/HeaderToolbar/Accessibilite.mdx +14 -0
  129. package/src/components/HeaderToolbar/Accessibilite.stories.ts +203 -0
  130. package/src/components/HeaderToolbar/AccessibiliteItems.ts +200 -0
  131. package/src/components/HeaderToolbar/HeaderToolbar.mdx +1 -1
  132. package/src/components/HeaderToolbar/HeaderToolbar.stories.ts +2 -2
  133. package/src/components/HeaderToolbar/HeaderToolbar.vue +24 -1
  134. package/src/components/HeaderToolbar/constants/ExpertiseLevelEnum.ts +4 -0
  135. package/src/components/LangBtn/Accessibilite.stories.ts +3 -1
  136. package/src/components/LangBtn/AccessibiliteItems.ts +0 -31
  137. package/src/components/LangBtn/LangBtn.mdx +1 -1
  138. package/src/components/LangBtn/LangBtn.stories.ts +4 -4
  139. package/src/components/LangBtn/LangBtn.vue +3 -2
  140. package/src/components/Logo/Accessibilite.mdx +14 -0
  141. package/src/components/Logo/Accessibilite.stories.ts +223 -0
  142. package/src/components/Logo/AccessibiliteItems.ts +155 -0
  143. package/src/components/Logo/Logo.mdx +1 -1
  144. package/src/components/Logo/Logo.stories.ts +8 -8
  145. package/src/components/Logo/constants/ExpertiseLevelEnum.ts +4 -0
  146. package/src/components/LogoBrandSection/Accessibilite.mdx +14 -0
  147. package/src/components/LogoBrandSection/Accessibilite.stories.ts +223 -0
  148. package/src/components/LogoBrandSection/AccessibiliteItems.ts +194 -0
  149. package/src/components/LogoBrandSection/constants/ExpertiseLevelEnum.ts +4 -0
  150. package/src/components/MaintenancePage/Accessibilite.mdx +14 -0
  151. package/src/components/MaintenancePage/Accessibilite.stories.ts +189 -0
  152. package/src/components/MaintenancePage/AccessibiliteItems.ts +173 -0
  153. package/src/components/MaintenancePage/constants/ExpertiseLevelEnum.ts +4 -0
  154. package/src/components/NirField/Accessibilite.mdx +14 -0
  155. package/src/components/NirField/Accessibilite.stories.ts +214 -0
  156. package/src/components/NirField/AccessibiliteItems.ts +243 -0
  157. package/src/components/NirField/NirField.mdx +213 -0
  158. package/src/components/NirField/NirField.stories.ts +412 -0
  159. package/src/components/NirField/NirField.vue +453 -0
  160. package/src/components/NirField/config.ts +16 -0
  161. package/src/components/NirField/constants/ExpertiseLevelEnum.ts +4 -0
  162. package/src/components/NirField/locales.ts +12 -0
  163. package/src/components/NirField/nirValidation.ts +42 -0
  164. package/src/components/NirField/tests/NirField.spec.ts +120 -0
  165. package/src/components/NotFoundPage/Accessibilite.mdx +14 -0
  166. package/src/components/NotFoundPage/Accessibilite.stories.ts +190 -0
  167. package/src/components/NotFoundPage/AccessibiliteItems.ts +205 -0
  168. package/src/components/NotFoundPage/constants/ExpertiseLevelEnum.ts +4 -0
  169. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +4 -4
  170. package/src/components/NotificationBar/AccessibiliteItems.ts +0 -30
  171. package/src/components/NotificationBar/NotificationBar.mdx +1 -1
  172. package/src/components/PageContainer/PageContainer.mdx +1 -1
  173. package/src/components/PageContainer/PageContainer.stories.ts +9 -9
  174. package/src/components/PageContainer/PageContainer.vue +24 -18
  175. package/src/components/PageContainer/tests/PageContainer.spec.ts +2 -2
  176. package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +2 -2
  177. package/src/components/PhoneField/Accessibilite.mdx +14 -0
  178. package/src/components/PhoneField/Accessibilite.stories.ts +216 -0
  179. package/src/components/PhoneField/AccessibiliteItems.ts +238 -0
  180. package/src/components/PhoneField/PhoneField.mdx +1 -1
  181. package/src/components/PhoneField/PhoneField.stories.ts +2 -2
  182. package/src/components/PhoneField/PhoneField.vue +0 -1
  183. package/src/components/PhoneField/constants/ExpertiseLevelEnum.ts +4 -0
  184. package/src/components/SkipLink/Accessibilite.stories.ts +1 -1
  185. package/src/components/SkipLink/SkipLink.stories.ts +2 -2
  186. package/src/components/SocialMediaLinks/Accessibilite.mdx +14 -0
  187. package/src/components/SocialMediaLinks/Accessibilite.stories.ts +170 -0
  188. package/src/components/SocialMediaLinks/AccessibiliteItems.ts +160 -0
  189. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +1 -1
  190. package/src/components/SocialMediaLinks/SocialMediaLinks.stories.ts +1 -1
  191. package/src/components/SocialMediaLinks/SocialMediaLinks.vue +7 -1
  192. package/src/components/SocialMediaLinks/constants/ExpertiseLevelEnum.ts +4 -0
  193. package/src/components/SocialMediaLinks/tests/__snapshots__/SocialMediaLinks.spec.ts.snap +2 -2
  194. package/src/components/SubHeader/Accessibilite.mdx +14 -0
  195. package/src/components/SubHeader/Accessibilite.stories.ts +166 -0
  196. package/src/components/SubHeader/AccessibiliteItems.ts +146 -0
  197. package/src/components/SubHeader/SubHeader.mdx +1 -1
  198. package/src/components/SubHeader/SubHeader.stories.ts +17 -14
  199. package/src/components/SubHeader/constants/ExpertiseLevelEnum.ts +4 -0
  200. package/src/components/SyAlert/Accessibilite.mdx +14 -0
  201. package/src/components/{Alert → SyAlert}/Accessibilite.stories.ts +1 -1
  202. package/src/components/{Alert → SyAlert}/AccessibiliteItems.ts +2 -32
  203. package/src/components/{Alert/Alert.mdx → SyAlert/SyAlert.mdx} +9 -9
  204. package/src/components/{Alert/Alert.stories.ts → SyAlert/SyAlert.stories.ts} +22 -22
  205. package/src/components/{Alert/Alert.vue → SyAlert/SyAlert.vue} +7 -0
  206. package/src/components/SyAlert/constants/ExpertiseLevelEnum.ts +4 -0
  207. package/src/components/{Alert/tests/Alert.spec.ts → SyAlert/tests/SyAlert.spec.ts} +5 -5
  208. package/src/components/{Alert/tests/__snapshots__/Alert.spec.ts.snap → SyAlert/tests/__snapshots__/SyAlert.spec.ts.snap} +2 -2
  209. package/src/components/UserMenuBtn/Accessibilite.mdx +14 -0
  210. package/src/components/UserMenuBtn/Accessibilite.stories.ts +189 -0
  211. package/src/components/UserMenuBtn/AccessibiliteItems.ts +155 -0
  212. package/src/components/UserMenuBtn/UserMenuBtn.mdx +17 -17
  213. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +121 -19
  214. package/src/components/UserMenuBtn/UserMenuBtn.vue +25 -29
  215. package/src/components/UserMenuBtn/config.ts +1 -1
  216. package/src/components/UserMenuBtn/constants/ExpertiseLevelEnum.ts +4 -0
  217. package/src/components/index.ts +11 -4
  218. package/src/composables/rules/tests/useFieldValidation.spec.ts +60 -58
  219. package/src/composables/rules/useFieldValidation.ts +65 -28
  220. package/src/main.ts +1 -0
  221. package/src/stories/GuideDuDev/CommentUtiliserLesRules.mdx +67 -79
  222. package/src/stories/GuideDuDev/components.stories.ts +5 -5
  223. package/src/stories/GuideDuDev/moduleDeNotification.mdx +1 -1
  224. package/src/stories/Guidelines/Vuetify/Vuetify.mdx +11 -0
  225. package/src/stories/Guidelines/Vuetify/Vuetify.stories.ts +138 -0
  226. package/src/stories/Guidelines/Vuetify/VuetifyItems.ts +350 -0
  227. /package/src/components/{Alert → CookieBanner}/Accessibilite.mdx +0 -0
  228. /package/src/components/{Alert → CookieBanner}/constants/ExpertiseLevelEnum.ts +0 -0
  229. /package/src/components/{Alert → SyAlert}/locales.ts +0 -0
@@ -0,0 +1,680 @@
1
+ import { type Meta, type StoryObj } from '@storybook/vue3'
2
+ import CookieBanner from './CookieBanner.vue'
3
+ import { fn } from '@storybook/test'
4
+ import { VBtn } from 'vuetify/components'
5
+ import { ref, watch } from 'vue'
6
+
7
+ const meta = {
8
+ title: 'Composants/Feedback/CookieBanner',
9
+ component: CookieBanner,
10
+ argTypes: {
11
+ 'modelValue': {
12
+ description: 'V-model, control la visibilité de la bannière',
13
+ control: { type: 'boolean' },
14
+ table: {
15
+ defaultValue: { summary: 'true' },
16
+ category: 'props',
17
+ },
18
+ },
19
+ 'items': {
20
+ description: 'Liste des cookies à afficher',
21
+ control: 'object',
22
+ table: {
23
+ type: {
24
+ summary: 'CookiesItems',
25
+ detail: `{
26
+ essentials?: {
27
+ name: string
28
+ description?: string
29
+ conservation: string
30
+ }[],
31
+ functional?: {
32
+ name: string
33
+ description?: string
34
+ conservation: string
35
+ }[],
36
+ analytics?: {
37
+ name: string
38
+ description?: string
39
+ conservation: string
40
+ }[],
41
+ }`,
42
+ },
43
+ category: 'props',
44
+ },
45
+ },
46
+
47
+ 'onAccept': {
48
+ action: 'accept',
49
+ description: 'Événement émis lors de l\'acceptation des cookies',
50
+ table: {
51
+ category: 'Events',
52
+ type: { summary: '' },
53
+ },
54
+ },
55
+ 'onReject': {
56
+ action: 'reject',
57
+ description: 'Événement émis lors du refus des cookies',
58
+ table: {
59
+ category: 'Events',
60
+ type: { summary: '' },
61
+ },
62
+ },
63
+ 'onCustomize': {
64
+ action: 'customize',
65
+ description: 'Événement émis lors de la personnalisation des cookies',
66
+ table: {
67
+ category: 'Events',
68
+ type: { summary: '' },
69
+ },
70
+ },
71
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
72
+ // @ts-ignore- Object literal may only specify known properties
73
+ 'onUpdate:modelValue': {
74
+ action: 'update:modelValue',
75
+ description: 'Événement émis lors de la mise à jour de la visibilité de la bannière',
76
+ table: {
77
+ category: 'Events',
78
+ type: { summary: 'Boolean' },
79
+ },
80
+ },
81
+ 'vuetifyOptions': {
82
+ description: 'Options de personnalisation des composants Vuetify internes',
83
+ control: { type: 'object' },
84
+ table: {
85
+ defaultValue: {
86
+ summary: '{}',
87
+ detail: `{
88
+ banner: {
89
+ width: '800px',
90
+ maxWidth: '100%',
91
+ rounded: true,
92
+ elevation: 2,
93
+ class: 'pa-8 ma-8',
94
+ stacked: true,
95
+ location: 'bottom',
96
+ position: 'fixed',
97
+ maxHeight: 'calc(100dvh - 64px)',
98
+ density: 'compact',
99
+ },
100
+ closeBtn: {
101
+ icon: true,
102
+ variant: 'text',
103
+ width: '32px',
104
+ height: '32px',
105
+ class: 'ml-4',
106
+ },
107
+ backBtn: {
108
+ icon: true,
109
+ variant: 'text',
110
+ width: '32px',
111
+ height: '32px',
112
+ class: 'ml-4',
113
+ },
114
+ customizeBtn: {
115
+ color: 'primary',
116
+ height: 'auto',
117
+ minHeight: '44px',
118
+ class: 'text-wrap ma-2',
119
+ variant: 'outlined',
120
+ },
121
+ rejectBtn: {
122
+ color: 'primary',
123
+ height: 'auto',
124
+ minHeight: '44px',
125
+ class: 'text-wrap ma-2',
126
+ },
127
+ acceptBtn: {
128
+ color: 'primary',
129
+ height: 'auto',
130
+ minHeight: '44px',
131
+ class: 'text-wrap ma-2',
132
+ },
133
+ }`,
134
+ },
135
+ type: {
136
+ summary: 'Record<string, Record<string, unknown>>',
137
+ detail: `{
138
+ banner: VSheetOptions,
139
+ closeBtn: VBtnOptions,
140
+ customizeBtn: VBtnOptions,
141
+ rejectBtn: VBtnOptions,
142
+ acceptBtn: VBtnOptions,
143
+ }`,
144
+ },
145
+ category: 'props',
146
+ },
147
+ },
148
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
149
+ // @ts-ignore - 'default' storybook can't infer dynamic slot name
150
+ 'default': {
151
+ description: 'Description de la bannière',
152
+ control: { type: 'text' },
153
+ table: {
154
+ defaultValue: { summary: 'undefined' },
155
+ type: { summary: '{}' },
156
+ category: 'slots',
157
+ },
158
+ },
159
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
160
+ // @ts-ignore - 'cookie-description-${cookieName}' storybook can't infer dynamic slot name
161
+ 'cookie-description-${cookieName}': {
162
+ description: 'Slot pour personnaliser la description d’un cookie',
163
+ control: 'none',
164
+ table: {
165
+ category: 'slots',
166
+ type: {
167
+ summary: 'Cookie',
168
+ detail: `{
169
+ name: string
170
+ description?: string
171
+ conservation: string
172
+ }`,
173
+ },
174
+ },
175
+ },
176
+ },
177
+ parameters: {
178
+ layout: 'fullscreen',
179
+ controls: {
180
+ exclude: ['reject', 'accept', 'customize', 'submit'],
181
+ },
182
+ docs: {
183
+ controls: { exclude: ['submit', 'slotName'] },
184
+ },
185
+ },
186
+ args: {
187
+ modelValue: false,
188
+ },
189
+ } satisfies Meta<typeof CookieBanner>
190
+
191
+ export default meta
192
+
193
+ type Story = StoryObj<typeof meta>
194
+
195
+ const items = {
196
+ essentials: [
197
+ {
198
+ name: 'session',
199
+ description: 'Sauvegarde la session pour rester connecté.',
200
+ conservation: '20 heures',
201
+ },
202
+ {
203
+ name: 'cookie_policy',
204
+ description: 'Sauvegarde les préférences de cookies.',
205
+ conservation: '1 an',
206
+ },
207
+ ],
208
+ functional: [
209
+ {
210
+ name: 'contrast',
211
+ description: 'Sauvegarde la personnalisation de l’affichage.',
212
+ conservation: '1 an',
213
+ },
214
+ ],
215
+ analytics: [
216
+ {
217
+ name: 'user_id',
218
+ description: 'Sauvegarde l’identifiant unique de visiteur.',
219
+ conservation: '6 mois',
220
+ },
221
+ ],
222
+ }
223
+
224
+ export const Default: Story = {
225
+ argTypes: {
226
+ onAccept: { action: 'accept' },
227
+ onReject: { action: 'reject' },
228
+ onCustomize: { action: 'customize' },
229
+ },
230
+ args: {
231
+ items,
232
+ onAccept: fn(),
233
+ onReject: fn(),
234
+ onCustomize: fn(),
235
+ },
236
+
237
+ render: (args) => {
238
+ return {
239
+ components: { CookieBanner, VBtn },
240
+ setup() {
241
+ const open = ref(false)
242
+ watch(() => args.modelValue, (value) => {
243
+ open.value = !!value
244
+ }, { immediate: true })
245
+ return { args, open }
246
+ },
247
+ template: `
248
+ <div style="height: 150px; display: flex; align-items: center; justify-content: center;">
249
+ <VBtn @click="open = true" v-if="!open">Ouvrir la bannière</VBtn>
250
+ <CookieBanner v-bind="args" v-model="open">
251
+ <template #default v-if="args.default">
252
+ {{ args.default }}
253
+ </template>
254
+ </CookieBanner>
255
+ </div>
256
+ `,
257
+ }
258
+ },
259
+
260
+ parameters: {
261
+ sourceCode: [
262
+ {
263
+ name: 'Template',
264
+ code: `<template>
265
+ <CookieBanner
266
+ :items
267
+ @accept="onAccept"
268
+ @reject="onReject"
269
+ @customize="onCustomize"
270
+ v-model="modelValue"
271
+ />
272
+ </template>`,
273
+ },
274
+ {
275
+ name: 'Script',
276
+ code: `<script setup lang="ts">
277
+ import { CookieBanner } from '@cnamts/synapse'
278
+
279
+ const modelValue = ref(true)
280
+
281
+ const onAccept = () => {
282
+ console.log('Accept')
283
+ }
284
+
285
+ const onReject = () => {
286
+ console.log('Reject')
287
+ }
288
+
289
+ const onCustomize = () => {
290
+ console.log('Customize')
291
+ }
292
+
293
+ const items = {
294
+ essentials: [
295
+ {
296
+ name: 'session',
297
+ description: 'Sauvegarde la session pour rester connecté.',
298
+ conservation: '20 heures',
299
+ },
300
+ {
301
+ name: 'cookie_policy',
302
+ description: 'Sauvegarde les préférences de cookies.',
303
+ conservation: '1 an',
304
+ },
305
+ ],
306
+ functional: [
307
+ {
308
+ name: 'contrast',
309
+ description: 'Sauvegarde la personnalisation de l’affichage.',
310
+ conservation: '1 an',
311
+ },
312
+ ],
313
+ analytics: [
314
+ {
315
+ name: 'user_id',
316
+ description: 'Sauvegarde l’identifiant unique de visiteur.',
317
+ conservation: '6 mois',
318
+ },
319
+ ],
320
+ }
321
+ </script>`,
322
+ },
323
+ ],
324
+ },
325
+ }
326
+
327
+ export const WithoutCookiesItems: Story = {
328
+ args: {
329
+ onAccept: fn(),
330
+ onReject: fn(),
331
+ onCustomize: fn(),
332
+ },
333
+ render: (args) => {
334
+ return {
335
+ components: { CookieBanner, VBtn },
336
+ setup() {
337
+ const open = ref(false)
338
+ watch(() => args.modelValue, (value) => {
339
+ open.value = !!value
340
+ }, { immediate: true })
341
+ return { args, open }
342
+ },
343
+ template: `
344
+ <div style="height: 150px; display: flex; align-items: center; justify-content: center;">
345
+ <VBtn @click="open = true" v-if="!open">Ouvrir la bannière</VBtn>
346
+ <CookieBanner v-bind="args" v-model="open" >
347
+ <template #default v-if="args.default">
348
+ {{ args.default }}
349
+ </template>
350
+ </CookieBanner>
351
+ </div>
352
+ `,
353
+ }
354
+ },
355
+ parameters: {
356
+ sourceCode: [
357
+ {
358
+ name: 'Template',
359
+ code: `<template>
360
+ <CookieBanner
361
+ @accept="onAccept"
362
+ @reject="onReject"
363
+ @customize="onCustomize"
364
+ v-model="modelValue"
365
+ />
366
+ </template>`,
367
+ },
368
+ {
369
+ name: 'Script',
370
+ code: `<script setup lang="ts">
371
+ import { CookieBanner } from '@cnamts/synapse'
372
+
373
+ const modelValue = ref(true)
374
+ </script>`,
375
+ },
376
+ ],
377
+ },
378
+ }
379
+
380
+ export const BannerDescriptionSlot: Story = {
381
+ args: {
382
+ onAccept: fn(),
383
+ onReject: fn(),
384
+ onCustomize: fn(),
385
+ items,
386
+ },
387
+ render: (args) => {
388
+ return {
389
+ components: { CookieBanner, VBtn },
390
+ setup() {
391
+ const open = ref(false)
392
+ watch(() => args.modelValue, (value) => {
393
+ open.value = !!value
394
+ }, { immediate: true })
395
+ return { args, open }
396
+ },
397
+ template: `
398
+ <div style="height: 150px; display: flex; align-items: center; justify-content: center;">
399
+ <VBtn @click="open = true" v-if="!open">Ouvrir la bannière</VBtn>
400
+ <CookieBanner v-bind="args" v-model="open">
401
+ <p><b>Custom</b> description</p>
402
+ </CookieBanner>
403
+ </div>
404
+ `,
405
+ }
406
+ },
407
+ parameters: {
408
+ sourceCode: [
409
+ {
410
+ name: 'Template',
411
+ code: `<template>
412
+ <CookieBanner
413
+ :items
414
+ @accept="onAccept"
415
+ @reject="onReject"
416
+ @customize="onCustomize"
417
+ v-model="modelValue"
418
+ >
419
+ <p><b>Custom</b> description</p>
420
+ </CookieBanner>
421
+ </template>`,
422
+ },
423
+ {
424
+ name: 'Script',
425
+ code: `<script setup lang="ts">
426
+ import { CookieBanner } from '@cnamts/synapse'
427
+
428
+ const modelValue = ref(true)
429
+
430
+ const items = {
431
+ essentials: [
432
+ {
433
+ name: 'session',
434
+ description: 'Sauvegarde la session pour rester connecté.',
435
+ conservation: '20 heures',
436
+ },
437
+ {
438
+ name: 'cookie_policy',
439
+ description: 'Sauvegarde les préférences de cookies.',
440
+ conservation: '1 an',
441
+ },
442
+ ],
443
+ functional: [
444
+ {
445
+ name: 'contrast',
446
+ description: 'Sauvegarde la personnalisation de l’affichage.',
447
+ conservation: '1 an',
448
+ },
449
+ ],
450
+ analytics: [
451
+ {
452
+ name: 'user_id',
453
+ description: 'Sauvegarde l’identifiant unique de visiteur.',
454
+ conservation: '6 mois',
455
+ },
456
+ ],
457
+ }
458
+ </script>`,
459
+ },
460
+ ],
461
+ },
462
+ }
463
+
464
+ export const CookiesDescriptionSlots: Story = {
465
+ args: {
466
+ onAccept: fn(),
467
+ onReject: fn(),
468
+ onCustomize: fn(),
469
+ items: {
470
+ functional: [
471
+ {
472
+ name: 'contrast',
473
+ conservation: '1 an',
474
+ },
475
+ {
476
+ name: 'privacy',
477
+ conservation: '1 an',
478
+ },
479
+ {
480
+ name: 'cookie_policy',
481
+ description: 'Sauvegarde les préférences de cookies.',
482
+ conservation: '1 an',
483
+ },
484
+ ],
485
+ },
486
+ },
487
+ render: (args) => {
488
+ return {
489
+ components: { CookieBanner, VBtn },
490
+ setup() {
491
+ const open = ref(false)
492
+ watch(() => args.modelValue, (value) => {
493
+ open.value = !!value
494
+ }, { immediate: true })
495
+ return { args, open }
496
+ },
497
+ template: `
498
+ <div style="height: 150px; display: flex; align-items: center; justify-content: center;">
499
+ <VBtn @click="open = true" v-if="!open">Ouvrir la bannière</VBtn>
500
+ <CookieBanner v-bind="args" v-model="open">
501
+ <template #cookie-description-contrast="{ cookie }">
502
+ voir : <a href="#">En savoir plus</a>
503
+ </template>
504
+
505
+ <template #cookie-description-privacy="{ cookie }">
506
+ <a href="#">Politique de confidentialité</a>
507
+ </template>
508
+ </CookieBanner>
509
+ </div>
510
+ `,
511
+ }
512
+ },
513
+ parameters: {
514
+ sourceCode: [
515
+ {
516
+ name: 'Template',
517
+ code: `<template>
518
+ <CookieBanner
519
+ :items
520
+ @accept="onAccept"
521
+ @reject="onReject"
522
+ @customize="onCustomize"
523
+ v-model="modelValue"
524
+ >
525
+ <template #cookie-description-contrast="{ cookie }">
526
+ voir : <a href="#">En savoir plus</a>
527
+ </template>
528
+
529
+ <template #cookie-description-privacy="{ cookie }">
530
+ <a href="#">Politique de confidentialité</a>
531
+ </template>
532
+ </CookieBanner>
533
+ </template>`,
534
+ },
535
+ {
536
+ name: 'Script',
537
+ code: `<script setup lang="ts">
538
+ import { CookieBanner } from '@cnamts/synapse'
539
+
540
+ const modelValue = ref(true)
541
+
542
+ const items = {
543
+ functional: [
544
+ {
545
+ name: 'contrast',
546
+ conservation: '1 an',
547
+ },
548
+ {
549
+ name: 'privacy',
550
+ conservation: '1 an',
551
+ },
552
+ {
553
+ name: 'cookie_policy',
554
+ description: 'Sauvegarde les préférences de cookies.',
555
+ conservation: '1 an',
556
+ },
557
+ ],
558
+ },
559
+ </script>`,
560
+ },
561
+ ],
562
+ },
563
+ }
564
+
565
+ export const Customization: Story = {
566
+ args: {
567
+ items,
568
+ onAccept: fn(),
569
+ onReject: fn(),
570
+ onCustomize: fn(),
571
+ vuetifyOptions: {
572
+ banner: {
573
+ color: '#ced9eb',
574
+ },
575
+ customizeBtn: {
576
+ variant: 'text',
577
+ color: 'orange',
578
+ },
579
+ rejectBtn: {
580
+ variant: 'outlined',
581
+ },
582
+ acceptBtn: {
583
+ variant: 'outlined',
584
+ },
585
+ },
586
+ },
587
+ render: (args) => {
588
+ return {
589
+ components: { CookieBanner, VBtn },
590
+ setup() {
591
+ const open = ref(false)
592
+ watch(() => args.modelValue, (value) => {
593
+ open.value = !!value
594
+ }, { immediate: true })
595
+ return { args, open }
596
+ },
597
+ template: `
598
+ <div style="height: 150px; display: flex; align-items: center; justify-content: center;">
599
+ <VBtn @click="open = true" v-if="!open">Ouvrir la bannière</VBtn>
600
+ <CookieBanner v-bind="args" v-model="open" >
601
+ <template #default v-if="args.default">
602
+ {{ args.default }}
603
+ </template>
604
+ </CookieBanner>
605
+ </div>
606
+ `,
607
+ }
608
+ },
609
+ parameters: {
610
+ sourceCode: [
611
+ {
612
+ name: 'Template',
613
+ code: `<template>
614
+ <CookieBanner
615
+ :items
616
+ @accept="onAccept"
617
+ @reject="onReject"
618
+ @customize="onCustomize"
619
+ v-model="modelValue"
620
+ :cookiesRoute="cookiesRoute"
621
+ :vuetifyOptions="vuetifyOptions"
622
+ />
623
+ </template>`,
624
+ },
625
+ {
626
+ name: 'Script',
627
+ code: `<script setup lang="ts">
628
+ import { CookieBanner } from '@cnamts/synapse'
629
+
630
+ const modelValue = ref(true)
631
+
632
+ const items = {
633
+ essentials: [
634
+ {
635
+ name: 'session',
636
+ description: 'Sauvegarde la session pour rester connecté.',
637
+ conservation: '20 heures',
638
+ },
639
+ {
640
+ name: 'cookie_policy',
641
+ description: 'Sauvegarde les préférences de cookies.',
642
+ conservation: '1 an',
643
+ },
644
+ ],
645
+ functional: [
646
+ {
647
+ name: 'contrast',
648
+ description: 'Sauvegarde la personnalisation de l’affichage.',
649
+ conservation: '1 an',
650
+ },
651
+ ],
652
+ analytics: [
653
+ {
654
+ name: 'user_id',
655
+ description: 'Sauvegarde l’identifiant unique de visiteur.',
656
+ conservation: '6 mois',
657
+ },
658
+ ],
659
+ }
660
+
661
+ const vuetifyOptions = {
662
+ sheet: {
663
+ color: '#ced9eb',
664
+ },
665
+ customizeBtn: {
666
+ variant: 'text',
667
+ color: 'orange',
668
+ },
669
+ rejectBtn: {
670
+ variant: 'outlined',
671
+ },
672
+ acceptBtn: {
673
+ variant: 'outlined',
674
+ },
675
+ }
676
+ </script>`,
677
+ },
678
+ ],
679
+ },
680
+ }