@cnamts/synapse 0.0.4-alpha → 0.0.6-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 (322) hide show
  1. package/dist/design-system-v3.d.ts +1277 -499
  2. package/dist/design-system-v3.js +4193 -1573
  3. package/dist/design-system-v3.umd.cjs +8 -8
  4. package/dist/style.css +1 -1
  5. package/package.json +18 -17
  6. package/src/assets/settings.scss +3 -0
  7. package/src/assets/tokens.scss +16 -17
  8. package/src/components/BackBtn/Accessibilite.mdx +14 -0
  9. package/src/components/BackBtn/Accessibilite.stories.ts +166 -0
  10. package/src/components/BackBtn/AccessibiliteItems.ts +102 -0
  11. package/src/components/BackBtn/BackBtn.mdx +1 -1
  12. package/src/components/BackBtn/BackBtn.stories.ts +8 -8
  13. package/src/components/BackBtn/BackBtn.vue +0 -1
  14. package/src/components/BackBtn/constants/ExpertiseLevelEnum.ts +4 -0
  15. package/src/components/BackToTopBtn/Accessibilite.mdx +14 -0
  16. package/src/components/BackToTopBtn/Accessibilite.stories.ts +166 -0
  17. package/src/components/BackToTopBtn/AccessibiliteItems.ts +52 -0
  18. package/src/components/BackToTopBtn/BackToTopBtn.mdx +1 -1
  19. package/src/components/BackToTopBtn/constants/ExpertiseLevelEnum.ts +4 -0
  20. package/src/components/CollapsibleList/Accessibilite.mdx +14 -0
  21. package/src/components/CollapsibleList/Accessibilite.stories.ts +170 -0
  22. package/src/components/CollapsibleList/AccessibiliteItems.ts +122 -0
  23. package/src/components/CollapsibleList/CollapsibleList.stories.ts +1 -1
  24. package/src/components/CollapsibleList/constants/ExpertiseLevelEnum.ts +4 -0
  25. package/src/components/CookieBanner/Accessibilite.mdx +14 -0
  26. package/src/components/CookieBanner/Accessibilite.stories.ts +219 -0
  27. package/src/components/CookieBanner/AccessibiliteItems.ts +356 -0
  28. package/src/components/CookieBanner/CookieBanner.mdx +219 -0
  29. package/src/components/CookieBanner/CookieBanner.stories.ts +678 -0
  30. package/src/components/CookieBanner/CookieBanner.vue +225 -0
  31. package/src/components/CookieBanner/config.ts +38 -0
  32. package/src/components/CookieBanner/constants/ExpertiseLevelEnum.ts +4 -0
  33. package/src/components/CookieBanner/locales.ts +12 -0
  34. package/src/components/CookieBanner/tests/CookieBanner.spec.ts +129 -0
  35. package/src/components/CookieBanner/tests/__snapshots__/CookieBanner.spec.ts.snap +197 -0
  36. package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +123 -0
  37. package/src/components/CookiesSelection/CookiesInformation/locales.ts +21 -0
  38. package/src/components/CookiesSelection/CookiesInformation/tests/CookiesInformation.spec.ts +121 -0
  39. package/src/components/CookiesSelection/CookiesSelection.vue +127 -0
  40. package/src/components/CookiesSelection/CookiesTable/CookiesTable.vue +47 -0
  41. package/src/components/CookiesSelection/CookiesTable/headers.ts +14 -0
  42. package/src/components/CookiesSelection/CookiesTable/tests/CookiesTable.spec.ts +30 -0
  43. package/src/components/CookiesSelection/CookiesTable/tests/__snapshots__/CookiesTable.spec.ts.snap +3 -0
  44. package/src/components/CookiesSelection/locales.ts +10 -0
  45. package/src/components/CookiesSelection/tests/CookiesSelection.spec.ts +184 -0
  46. package/src/components/CookiesSelection/tests/__snapshots__/CookiesSelection.spec.ts.snap +192 -0
  47. package/src/components/CookiesSelection/types.ts +15 -0
  48. package/src/components/CopyBtn/Accessibilite.mdx +14 -0
  49. package/src/components/CopyBtn/Accessibilite.stories.ts +166 -0
  50. package/src/components/CopyBtn/AccessibiliteItems.ts +105 -0
  51. package/src/components/CopyBtn/CopyBtn.mdx +1 -1
  52. package/src/components/CopyBtn/CopyBtn.stories.ts +4 -4
  53. package/src/components/CopyBtn/CopyBtn.vue +0 -1
  54. package/src/components/CopyBtn/config.ts +2 -0
  55. package/src/components/CopyBtn/constants/ExpertiseLevelEnum.ts +4 -0
  56. package/src/components/Customs/SyBtnSelect/Accessibilite.mdx +14 -0
  57. package/src/components/Customs/SyBtnSelect/Accessibilite.stories.ts +193 -0
  58. package/src/components/Customs/SyBtnSelect/AccessibiliteItems.ts +139 -0
  59. package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +45 -0
  60. package/src/components/Customs/SyBtnSelect/SyBtnSelect.stories.ts +662 -0
  61. package/src/components/Customs/SyBtnSelect/SyBtnSelect.vue +254 -0
  62. package/src/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.ts +4 -0
  63. package/src/components/Customs/SyBtnSelect/tests/SyBtnSelect.spec.ts +168 -0
  64. package/src/components/Customs/SyInputSelect/Accessibilite.mdx +14 -0
  65. package/src/components/Customs/SyInputSelect/Accessibilite.stories.ts +166 -0
  66. package/src/components/Customs/SyInputSelect/AccessibiliteItems.ts +96 -0
  67. package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +41 -0
  68. package/src/components/Customs/{CustomInputSelect/CustomInputSelect.stories.ts → SyInputSelect/SyInputSelect.stories.ts} +30 -83
  69. package/src/components/Customs/{CustomInputSelect/CustomInputSelect.vue → SyInputSelect/SyInputSelect.vue} +46 -6
  70. package/src/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.ts +4 -0
  71. package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +140 -0
  72. package/src/components/Customs/SySelect/Accessibilite.mdx +14 -0
  73. package/src/components/Customs/SySelect/Accessibilite.stories.ts +217 -0
  74. package/src/components/Customs/SySelect/AccessibiliteItems.ts +173 -0
  75. package/src/components/Customs/{CustomSelect/CustomSelect.mdx → SySelect/SySelect.mdx} +9 -8
  76. package/src/components/Customs/{CustomSelect/CustomSelect.stories.ts → SySelect/SySelect.stories.ts} +25 -79
  77. package/src/components/Customs/{CustomSelect/CustomSelect.vue → SySelect/SySelect.vue} +44 -13
  78. package/src/components/Customs/SySelect/constants/ExpertiseLevelEnum.ts +4 -0
  79. package/src/components/Customs/{CustomInputSelect/tests/CustomInputSelect.spec.ts → SySelect/tests/SySelect.spec.ts} +48 -71
  80. package/src/components/Customs/SyTextField/Accessibilite.mdx +14 -0
  81. package/src/components/Customs/SyTextField/Accessibilite.stories.ts +224 -0
  82. package/src/components/Customs/SyTextField/AccessibiliteItems.ts +198 -0
  83. package/src/components/Customs/SyTextField/SyTextField.mdx +44 -0
  84. package/src/components/Customs/{CustomTextField/CustomTextField.stories.ts → SyTextField/SyTextField.stories.ts} +145 -34
  85. package/src/components/Customs/{CustomTextField/CustomTextField.vue → SyTextField/SyTextField.vue} +27 -7
  86. package/src/components/Customs/SyTextField/constants/ExpertiseLevelEnum.ts +4 -0
  87. package/src/components/Customs/{CustomTextField/tests/CustomTextField.spec.ts → SyTextField/tests/SyTextField.spec.ts} +3 -3
  88. package/src/components/Customs/{CustomTextField/tests/__snapshots__/CustomTextField.spec.ts.snap → SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap} +5 -6
  89. package/src/components/DataList/Accessibilite.mdx +14 -0
  90. package/src/components/DataList/Accessibilite.stories.ts +166 -0
  91. package/src/components/DataList/AccessibiliteItems.ts +47 -0
  92. package/src/components/DataList/DataList.mdx +1 -1
  93. package/src/components/DataList/DataList.stories.ts +10 -10
  94. package/src/components/DataList/constants/ExpertiseLevelEnum.ts +4 -0
  95. package/src/components/DataListGroup/Accessibilite.mdx +14 -0
  96. package/src/components/DataListGroup/Accessibilite.stories.ts +225 -0
  97. package/src/components/DataListGroup/AccessibiliteItems.ts +79 -0
  98. package/src/components/DataListGroup/DataListGroup.mdx +1 -1
  99. package/src/components/DataListGroup/DataListGroup.stories.ts +7 -7
  100. package/src/components/DataListGroup/constants/ExpertiseLevelEnum.ts +4 -0
  101. package/src/components/DialogBox/Accessibilite.mdx +14 -0
  102. package/src/components/DialogBox/Accessibilite.stories.ts +189 -0
  103. package/src/components/DialogBox/AccessibiliteItems.ts +167 -0
  104. package/src/components/DialogBox/DialogBox.mdx +14 -0
  105. package/src/components/DialogBox/DialogBox.stories.ts +798 -0
  106. package/src/components/DialogBox/DialogBox.vue +181 -0
  107. package/src/components/DialogBox/config.ts +25 -0
  108. package/src/components/DialogBox/constants/ExpertiseLevelEnum.ts +4 -0
  109. package/src/components/DialogBox/locales.ts +5 -0
  110. package/src/components/DialogBox/tests/DialogBox.spec.ts +329 -0
  111. package/src/components/DialogBox/tests/__snapshots__/DialogBox.spec.ts.snap +46 -0
  112. package/src/components/DownloadBtn/AccessibiliteItems.ts +1 -31
  113. package/src/components/DownloadBtn/DownloadBtn.mdx +3 -3
  114. package/src/components/DownloadBtn/DownloadBtn.stories.ts +6 -6
  115. package/src/components/ErrorPage/Accessibilite.mdx +14 -0
  116. package/src/components/ErrorPage/Accessibilite.stories.ts +189 -0
  117. package/src/components/ErrorPage/AccessibiliteItems.ts +205 -0
  118. package/src/components/ErrorPage/ErrorPage.mdx +21 -0
  119. package/src/components/ErrorPage/ErrorPage.stories.ts +133 -0
  120. package/src/components/ErrorPage/ErrorPage.vue +93 -0
  121. package/src/components/ErrorPage/constants/ExpertiseLevelEnum.ts +4 -0
  122. package/src/components/ErrorPage/locales.ts +5 -0
  123. package/src/components/ErrorPage/tests/ErrorPage.spec.ts +40 -0
  124. package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +78 -0
  125. package/src/components/FooterBar/Accessibilite.mdx +14 -0
  126. package/src/components/FooterBar/Accessibilite.stories.ts +223 -0
  127. package/src/components/FooterBar/AccessibiliteItems.ts +257 -0
  128. package/src/components/FooterBar/FooterBar.mdx +2 -2
  129. package/src/components/FooterBar/FooterBar.stories.ts +556 -8
  130. package/src/components/FooterBar/FooterBar.vue +80 -73
  131. package/src/components/FooterBar/config.ts +2 -3
  132. package/src/components/FooterBar/constants/ExpertiseLevelEnum.ts +4 -0
  133. package/src/components/FooterBar/tests/FooterBar.spec.ts +1 -1
  134. package/src/components/FooterBar/tests/FooterBarConfig.spec.ts +1 -1
  135. package/src/components/FooterBar/tests/__snapshots__/FooterBar.spec.ts.snap +24 -22
  136. package/src/components/FranceConnectBtn/Accessibilite.mdx +14 -0
  137. package/src/components/FranceConnectBtn/Accessibilite.stories.ts +194 -0
  138. package/src/components/FranceConnectBtn/AccessibiliteItems.ts +169 -0
  139. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +1 -1
  140. package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +3 -3
  141. package/src/components/FranceConnectBtn/constants/ExpertiseLevelEnum.ts +4 -0
  142. package/src/components/HeaderBar/Accessibilite.mdx +14 -0
  143. package/src/components/HeaderBar/Accessibilite.stories.ts +223 -0
  144. package/src/components/HeaderBar/AccessibiliteItems.ts +194 -0
  145. package/src/components/HeaderBar/HeaderBar.stories.ts +60 -2
  146. package/src/components/HeaderBar/HeaderBar.vue +1 -9
  147. package/src/components/HeaderBar/HeaderBurgerMenu/Accessibilite.mdx +14 -0
  148. package/src/components/HeaderBar/HeaderBurgerMenu/Accessibilite.stories.ts +223 -0
  149. package/src/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.ts +174 -0
  150. package/src/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.ts +4 -0
  151. package/src/components/HeaderBar/constants/ExpertiseLevelEnum.ts +4 -0
  152. package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +1 -1
  153. package/src/components/HeaderLoading/Accessibilite.mdx +14 -0
  154. package/src/components/HeaderLoading/Accessibilite.stories.ts +167 -0
  155. package/src/components/HeaderLoading/AccessibiliteItems.ts +29 -0
  156. package/src/components/HeaderLoading/HeaderLoading.mdx +1 -1
  157. package/src/components/HeaderLoading/HeaderLoading.stories.ts +1 -1
  158. package/src/components/HeaderLoading/constants/ExpertiseLevelEnum.ts +4 -0
  159. package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +6 -6
  160. package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +35 -33
  161. package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +1 -1
  162. package/src/components/HeaderToolbar/Accessibilite.mdx +14 -0
  163. package/src/components/HeaderToolbar/Accessibilite.stories.ts +203 -0
  164. package/src/components/HeaderToolbar/AccessibiliteItems.ts +200 -0
  165. package/src/components/HeaderToolbar/HeaderToolbar.mdx +1 -1
  166. package/src/components/HeaderToolbar/HeaderToolbar.stories.ts +2 -2
  167. package/src/components/HeaderToolbar/HeaderToolbar.vue +3 -2
  168. package/src/components/HeaderToolbar/constants/ExpertiseLevelEnum.ts +4 -0
  169. package/src/components/HeaderToolbar/tests/HeaderToolbar.spec.ts +36 -2
  170. package/src/components/LangBtn/Accessibilite.mdx +14 -0
  171. package/src/components/LangBtn/Accessibilite.stories.ts +168 -0
  172. package/src/components/LangBtn/AccessibiliteItems.ts +101 -0
  173. package/src/components/LangBtn/LangBtn.mdx +1 -1
  174. package/src/components/LangBtn/LangBtn.stories.ts +4 -4
  175. package/src/components/LangBtn/LangBtn.vue +3 -2
  176. package/src/components/LangBtn/constants/ExpertiseLevelEnum.ts +4 -0
  177. package/src/components/LangBtn/tests/LangBtn.spec.ts +1 -1
  178. package/src/components/LangBtn/tests/__snapshots__/LangBtn.spec.ts.snap +1 -1
  179. package/src/components/Logo/Accessibilite.mdx +14 -0
  180. package/src/components/Logo/Accessibilite.stories.ts +223 -0
  181. package/src/components/Logo/AccessibiliteItems.ts +155 -0
  182. package/src/components/Logo/Logo.mdx +1 -1
  183. package/src/components/Logo/Logo.stories.ts +8 -8
  184. package/src/components/Logo/constants/ExpertiseLevelEnum.ts +4 -0
  185. package/src/components/LogoBrandSection/Accessibilite.mdx +14 -0
  186. package/src/components/LogoBrandSection/Accessibilite.stories.ts +223 -0
  187. package/src/components/LogoBrandSection/AccessibiliteItems.ts +194 -0
  188. package/src/components/LogoBrandSection/constants/ExpertiseLevelEnum.ts +4 -0
  189. package/src/components/MaintenancePage/Accessibilite.mdx +14 -0
  190. package/src/components/MaintenancePage/Accessibilite.stories.ts +189 -0
  191. package/src/components/MaintenancePage/AccessibiliteItems.ts +173 -0
  192. package/src/components/MaintenancePage/MaintenancePage.mdx +11 -0
  193. package/src/components/MaintenancePage/MaintenancePage.stories.ts +41 -0
  194. package/src/components/MaintenancePage/MaintenancePage.vue +25 -0
  195. package/src/components/MaintenancePage/assets/maintenance.svg +1 -0
  196. package/src/components/MaintenancePage/constants/ExpertiseLevelEnum.ts +4 -0
  197. package/src/components/MaintenancePage/index.ts +3 -0
  198. package/src/components/MaintenancePage/locales.ts +5 -0
  199. package/src/components/MaintenancePage/tests/MaintenancePage.spec.ts +12 -0
  200. package/src/components/MaintenancePage/tests/__snapshots__/MaintenancePage.spec.ts.snap +3 -0
  201. package/src/components/NirField/Accessibilite.mdx +14 -0
  202. package/src/components/NirField/Accessibilite.stories.ts +214 -0
  203. package/src/components/NirField/AccessibiliteItems.ts +243 -0
  204. package/src/components/NirField/NirField.mdx +216 -0
  205. package/src/components/NirField/NirField.stories.ts +359 -0
  206. package/src/components/NirField/NirField.vue +450 -0
  207. package/src/components/NirField/config.ts +16 -0
  208. package/src/components/NirField/constants/ExpertiseLevelEnum.ts +4 -0
  209. package/src/components/NirField/locales.ts +12 -0
  210. package/src/components/NirField/nirValidation.ts +42 -0
  211. package/src/components/NirField/tests/NirField.spec.ts +119 -0
  212. package/src/components/NotFoundPage/Accessibilite.mdx +14 -0
  213. package/src/components/NotFoundPage/Accessibilite.stories.ts +190 -0
  214. package/src/components/NotFoundPage/AccessibiliteItems.ts +205 -0
  215. package/src/components/NotFoundPage/NotFoundPage.mdx +19 -0
  216. package/src/components/NotFoundPage/NotFoundPage.stories.ts +76 -0
  217. package/src/components/NotFoundPage/NotFoundPage.vue +52 -0
  218. package/src/components/NotFoundPage/assets/not-found.svg +1 -0
  219. package/src/components/NotFoundPage/constants/ExpertiseLevelEnum.ts +4 -0
  220. package/src/components/NotFoundPage/locales.ts +6 -0
  221. package/src/components/NotFoundPage/tests/NotFoundPage.spec.ts +38 -0
  222. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +76 -0
  223. package/src/components/NotificationBar/Accessibilite.mdx +14 -0
  224. package/src/components/NotificationBar/Accessibilite.stories.ts +166 -0
  225. package/src/components/NotificationBar/AccessibiliteItems.ts +144 -0
  226. package/src/components/NotificationBar/NotificationBar.mdx +1 -1
  227. package/src/components/NotificationBar/constants/ExpertiseLevelEnum.ts +4 -0
  228. package/src/components/NotificationBar/options.ts +1 -0
  229. package/src/components/PageContainer/Accessibilite.mdx +14 -0
  230. package/src/components/PageContainer/Accessibilite.stories.ts +166 -0
  231. package/src/components/PageContainer/AccessibiliteItems.ts +52 -0
  232. package/src/components/PageContainer/PageContainer.mdx +1 -1
  233. package/src/components/PageContainer/PageContainer.stories.ts +4 -4
  234. package/src/components/PageContainer/PageContainer.vue +16 -15
  235. package/src/components/PageContainer/constants/ExpertiseLevelEnum.ts +4 -0
  236. package/src/components/PageContainer/tests/PageContainer.spec.ts +1 -1
  237. package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +2 -2
  238. package/src/components/PhoneField/Accessibilite.mdx +14 -0
  239. package/src/components/PhoneField/Accessibilite.stories.ts +216 -0
  240. package/src/components/PhoneField/AccessibiliteItems.ts +238 -0
  241. package/src/components/PhoneField/PhoneField.mdx +1 -1
  242. package/src/components/PhoneField/PhoneField.stories.ts +2 -2
  243. package/src/components/PhoneField/PhoneField.vue +5 -6
  244. package/src/components/PhoneField/constants/ExpertiseLevelEnum.ts +4 -0
  245. package/src/components/PhoneField/tests/PhoneField.spec.ts +3 -3
  246. package/src/components/SkipLink/Accessibilite.mdx +14 -0
  247. package/src/components/SkipLink/Accessibilite.stories.ts +167 -0
  248. package/src/components/SkipLink/AccessibiliteItems.ts +77 -0
  249. package/src/components/SkipLink/SkipLink.stories.ts +2 -2
  250. package/src/components/SkipLink/constants/ExpertiseLevelEnum.ts +4 -0
  251. package/src/components/SocialMediaLinks/Accessibilite.mdx +14 -0
  252. package/src/components/SocialMediaLinks/Accessibilite.stories.ts +170 -0
  253. package/src/components/SocialMediaLinks/AccessibiliteItems.ts +160 -0
  254. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +18 -14
  255. package/src/components/SocialMediaLinks/SocialMediaLinks.stories.ts +3 -2
  256. package/src/components/SocialMediaLinks/constants/ExpertiseLevelEnum.ts +4 -0
  257. package/src/components/SocialMediaLinks/tests/SocialMediaLinks.spec.ts +1 -1
  258. package/src/components/SocialMediaLinks/tests/__snapshots__/SocialMediaLinks.spec.ts.snap +2 -2
  259. package/src/components/SubHeader/Accessibilite.mdx +14 -0
  260. package/src/components/SubHeader/Accessibilite.stories.ts +166 -0
  261. package/src/components/SubHeader/AccessibiliteItems.ts +146 -0
  262. package/src/components/SubHeader/SubHeader.mdx +1 -1
  263. package/src/components/SubHeader/SubHeader.stories.ts +11 -11
  264. package/src/components/SubHeader/SubHeader.vue +1 -1
  265. package/src/components/SubHeader/constants/ExpertiseLevelEnum.ts +4 -0
  266. package/src/components/SyAlert/Accessibilite.mdx +14 -0
  267. package/src/components/SyAlert/Accessibilite.stories.ts +166 -0
  268. package/src/components/SyAlert/AccessibiliteItems.ts +122 -0
  269. package/src/components/{Alert/Alert.mdx → SyAlert/SyAlert.mdx} +9 -9
  270. package/src/components/{Alert/Alert.stories.ts → SyAlert/SyAlert.stories.ts} +22 -22
  271. package/src/components/SyAlert/constants/ExpertiseLevelEnum.ts +4 -0
  272. package/src/components/{Alert/tests/Alert.spec.ts → SyAlert/tests/SyAlert.spec.ts} +5 -5
  273. package/src/components/{Alert/tests/__snapshots__/Alert.spec.ts.snap → SyAlert/tests/__snapshots__/SyAlert.spec.ts.snap} +2 -2
  274. package/src/components/UserMenuBtn/Accessibilite.mdx +14 -0
  275. package/src/components/UserMenuBtn/Accessibilite.stories.ts +189 -0
  276. package/src/components/UserMenuBtn/AccessibiliteItems.ts +155 -0
  277. package/src/components/UserMenuBtn/UserMenuBtn.mdx +35 -0
  278. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +540 -0
  279. package/src/components/UserMenuBtn/UserMenuBtn.vue +101 -0
  280. package/src/components/UserMenuBtn/config.ts +24 -0
  281. package/src/components/UserMenuBtn/constants/ExpertiseLevelEnum.ts +4 -0
  282. package/src/components/UserMenuBtn/tests/UserMenuBtn.spec.ts +125 -0
  283. package/src/components/index.ts +19 -4
  284. package/src/composables/index.ts +8 -0
  285. package/src/composables/rules/tests/useFieldValidation.spec.ts +84 -0
  286. package/src/composables/rules/useFieldValidation.ts +90 -0
  287. package/src/designTokens/index.ts +2 -0
  288. package/src/designTokens/tokens/cnam/cnamDarkTheme.ts +5 -0
  289. package/src/designTokens/tokens/cnam/cnamLightTheme.ts +1 -0
  290. package/src/main.ts +3 -0
  291. package/src/stories/Fondamentaux/Arrondis.mdx +24 -0
  292. package/src/stories/{Guidelines → Fondamentaux}/Colors.mdx +1 -1
  293. package/src/stories/Fondamentaux/Conteneurs.mdx +7 -0
  294. package/src/stories/Fondamentaux/CustomisationEtThemes.mdx +7 -0
  295. package/src/stories/Fondamentaux/Elevations.mdx +14 -0
  296. package/src/stories/Fondamentaux/Espacements.mdx +29 -0
  297. package/src/stories/{Guidelines → Fondamentaux}/Introduction.mdx +1 -1
  298. package/src/stories/Fondamentaux/StylesTypographiques.mdx +33 -0
  299. package/src/stories/Fondamentaux/Typographie.mdx +58 -0
  300. package/src/stories/GuideDuDev/CommentUtiliserLesRules.mdx +120 -0
  301. package/src/stories/GuideDuDev/components.stories.ts +5 -5
  302. package/src/stories/GuideDuDev/moduleDeNotification.mdx +1 -1
  303. package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/Accessibilite.stories.ts +1 -1
  304. package/src/stories/{Fondamentaux → Guidelines}/EcoConception/Econception.stories.ts +2 -2
  305. package/src/stories/Guidelines/Vuetify/Vuetify.mdx +11 -0
  306. package/src/stories/Guidelines/Vuetify/Vuetify.stories.ts +138 -0
  307. package/src/stories/Guidelines/Vuetify/VuetifyItems.ts +350 -0
  308. package/src/components/Customs/CustomInputSelect/CustomInputSelect.mdx +0 -40
  309. package/src/components/Customs/CustomSelect/tests/CustomSelect.spec.ts +0 -236
  310. package/src/components/Customs/CustomTextField/CustomTextField.mdx +0 -44
  311. package/src/stories/Guidelines/CustomisationEtThemes.mdx +0 -3
  312. package/src/stories/Guidelines/Typo.mdx +0 -53
  313. /package/src/components/Customs/{CustomInputSelect → SyInputSelect}/config.ts +0 -0
  314. /package/src/components/Customs/{CustomTextField → SyTextField}/types.d.ts +0 -0
  315. /package/src/components/{Alert/Alert.vue → SyAlert/SyAlert.vue} +0 -0
  316. /package/src/components/{Alert → SyAlert}/locales.ts +0 -0
  317. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/Accessibilite.mdx +0 -0
  318. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/AccessibiliteItems.ts +0 -0
  319. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/constants/ExpertiseLevelEnum.ts +0 -0
  320. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/constants/RGAALevelEnum.ts +0 -0
  321. /package/src/stories/{Fondamentaux → Guidelines}/EcoConception/EcoConception.mdx +0 -0
  322. /package/src/stories/{Fondamentaux → Guidelines}/EcoConception/ecoDesignItems.ts +0 -0
@@ -0,0 +1,96 @@
1
+ import { ExpertiseLevelEnum } from './constants/ExpertiseLevelEnum'
2
+
3
+ export const AccessibiliteItemsIndeterminate = [
4
+ {
5
+ title: 'Catégorie 10 : Présentation de l’information',
6
+ subtitle: '10.1 Dans le site web, des feuilles de styles sont-elles utilisées pour contrôler la présentation de l’information ? ?',
7
+ items: [
8
+
9
+ {
10
+ precision: '10.1.1 Dans chaque page web, les balises servant à la présentation de l’information ne doivent pas être présentes dans le code source généré des pages. Cette règle est-elle respectée ? ',
11
+ link: 'https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#10.1.1',
12
+ solution: [{
13
+ info1: '1. Vérifier l’absence des éléments de présentation <basefont>, <big>, <blink>, <center>, <font>, <marquee>, <s>, <strike>, <tt> ; ',
14
+ info2: '2. Vérifier l’absence de l’élément <u> uniquement si le DOCTYPE du document ne correspond pas à HTML 5 ; ',
15
+ info3: '3. Si c’est le cas, le test est validé',
16
+ }],
17
+ expertise: ExpertiseLevelEnum.DEV,
18
+
19
+ },
20
+
21
+ ],
22
+ },
23
+
24
+ ]
25
+
26
+ export const AccessibiliteItemsValidated = [
27
+ {
28
+ title: 'Catégorie 1 : Images',
29
+ subtitle: '1.2 Chaque image de décoration est-elle correctement ignorée par les technologies d’assistance ?',
30
+ items: [
31
+
32
+ {
33
+ precision: '1.2.4 Chaque image vectorielle (balise <svg>) de décoration, sans légende, vérifie-t-elle ces conditions ?'
34
+ + ' La balise <svg> possède un attribut WAI-ARIA aria-hidden="true" ;'
35
+ + ' La balise <svg> et ses enfants sont dépourvus d’alternative textuelle ;'
36
+ + ' Les balises <title> et <desc> sont absentes ou vides ;'
37
+ + ' La balise <svg> et ses enfants sont dépourvus d’attribut title.',
38
+ link: 'https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#1.2.4',
39
+ solution: [{
40
+ info1: '1. Retrouver dans le document les images décoratives dépourvues de légende structurées au moyen d’un élément <svg> ;',
41
+ info2: '2. Pour chaque image, vérifier que l’élément <svg> ne possède pas d’attributs aria-labelledby ou aria-label et qu’il :'
42
+ + ' Possède un attribut WAI-ARIA aria-hidden="true" ;'
43
+ + ' Et est dépourvu d’alternative textuelle (ainsi que ses éléments enfants) ;'
44
+ + ' Et ne contient pas d’éléments <title> et <desc> à moins que vides de contenu ;'
45
+ + ' Et est dépourvu d’attribut title (ainsi que ses éléments enfants).',
46
+ info3: '3. Si c’est le cas pour chaque image, le test est validé',
47
+ }],
48
+ expertise: ExpertiseLevelEnum.DESIGN,
49
+
50
+ },
51
+
52
+ ],
53
+ },
54
+ {
55
+ title: 'Catégorie 3 : Couleurs',
56
+ subtitle: '3.2 Dans chaque page web, le contraste entre la couleur du texte et la couleur de son arrière-plan est-il suffisamment élevé?',
57
+ items: [
58
+ {
59
+
60
+ precision: '3.2.1 Dans chaque page web, le texte et le texte en image sans effet de graisse d’une taille restituée inférieure à 24px vérifient-ils une de ces conditions? Le rapport de contraste entre le texte et son arrière-plan est de 4.5:1, au moins; Un mécanisme permet à l’utilisateur d’afficher le texte avec un rapport de contraste de 4.5:1, au moins.',
61
+ link: 'https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#3.2.1',
62
+ solution: [{
63
+ info1: '1. Retrouver dans le document les textes et les textes en image sans effet de graisse d’une taille restituée inférieure à 24px qui pourraient poser des problèmes de contraste ;',
64
+ info2: '2. Pour chacun de ces textes, vérifier que : Soit le rapport de contraste entre le texte et son arrière-plan est de 4.5:1, au moins; Soit un mécanisme permet à l’utilisateur d’afficher le texte avec un rapport de contraste de 4.5:1, au moins.',
65
+ info3: '3. Si c’est le cas pour chaque texte, le test est validé',
66
+ }],
67
+ expertise: ExpertiseLevelEnum.DESIGN,
68
+
69
+ },
70
+
71
+ ],
72
+ },
73
+
74
+ {
75
+ title: 'Catégorie 8 : Eléments Obligatoires',
76
+ subtitle: '8.9 Dans chaque page web, les balises ne doivent pas être utilisées uniquement à des fins de présentation',
77
+ items: [
78
+
79
+ {
80
+ precision: ' 8.9.1 Dans chaque page web les balises (à l’exception de <div>, <span> et <table>) ne doivent pas être utilisées uniquement à des fins de présentation. Cette règle est-elle respectée',
81
+ link: 'https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#8.9.1',
82
+ solution: [{
83
+ info1: '1. Retrouver dans le document l’ensemble des éléments sémantiques utilisés à des fins de présentation ;',
84
+ info2: '2. Pour chacun de ces éléments, vérifier que :'
85
+ + 'L’élément est pourvu d’un attribut role=“presentation” ;'
86
+ + 'L’utilisation de cet élément à des fins de présentation reste justifée',
87
+ info3: '3. Si c’est le cas, le test est validé',
88
+ }],
89
+ expertise: ExpertiseLevelEnum.DESIGN,
90
+
91
+ },
92
+
93
+ ],
94
+ },
95
+
96
+ ]
@@ -0,0 +1,41 @@
1
+ import { Canvas, Meta, Controls, Story, Source } from '@storybook/blocks';
2
+ import * as SyInputSelectStories from "./SyInputSelect.stories";
3
+
4
+ <Meta of={SyInputSelectStories} />
5
+
6
+ # SyInputSelect
7
+
8
+ Le composant `SyInputSelect` est utilisé pour proposer une alternative au `v-select` de Vuetify qui ne respecte pas les règles RGAA.<br/>
9
+ Il est basé sur un `v-input`.
10
+
11
+ <Canvas of={SyInputSelectStories.Default} />
12
+
13
+ <Story of={SyInputSelectStories.Info} />
14
+
15
+ # API
16
+
17
+ <Controls of={SyInputSelectStories.Default} />
18
+
19
+ # Exemple d'utilisation
20
+
21
+ <Source dark code={`
22
+ <script setup lang="ts">
23
+ import { SyInputSelect } from '@cnamts/synapse'
24
+
25
+ const items = [
26
+ { text: 'Option 1', value: '1' },
27
+ { text: 'Option 2', value: '2' },
28
+ ],
29
+ </script>
30
+
31
+ <template>
32
+ <main>
33
+ <div class="mt-12 ml-12">
34
+ <SyInputSelect
35
+ v-model="value"
36
+ :items="items"
37
+ />
38
+ </div>
39
+ </main>
40
+ </template>
41
+ `} />
@@ -1,26 +1,27 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
- import CustomInputSelect from './CustomInputSelect.vue'
2
+ import SyInputSelect from './SyInputSelect.vue'
3
3
  import { VBtn, VMenu, VList, VListItem, VListItemTitle } from 'vuetify/components'
4
4
  import { ref } from 'vue'
5
- import Alert from '../../Alert/Alert.vue'
5
+ import SyAlert from '@/components/SyAlert/SyAlert.vue'
6
6
 
7
7
  const meta = {
8
- title: 'Composants/Formulaires/CustomInputSelect',
9
- component: CustomInputSelect,
8
+ title: 'Composants/Formulaires/SyInputSelect',
9
+ component: SyInputSelect,
10
10
  parameters: {
11
11
  layout: 'fullscreen',
12
- controls: { exclude: ['selectedValue'] },
12
+ controls: { exclude: ['selectedValue', 'isOpen', 'toggleMenu', 'closeList', 'selectItem', 'selectedItem', 'getItemText'] },
13
13
  },
14
14
  argTypes: {
15
15
  selectedValue: { control: 'text' },
16
16
  items: { control: 'object' },
17
17
  errorMessages: { control: 'object' },
18
18
  required: { control: 'boolean' },
19
+ outlined: { control: 'boolean' },
19
20
  textKey: { control: 'text' },
20
21
  valueKey: { control: 'text' },
21
22
  vuetifyOptions: { control: 'object' },
22
23
  },
23
- } as Meta<typeof CustomInputSelect>
24
+ } as Meta<typeof SyInputSelect>
24
25
 
25
26
  export default meta
26
27
 
@@ -32,7 +33,7 @@ export const Default: Story = {
32
33
  name: 'Template',
33
34
  code: `
34
35
  <template>
35
- <CustomInputSelect
36
+ <SyInputSelect
36
37
  v-model="value"
37
38
  :items="items"
38
39
  />
@@ -43,7 +44,7 @@ export const Default: Story = {
43
44
  name: 'Script',
44
45
  code: `
45
46
  <script setup lang="ts">
46
- import CustomInputSelect from '@cnamts/CustomInputSelect'
47
+ import SyInputSelect from '@cnamts/SyInputSelect'
47
48
 
48
49
  const items = [
49
50
  { text: 'Option 1', value: '1' },
@@ -70,13 +71,13 @@ export const Default: Story = {
70
71
  },
71
72
  render: (args) => {
72
73
  return {
73
- components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
74
+ components: { SyInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
74
75
  setup() {
75
76
  return { args }
76
77
  },
77
78
  template: `
78
79
  <div class="d-flex flex-wrap align-center pa-4">
79
- <CustomInputSelect
80
+ <SyInputSelect
80
81
  v-bind="args"
81
82
  :vuetify-options="args.vuetifyOptions"
82
83
  />
@@ -87,60 +88,6 @@ export const Default: Story = {
87
88
  },
88
89
  }
89
90
 
90
- export const Outlined: Story = {
91
- parameters: {
92
- sourceCode: [
93
- {
94
- name: 'Template',
95
- code: `
96
- <template>
97
- <CustomInputSelect
98
- v-model="value"
99
- :items="items"
100
- outlined
101
- />
102
- </template>
103
- `,
104
- },
105
- {
106
- name: 'Script',
107
- code: `
108
- <script setup lang="ts">
109
- import CustomInputSelect from '@cnamts/CustomInputSelect'
110
-
111
- const items = [
112
- { text: 'Option 1', value: '1' },
113
- { text: 'Option 2', value: '2' },
114
- ],
115
- </script>
116
- `,
117
- },
118
- ],
119
- },
120
- args: {
121
- items: [
122
- { text: 'Option 1', value: '1' },
123
- { text: 'Option 2', value: '2' },
124
- ],
125
- },
126
- render: (args) => {
127
- return {
128
- components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
129
- setup() {
130
- return { args }
131
- },
132
- template: `
133
- <div class="d-flex flex-wrap align-center pa-4">
134
- <CustomInputSelect
135
- v-bind="args"
136
- outlined
137
- />
138
- </div>
139
- `,
140
- }
141
- },
142
- }
143
-
144
91
  export const Required: Story = {
145
92
  parameters: {
146
93
  sourceCode: [
@@ -148,7 +95,7 @@ export const Required: Story = {
148
95
  name: 'Template',
149
96
  code: `
150
97
  <template>
151
- <CustomInputSelect
98
+ <SyInputSelect
152
99
  v-model="value"
153
100
  :items="items"
154
101
  required
@@ -160,7 +107,7 @@ export const Required: Story = {
160
107
  name: 'Script',
161
108
  code: `
162
109
  <script setup lang="ts">
163
- import CustomInputSelect from '@cnamts/CustomInputSelect'
110
+ import SyInputSelect from '@cnamts/SyInputSelect'
164
111
 
165
112
  const items = [
166
113
  { text: 'Option 1', value: '1' },
@@ -180,13 +127,13 @@ export const Required: Story = {
180
127
  },
181
128
  render: (args) => {
182
129
  return {
183
- components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
130
+ components: { SyInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
184
131
  setup() {
185
132
  return { args }
186
133
  },
187
134
  template: `
188
135
  <div class="d-flex flex-wrap align-center pa-4">
189
- <CustomInputSelect
136
+ <SyInputSelect
190
137
  v-bind="args"
191
138
  :required="args.required"
192
139
  />
@@ -203,7 +150,7 @@ export const withCustomError: Story = {
203
150
  name: 'Template',
204
151
  code: `
205
152
  <template>
206
- <CustomInputSelect
153
+ <SyInputSelect
207
154
  v-model="value"
208
155
  :items="items"
209
156
  :error-messages="errorMessages"
@@ -218,7 +165,7 @@ export const withCustomError: Story = {
218
165
  name: 'Script',
219
166
  code: `
220
167
  <script setup lang="ts">
221
- import CustomInputSelect from '@cnamts/CustomInputSelect'
168
+ import SyInputSelect from '@cnamts/SyInputSelect'
222
169
  import { ref } from 'vue'
223
170
 
224
171
  const items = [
@@ -244,7 +191,7 @@ export const withCustomError: Story = {
244
191
  },
245
192
  render: (args) => {
246
193
  return {
247
- components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
194
+ components: { SyInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
248
195
  setup() {
249
196
  const errorMessages = ref([])
250
197
  const triggerError = () => {
@@ -255,7 +202,7 @@ export const withCustomError: Story = {
255
202
  },
256
203
  template: `
257
204
  <div class="d-flex flex-wrap align-center pa-4">
258
- <CustomInputSelect
205
+ <SyInputSelect
259
206
  v-bind="args"
260
207
  :error-messages="errorMessages"
261
208
  />
@@ -275,7 +222,7 @@ export const withCustomKey: Story = {
275
222
  name: 'Template',
276
223
  code: `
277
224
  <template>
278
- <CustomInputSelect
225
+ <SyInputSelect
279
226
  v-model="value"
280
227
  :items="items"
281
228
  text-key="customKey"
@@ -288,7 +235,7 @@ export const withCustomKey: Story = {
288
235
  name: 'Script',
289
236
  code: `
290
237
  <script setup lang="ts">
291
- import CustomInputSelect from '@cnamts/CustomInputSelect'
238
+ import SyInputSelect from '@cnamts/SyInputSelect'
292
239
 
293
240
  const items = [
294
241
  { customKey: 'Choix 1', value: '1' },
@@ -307,13 +254,13 @@ export const withCustomKey: Story = {
307
254
  },
308
255
  render: (args) => {
309
256
  return {
310
- components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
257
+ components: { SyInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
311
258
  setup() {
312
259
  return { args }
313
260
  },
314
261
  template: `
315
262
  <div class="d-flex flex-wrap align-center pa-4">
316
- <CustomInputSelect
263
+ <SyInputSelect
317
264
  v-bind="args"
318
265
  outlined
319
266
  text-key="customKey"
@@ -331,7 +278,7 @@ export const withCustomStyles: Story = {
331
278
  name: 'Template',
332
279
  code: `
333
280
  <template>
334
- <CustomInputSelect
281
+ <SyInputSelect
335
282
  v-model="value"
336
283
  :items="items"
337
284
  :vuetify-options="vuetifyOptions
@@ -343,7 +290,7 @@ export const withCustomStyles: Story = {
343
290
  name: 'Script',
344
291
  code: `
345
292
  <script setup lang="ts">
346
- import CustomInputSelect from '@cnamts/CustomInputSelect'
293
+ import SyInputSelect from '@cnamts/SyInputSelect'
347
294
 
348
295
  const items = [
349
296
  { text: 'Option 1', value: '1' },
@@ -379,13 +326,13 @@ export const withCustomStyles: Story = {
379
326
  },
380
327
  render: (args) => {
381
328
  return {
382
- components: { CustomInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
329
+ components: { SyInputSelect, VBtn, VMenu, VList, VListItem, VListItemTitle },
383
330
  setup() {
384
331
  return { args }
385
332
  },
386
333
  template: `
387
334
  <div class="d-flex flex-wrap align-center pa-4">
388
- <CustomInputSelect
335
+ <SyInputSelect
389
336
  v-bind="args"
390
337
  :items="args.items"
391
338
  :vuetify-options="args.vuetifyOptions"
@@ -399,12 +346,12 @@ export const withCustomStyles: Story = {
399
346
  export const Info: Story = {
400
347
  render: (args) => {
401
348
  return {
402
- components: { Alert },
349
+ components: { SyAlert },
403
350
  setup() {
404
351
  return { args }
405
352
  },
406
353
  template: `
407
- <Alert v-model="args.modelValue" :type="args.type" :variant="tonal" :closable="false">
354
+ <SyAlert v-model="args.modelValue" :type="args.type" :variant="tonal" :closable="false">
408
355
  <template #default>
409
356
  <b>Format des items :</b>
410
357
  <ul>
@@ -412,7 +359,7 @@ export const Info: Story = {
412
359
  <li>- Si les items sont un tableau de string, le composant les utilisera directement.</li>
413
360
  </ul>
414
361
  </template>
415
- </Alert>
362
+ </SyAlert>
416
363
  `,
417
364
  }
418
365
  },
@@ -1,8 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import { mdiChevronDown } from '@mdi/js'
2
+ import { mdiChevronDown, mdiInformation } from '@mdi/js'
3
3
  import { computed, onMounted, ref, watch } from 'vue'
4
- import { VIcon, VList, VListItem, VListItemTitle } from 'vuetify/components'
5
-
6
4
  import useCustomizableOptions, { type CustomizableOptions } from '@/composables/useCustomizableOptions'
7
5
  import defaultOptions from './config'
8
6
 
@@ -22,7 +20,7 @@
22
20
  textKey: 'text',
23
21
  valueKey: 'value',
24
22
  label: 'Sélectionnez une option',
25
- outlined: false,
23
+ outlined: true,
26
24
  required: false,
27
25
  errorMessages: () => [],
28
26
  isHeaderToolbar: false,
@@ -34,6 +32,7 @@
34
32
 
35
33
  const isOpen = ref(false)
36
34
  const selectedItem = ref<Record<string, unknown> | string | null>(props.modelValue)
35
+ const hasError = ref(false)
37
36
 
38
37
  const toggleMenu = () => {
39
38
  isOpen.value = !isOpen.value
@@ -43,7 +42,11 @@
43
42
  isOpen.value = false
44
43
  }
45
44
 
46
- const inputId = ref(`custom-input-select-${Math.random().toString(36).substring(7)}`)
45
+ const isRequired = computed(() => {
46
+ return (props.required || props.errorMessages.length > 0) && !selectedItem.value
47
+ })
48
+
49
+ const inputId = ref(`sy-input-select-${Math.random().toString(36).substring(7)}`)
47
50
 
48
51
  // eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
49
52
  const selectItem = (item: any) => {
@@ -69,8 +72,18 @@
69
72
  selectedItem.value = newValue
70
73
  })
71
74
 
75
+ watch([isOpen, hasError], ([newIsOpen, newHasError]) => {
76
+ if (!newIsOpen) {
77
+ hasError.value = (!selectedItem.value && isRequired.value) || props.errorMessages.length > 0
78
+ }
79
+ else {
80
+ hasError.value = newHasError
81
+ }
82
+ })
83
+
72
84
  watch(() => props.errorMessages, (newValue) => {
73
85
  localErrorMessages.value = newValue
86
+ hasError.value = newValue.length > 0
74
87
  })
75
88
 
76
89
  const menu = ref<HTMLElement | null>(null)
@@ -88,6 +101,9 @@
88
101
  })
89
102
 
90
103
  const buttonClass = computed(() => {
104
+ if (props.outlined && hasError.value) {
105
+ return 'v-btn v-btn--density-default v-btn--size-default v-btn--variant-outlined error text-error'
106
+ }
91
107
  return props.outlined ? 'v-btn v-btn--density-default v-btn--size-default v-btn--variant-outlined' : 'text-color'
92
108
  })
93
109
 
@@ -113,6 +129,14 @@
113
129
  localErrorMessages.value = []
114
130
  return true
115
131
  }
132
+
133
+ defineExpose({
134
+ isOpen,
135
+ closeList,
136
+ selectItem,
137
+ selectedItem,
138
+ getItemText,
139
+ })
116
140
  </script>
117
141
 
118
142
  <template>
@@ -128,7 +152,7 @@
128
152
  <div
129
153
  ref="menu"
130
154
  v-click-outside="closeList"
131
- :class="['custom-select', buttonClass, 'text-'+options.menu.color]"
155
+ :class="['sy-input-select', buttonClass, 'text-'+options.menu.color]"
132
156
  role="menu"
133
157
  tabindex="0"
134
158
  @click="toggleMenu"
@@ -136,6 +160,13 @@
136
160
  @keydown.space.prevent="toggleMenu"
137
161
  >
138
162
  <span>{{ selectedItemText }}</span>
163
+ <VIcon
164
+ v-if="hasError"
165
+ class="ml-2"
166
+ color="error"
167
+ >
168
+ {{ mdiInformation }}
169
+ </VIcon>
139
170
  <VIcon> {{ mdiChevronDown }}</VIcon>
140
171
  </div>
141
172
  <VList
@@ -171,6 +202,11 @@
171
202
  <style lang="scss" scoped>
172
203
  @use '@/assets/tokens.scss';
173
204
 
205
+ .sy-input-select {
206
+ text-transform: none !important;
207
+ font-size: 16px;
208
+ }
209
+
174
210
  .v-input {
175
211
  cursor: pointer;
176
212
  position: relative;
@@ -202,6 +238,10 @@
202
238
  }
203
239
  }
204
240
 
241
+ .error {
242
+ border-color: tokens.$danger-default;
243
+ }
244
+
205
245
  .v-btn {
206
246
  color: tokens.$blue-base;
207
247
  }
@@ -0,0 +1,4 @@
1
+ export enum ExpertiseLevelEnum {
2
+ DEV = 'dev',
3
+ DESIGN = 'design',
4
+ }
@@ -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
+ })