@cnamts/synapse 0.0.3-alpha → 0.0.5-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/dist/design-system-v3.d.ts +1461 -68
  2. package/dist/design-system-v3.js +4775 -1673
  3. package/dist/design-system-v3.umd.cjs +10 -1
  4. package/dist/style.css +1 -1
  5. package/package.json +6 -2
  6. package/src/assets/tokens.scss +0 -1
  7. package/src/components/Alert/Accessibilite.mdx +14 -0
  8. package/src/components/Alert/Accessibilite.stories.ts +166 -0
  9. package/src/components/Alert/AccessibiliteItems.ts +152 -0
  10. package/src/components/Alert/Alert.mdx +1 -1
  11. package/src/components/Alert/Alert.stories.ts +91 -1
  12. package/src/components/Alert/constants/ExpertiseLevelEnum.ts +4 -0
  13. package/src/components/BackBtn/Accessibilite.mdx +14 -0
  14. package/src/components/BackBtn/Accessibilite.stories.ts +166 -0
  15. package/src/components/BackBtn/AccessibiliteItems.ts +132 -0
  16. package/src/components/BackBtn/BackBtn.mdx +1 -1
  17. package/src/components/BackBtn/BackBtn.stories.ts +84 -1
  18. package/src/components/BackBtn/constants/ExpertiseLevelEnum.ts +4 -0
  19. package/src/components/BackToTopBtn/Accessibilite.mdx +14 -0
  20. package/src/components/BackToTopBtn/Accessibilite.stories.ts +166 -0
  21. package/src/components/BackToTopBtn/AccessibiliteItems.ts +82 -0
  22. package/src/components/BackToTopBtn/BackToTopBtn.mdx +3 -3
  23. package/src/components/BackToTopBtn/BackToTopBtn.stories.ts +172 -11
  24. package/src/components/BackToTopBtn/constants/ExpertiseLevelEnum.ts +4 -0
  25. package/src/components/CollapsibleList/Accessibilite.mdx +14 -0
  26. package/src/components/CollapsibleList/Accessibilite.stories.ts +166 -0
  27. package/src/components/CollapsibleList/AccessibiliteItems.ts +129 -0
  28. package/src/components/CollapsibleList/CollapsibleList.mdx +2 -2
  29. package/src/components/CollapsibleList/CollapsibleList.stories.ts +37 -1
  30. package/src/components/CollapsibleList/constants/ExpertiseLevelEnum.ts +4 -0
  31. package/src/components/CopyBtn/Accessibilite.mdx +14 -0
  32. package/src/components/CopyBtn/Accessibilite.stories.ts +166 -0
  33. package/src/components/CopyBtn/AccessibiliteItems.ts +135 -0
  34. package/src/components/CopyBtn/CopyBtn.mdx +1 -1
  35. package/src/components/CopyBtn/CopyBtn.stories.ts +120 -1
  36. package/src/components/CopyBtn/CopyBtn.vue +1 -1
  37. package/src/components/CopyBtn/config.ts +2 -0
  38. package/src/components/CopyBtn/constants/ExpertiseLevelEnum.ts +4 -0
  39. package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +44 -0
  40. package/src/components/Customs/SyBtnSelect/SyBtnSelect.stories.ts +606 -0
  41. package/src/components/Customs/SyBtnSelect/SyBtnSelect.vue +246 -0
  42. package/src/components/Customs/SyBtnSelect/tests/SyBtnSelect.spec.ts +168 -0
  43. package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +40 -0
  44. package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +420 -0
  45. package/src/components/Customs/{CustomInputSelect/CustomInputSelect.vue → SyInputSelect/SyInputSelect.vue} +89 -54
  46. package/src/components/Customs/SyInputSelect/config.ts +10 -0
  47. package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +140 -0
  48. package/src/components/Customs/{CustomSelect/CustomSelect.mdx → SySelect/SySelect.mdx} +10 -10
  49. package/src/components/Customs/SySelect/SySelect.stories.ts +338 -0
  50. package/src/components/Customs/{CustomSelect/CustomSelect.vue → SySelect/SySelect.vue} +34 -11
  51. package/src/components/Customs/{CustomInputSelect/tests/CustomInputSelect.spec.ts → SySelect/tests/SySelect.spec.ts} +48 -71
  52. package/src/components/Customs/SyTextField/SyTextField.mdx +44 -0
  53. package/src/components/Customs/SyTextField/SyTextField.stories.ts +403 -0
  54. package/src/components/Customs/SyTextField/SyTextField.vue +110 -0
  55. package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +93 -0
  56. package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +57 -0
  57. package/src/components/Customs/SyTextField/types.d.ts +3 -0
  58. package/src/components/DataList/DataList.mdx +77 -0
  59. package/src/components/DataList/DataList.stories.ts +960 -0
  60. package/src/components/DataList/DataList.vue +140 -0
  61. package/src/components/DataList/DataListLoading/DataListLoading.vue +56 -0
  62. package/src/components/DataList/DataListLoading/tests/DataListLoading.spec.ts +23 -0
  63. package/src/components/DataList/locales.ts +3 -0
  64. package/src/components/DataList/tests/DataList.spec.ts +194 -0
  65. package/src/components/DataList/types.d.ts +23 -0
  66. package/src/components/DataListGroup/DataListGroup.mdx +77 -0
  67. package/src/components/DataListGroup/DataListGroup.stories.ts +987 -0
  68. package/src/components/DataListGroup/DataListGroup.vue +59 -0
  69. package/src/components/DataListGroup/tests/DataListGroup.spec.ts +54 -0
  70. package/src/components/DataListGroup/tests/data/dataListGroupItems.ts +41 -0
  71. package/src/components/DataListGroup/types.d.ts +15 -0
  72. package/src/components/DataListItem/DataListItem.vue +135 -0
  73. package/src/components/DataListItem/config.ts +17 -0
  74. package/src/components/DataListItem/locales.ts +3 -0
  75. package/src/components/DataListItem/tests/DataListItem.spec.ts +156 -0
  76. package/src/components/DataListItem/types.d.ts +23 -0
  77. package/src/components/DialogBox/DialogBox.mdx +14 -0
  78. package/src/components/DialogBox/DialogBox.stories.ts +798 -0
  79. package/src/components/DialogBox/DialogBox.vue +181 -0
  80. package/src/components/DialogBox/config.ts +25 -0
  81. package/src/components/DialogBox/locales.ts +5 -0
  82. package/src/components/DialogBox/tests/DialogBox.spec.ts +329 -0
  83. package/src/components/DialogBox/tests/__snapshots__/DialogBox.spec.ts.snap +46 -0
  84. package/src/components/DownloadBtn/Accessibilite.mdx +14 -0
  85. package/src/components/DownloadBtn/Accessibilite.stories.ts +166 -0
  86. package/src/components/DownloadBtn/AccessibiliteItems.ts +129 -0
  87. package/src/components/DownloadBtn/DownloadBtn.mdx +5 -6
  88. package/src/components/DownloadBtn/DownloadBtn.stories.ts +207 -2
  89. package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +4 -0
  90. package/src/components/ErrorPage/ErrorPage.mdx +21 -0
  91. package/src/components/ErrorPage/ErrorPage.stories.ts +133 -0
  92. package/src/components/ErrorPage/ErrorPage.vue +93 -0
  93. package/src/components/ErrorPage/locales.ts +5 -0
  94. package/src/components/ErrorPage/tests/ErrorPage.spec.ts +40 -0
  95. package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +78 -0
  96. package/src/components/FooterBar/FooterBar.mdx +2 -2
  97. package/src/components/FooterBar/FooterBar.stories.ts +557 -9
  98. package/src/components/FooterBar/config.ts +2 -3
  99. package/src/components/FooterBar/tests/FooterBar.spec.ts +1 -1
  100. package/src/components/FooterBar/tests/FooterBarConfig.spec.ts +1 -1
  101. package/src/components/FooterBar/tests/__snapshots__/FooterBar.spec.ts.snap +2 -2
  102. package/src/components/FranceConnectBtn/Accessibilite.mdx +14 -0
  103. package/src/components/FranceConnectBtn/Accessibilite.stories.ts +194 -0
  104. package/src/components/FranceConnectBtn/AccessibiliteItems.ts +199 -0
  105. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +1 -1
  106. package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +58 -1
  107. package/src/components/FranceConnectBtn/constants/ExpertiseLevelEnum.ts +4 -0
  108. package/src/components/HeaderBar/HeaderBar.mdx +164 -45
  109. package/src/components/HeaderBar/HeaderBar.stories.ts +618 -16
  110. package/src/components/HeaderBar/HeaderBar.vue +60 -22
  111. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.mdx +433 -0
  112. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.stories.ts +1089 -0
  113. package/src/components/HeaderBar/{HeaderComplexMenu/HeaderComplexMenu.vue → HeaderBurgerMenu/HeaderBurgerMenu.vue} +74 -45
  114. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.mdx +38 -0
  115. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +89 -0
  116. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/__snapshots__/HeaderMenuItem.spec.ts.snap +1 -1
  117. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.mdx +17 -0
  118. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +121 -0
  119. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/HeaderMenuSection.vue +2 -2
  120. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/tests/HeaderMenuSection.spec.ts +1 -3
  121. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.mdx +43 -0
  122. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +261 -0
  123. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/HeaderSubMenu.vue +17 -3
  124. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/tests/HeaderSubMenu.spec.ts +1 -1
  125. package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +180 -0
  126. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderBurgerMenu.spec.ts.snap +13 -0
  127. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +13 -0
  128. package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +62 -25
  129. package/src/components/HeaderBar/HeaderLogo/tests/HeaderLogo.spec.ts +49 -1
  130. package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +19 -23
  131. package/src/components/HeaderBar/HeaderMenuBtn/tests/HeaderMenuBtn.spec.ts +70 -0
  132. package/src/components/HeaderBar/Usages.mdx +85 -0
  133. package/src/components/HeaderBar/consts.scss +0 -1
  134. package/src/components/HeaderBar/tests/HeaderBar.spec.ts +8 -2
  135. package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +5 -10
  136. package/src/components/HeaderLoading/HeaderLoading.mdx +28 -0
  137. package/src/components/HeaderLoading/HeaderLoading.stories.ts +62 -0
  138. package/src/components/HeaderLoading/HeaderLoading.vue +45 -0
  139. package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +22 -0
  140. package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +128 -0
  141. package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +784 -0
  142. package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +194 -0
  143. package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +74 -0
  144. package/src/components/HeaderNavigationBar/HorizontalNavbar/config.ts +18 -0
  145. package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +127 -0
  146. package/src/components/HeaderNavigationBar/types.ts +7 -0
  147. package/src/components/HeaderToolbar/HeaderToolbar.mdx +31 -0
  148. package/src/components/HeaderToolbar/HeaderToolbar.stories.ts +343 -0
  149. package/src/components/HeaderToolbar/HeaderToolbar.vue +487 -0
  150. package/src/components/HeaderToolbar/tests/HeaderToolbar.spec.ts +230 -0
  151. package/src/components/HeaderToolbar/types.d.ts +20 -0
  152. package/src/components/LangBtn/Accessibilite.mdx +14 -0
  153. package/src/components/LangBtn/Accessibilite.stories.ts +166 -0
  154. package/src/components/LangBtn/AccessibiliteItems.ts +132 -0
  155. package/src/components/LangBtn/LangBtn.mdx +1 -1
  156. package/src/components/LangBtn/LangBtn.stories.ts +125 -8
  157. package/src/components/LangBtn/constants/ExpertiseLevelEnum.ts +4 -0
  158. package/src/components/LangBtn/tests/LangBtn.spec.ts +1 -1
  159. package/src/components/LangBtn/tests/__snapshots__/LangBtn.spec.ts.snap +1 -1
  160. package/src/components/Logo/Logo.mdx +2 -2
  161. package/src/components/Logo/Logo.stories.ts +147 -1
  162. package/src/components/LogoBrandSection/LogoBrandSection.mdx +14 -0
  163. package/src/components/LogoBrandSection/LogoBrandSection.stories.ts +158 -0
  164. package/src/components/LogoBrandSection/LogoBrandSection.vue +312 -0
  165. package/src/components/LogoBrandSection/assets/ameli-pro.svg +1 -0
  166. package/src/components/LogoBrandSection/assets/ameli.svg +1 -0
  167. package/src/components/LogoBrandSection/assets/cnam.svg +1 -0
  168. package/src/components/LogoBrandSection/assets/compte-ameli.svg +1 -0
  169. package/src/components/LogoBrandSection/dividerDimensionsMapping.ts +14 -0
  170. package/src/components/LogoBrandSection/locales.ts +14 -0
  171. package/src/components/LogoBrandSection/secondaryLogoMapping.ts +24 -0
  172. package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +365 -0
  173. package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +14 -0
  174. package/src/components/LogoBrandSection/types.ts +8 -0
  175. package/src/components/MaintenancePage/MaintenancePage.mdx +11 -0
  176. package/src/components/MaintenancePage/MaintenancePage.stories.ts +41 -0
  177. package/src/components/MaintenancePage/MaintenancePage.vue +25 -0
  178. package/src/components/MaintenancePage/assets/maintenance.svg +1 -0
  179. package/src/components/MaintenancePage/index.ts +3 -0
  180. package/src/components/MaintenancePage/locales.ts +5 -0
  181. package/src/components/MaintenancePage/tests/MaintenancePage.spec.ts +12 -0
  182. package/src/components/MaintenancePage/tests/__snapshots__/MaintenancePage.spec.ts.snap +3 -0
  183. package/src/components/NotFoundPage/NotFoundPage.mdx +19 -0
  184. package/src/components/NotFoundPage/NotFoundPage.stories.ts +76 -0
  185. package/src/components/NotFoundPage/NotFoundPage.vue +52 -0
  186. package/src/components/NotFoundPage/assets/not-found.svg +1 -0
  187. package/src/components/NotFoundPage/locales.ts +6 -0
  188. package/src/components/NotFoundPage/tests/NotFoundPage.spec.ts +38 -0
  189. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +76 -0
  190. package/src/components/NotificationBar/Accessibilite.mdx +14 -0
  191. package/src/components/NotificationBar/Accessibilite.stories.ts +166 -0
  192. package/src/components/NotificationBar/AccessibiliteItems.ts +174 -0
  193. package/src/components/NotificationBar/NotificationBar.mdx +6 -6
  194. package/src/components/NotificationBar/NotificationBar.stories.ts +1 -1
  195. package/src/components/NotificationBar/NotificationBar.vue +2 -2
  196. package/src/components/NotificationBar/constants/ExpertiseLevelEnum.ts +4 -0
  197. package/src/components/NotificationBar/options.ts +1 -0
  198. package/src/components/NotificationBar/tests/NotificationBar.spec.ts +1 -1
  199. package/src/components/PageContainer/Accessibilite.mdx +14 -0
  200. package/src/components/PageContainer/Accessibilite.stories.ts +166 -0
  201. package/src/components/PageContainer/AccessibiliteItems.ts +52 -0
  202. package/src/components/PageContainer/PageContainer.mdx +1 -1
  203. package/src/components/PageContainer/PageContainer.stories.ts +86 -1
  204. package/src/components/PageContainer/constants/ExpertiseLevelEnum.ts +4 -0
  205. package/src/components/PhoneField/PhoneField.mdx +49 -0
  206. package/src/components/PhoneField/PhoneField.stories.ts +869 -0
  207. package/src/components/PhoneField/PhoneField.vue +230 -0
  208. package/src/components/PhoneField/indicatifs.ts +104 -0
  209. package/src/components/PhoneField/locales.ts +4 -0
  210. package/src/components/PhoneField/tests/PhoneField.spec.ts +179 -0
  211. package/src/components/SkipLink/Accessibilite.mdx +14 -0
  212. package/src/components/SkipLink/Accessibilite.stories.ts +167 -0
  213. package/src/components/SkipLink/AccessibiliteItems.ts +77 -0
  214. package/src/components/SkipLink/SkipLink.stories.ts +50 -1
  215. package/src/components/SkipLink/constants/ExpertiseLevelEnum.ts +4 -0
  216. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +33 -2
  217. package/src/components/SocialMediaLinks/SocialMediaLinks.stories.ts +38 -1
  218. package/src/components/SocialMediaLinks/tests/SocialMediaLinks.spec.ts +1 -1
  219. package/src/components/SocialMediaLinks/tests/__snapshots__/SocialMediaLinks.spec.ts.snap +2 -2
  220. package/src/components/SubHeader/SubHeader.mdx +31 -0
  221. package/src/components/SubHeader/SubHeader.stories.ts +1032 -0
  222. package/src/components/SubHeader/SubHeader.vue +185 -0
  223. package/src/components/SubHeader/config.ts +12 -0
  224. package/src/components/SubHeader/locales.ts +3 -0
  225. package/src/components/SubHeader/tests/SubHeader.spec.ts +144 -0
  226. package/src/components/UserMenuBtn/UserMenuBtn.mdx +35 -0
  227. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +438 -0
  228. package/src/components/UserMenuBtn/UserMenuBtn.vue +105 -0
  229. package/src/components/UserMenuBtn/config.ts +24 -0
  230. package/src/components/UserMenuBtn/tests/UserMenuBtn.spec.ts +125 -0
  231. package/src/components/index.ts +33 -7
  232. package/src/composables/index.ts +8 -0
  233. package/src/composables/rules/tests/useFieldValidation.spec.ts +82 -0
  234. package/src/composables/rules/useFieldValidation.ts +53 -0
  235. package/src/composables/widthable/index.ts +29 -0
  236. package/src/composables/widthable/tests/widthable.spec.ts +52 -0
  237. package/src/designTokens/index.ts +2 -0
  238. package/src/designTokens/tokens/cnam/cnamDarkTheme.ts +5 -0
  239. package/src/designTokens/tokens/cnam/cnamLightTheme.ts +3 -2
  240. package/src/main.ts +3 -0
  241. package/src/modules.d.ts +4 -0
  242. package/src/services/index.ts +1 -0
  243. package/src/stories/Demarrer/Accueil.mdx +10 -0
  244. package/src/stories/Demarrer/Accueil.stories.ts +76 -0
  245. package/src/stories/Demarrer/PolitiqueDeConfidentialite.mdx +9 -0
  246. package/src/stories/Demarrer/PolitiqueDeConfidentialite.stories.ts +20 -0
  247. package/src/stories/Fondamentaux/Arrondis.mdx +24 -0
  248. package/src/stories/{Guidelines → Fondamentaux}/Colors.mdx +1 -1
  249. package/src/stories/Fondamentaux/Conteneurs.mdx +7 -0
  250. package/src/stories/Fondamentaux/CustomisationEtThemes.mdx +7 -0
  251. package/src/stories/Fondamentaux/Elevations.mdx +14 -0
  252. package/src/stories/Fondamentaux/Espacements.mdx +29 -0
  253. package/src/stories/{Guidelines → Fondamentaux}/Introduction.mdx +1 -1
  254. package/src/stories/Fondamentaux/StylesTypographiques.mdx +33 -0
  255. package/src/stories/Fondamentaux/Typographie.mdx +58 -0
  256. package/src/stories/GuideDuDev/CommentUtiliserLesRules.mdx +132 -0
  257. package/src/stories/GuideDuDev/moduleDeNotification.mdx +52 -48
  258. package/src/stories/GuideDuDev/vuetifyOptions.mdx +31 -28
  259. package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/Accessibilite.mdx +1 -2
  260. package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/Accessibilite.stories.ts +1 -1
  261. package/src/stories/{Fondamentaux → Guidelines}/EcoConception/Econception.stories.ts +2 -2
  262. package/src/utils/functions/throttleDisplayFn/tests/throttleDisplayFn.spec.ts +47 -0
  263. package/src/utils/functions/throttleDisplayFn/throttleDisplayFn.ts +26 -0
  264. package/src/utils/rules/exactLength/index.ts +33 -0
  265. package/src/utils/rules/exactLength/locales.ts +6 -0
  266. package/src/utils/rules/required/index.ts +25 -0
  267. package/src/utils/rules/required/locales.ts +5 -0
  268. package/src/utils/rules/required/ruleMessageHelper.ts +14 -0
  269. package/src/utils/rules/required/tests/index.spec.ts +47 -0
  270. package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +22 -0
  271. package/src/utils/rules/types.d.ts +15 -0
  272. package/src/components/Beta/beta.mdx +0 -5
  273. package/src/components/Customs/CustomInputSelect/CustomInputSelect.mdx +0 -42
  274. package/src/components/Customs/CustomInputSelect/CustomInputSelect.stories.ts +0 -154
  275. package/src/components/Customs/CustomSelect/CustomSelect.stories.ts +0 -182
  276. package/src/components/Customs/CustomSelect/tests/CustomSelect.spec.ts +0 -236
  277. package/src/components/Deprecated/deprecated.mdx +0 -5
  278. package/src/components/HeaderBar/HeaderComplexMenu/HeaderComplexMenu.stories.ts +0 -272
  279. package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +0 -49
  280. package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +0 -56
  281. package/src/components/HeaderBar/HeaderComplexMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +0 -137
  282. package/src/components/HeaderBar/HeaderComplexMenu/tests/HeaderComplexMenu.spec.ts +0 -129
  283. package/src/components/HeaderBar/HeaderComplexMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +0 -18
  284. package/src/stories/Guidelines/CustomisationEtThemes.mdx +0 -3
  285. package/src/stories/Guidelines/Typo.mdx +0 -53
  286. package/src/stories/Home/Accueil.mdx +0 -7
  287. package/src/stories/Home/PolitiqueDeConfidentialite.mdx +0 -4
  288. package/src/stories/Home/synapse.webp +0 -0
  289. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/HeaderMenuItem.vue +0 -0
  290. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/HeaderMenuItem.spec.ts +0 -0
  291. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/conts.ts +0 -0
  292. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/locals.ts +0 -0
  293. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/tests/useHandleSubMenus.spec.ts +0 -0
  294. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/useHandleSubMenus.ts +0 -0
  295. /package/src/components/Logo/{types.d.ts → types.ts} +0 -0
  296. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/AccessibiliteItems.ts +0 -0
  297. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/constants/ExpertiseLevelEnum.ts +0 -0
  298. /package/src/stories/{Fondamentaux → Guidelines}/Accessibilite/constants/RGAALevelEnum.ts +0 -0
  299. /package/src/stories/{Fondamentaux → Guidelines}/EcoConception/EcoConception.mdx +0 -0
  300. /package/src/stories/{Fondamentaux → Guidelines}/EcoConception/ecoDesignItems.ts +0 -0
@@ -0,0 +1,230 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, watch, toRaw } from 'vue'
3
+ import type { PropType } from 'vue'
4
+ import { required as RequiredRule } from '@/utils/rules/required'
5
+ import { exactLength } from '@/utils/rules/exactLength'
6
+ import { mdiPhone, mdiInformation } from '@mdi/js'
7
+ import { indicatifs } from './indicatifs'
8
+ import { vMaska } from 'maska/vue'
9
+ import { locales } from './locales'
10
+ import SySelect from '@/components/Customs/SySelect/SySelect.vue'
11
+ import SyTextField from '@/components/Customs/SyTextField/SyTextField.vue'
12
+
13
+ type DisplayFormat = 'code' | 'code-abbreviation' | 'code-country' | 'country' | 'abbreviation'
14
+ type Indicatif = {
15
+ code: string
16
+ abbreviation: string
17
+ country: string
18
+ mask?: string
19
+ phoneLength: number
20
+ }
21
+
22
+ const props = defineProps({
23
+ modelValue: { type: String, default: '' },
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
25
+ dialCodeModel: { type: [String, Object] as PropType<string | Record<string, any>>, default: '' },
26
+ required: { type: Boolean, default: false },
27
+ outlined: { type: Boolean, default: false },
28
+ outlinedIndicatif: { type: Boolean, default: false },
29
+ withCountryCode: { type: Boolean, default: false },
30
+ countryCodeRequired: { type: Boolean, default: false },
31
+ displayFormat: { type: String as PropType<DisplayFormat>, default: 'code' },
32
+ customIndicatifs: { type: Array as PropType<Indicatif[]>, default: () => [] },
33
+ useCustomIndicatifsOnly: { type: Boolean, default: false },
34
+ isValidatedOnBlur: { type: Boolean, default: true },
35
+ })
36
+
37
+ const emit = defineEmits(['update:modelValue', 'update:selectedDialCode', 'change'])
38
+
39
+ const phoneNumber = ref(props.modelValue || '')
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
41
+ const dialCode = ref<string | Record<string, any>>(props.dialCodeModel || '')
42
+ const counter = ref(10)
43
+ const phoneMask = ref('## ## ## ## ##')
44
+ const hasError = ref(false)
45
+ const onBlur = ref(false)
46
+
47
+ const mergedDialCodes = computed(() =>
48
+ props.useCustomIndicatifsOnly ? props.customIndicatifs : [...indicatifs, ...props.customIndicatifs],
49
+ )
50
+
51
+ const dialCodeOptions = computed(() =>
52
+ mergedDialCodes.value.map(ind => ({
53
+ ...ind,
54
+ displayText: generateDisplayText(ind),
55
+ })),
56
+ )
57
+
58
+ function generateDisplayText(ind: Indicatif): string {
59
+ const format = {
60
+ 'code': ind.code,
61
+ 'code-abbreviation': `${ind.code} (${ind.abbreviation})`,
62
+ 'code-country': `${ind.code} ${ind.country}`,
63
+ 'country': ind.country,
64
+ 'abbreviation': ind.abbreviation,
65
+ }
66
+ return format[props.displayFormat] || ind.code
67
+ }
68
+
69
+ const currentDialCode = computed(() => {
70
+ const rawDialCode = toRaw(dialCode.value)
71
+ return dialCodeOptions.value.find(ind => ind.code === String(rawDialCode))
72
+ })
73
+
74
+ function applyPhoneMask(phone: string): string {
75
+ phone = phone.replace(/\D/g, '')
76
+ if (currentDialCode.value?.mask) {
77
+ const regex = new RegExp(currentDialCode.value.mask.replace(/#/g, '\\d'))
78
+ return phone.replace(regex, currentDialCode.value.mask).trim()
79
+ }
80
+ return phone.replace(/(.{2})/g, '$1 ').trim()
81
+ }
82
+
83
+ function handlePhoneInput(event: Event) {
84
+ const input = (event.target as HTMLInputElement).value.replace(/\s|\D/g, '')
85
+ phoneNumber.value = input.startsWith(String(dialCode.value) || '')
86
+ ? input.slice(String(dialCode.value || '').length)
87
+ : input
88
+ emit('update:modelValue', phoneNumber.value)
89
+ emit('change', phoneNumber.value)
90
+ }
91
+
92
+ function validateInputOnBlur() {
93
+ if (!props.isValidatedOnBlur) return
94
+
95
+ hasError.value = false
96
+ const requiredValidation = !props.required || RequiredRule(phoneNumber.value) === true
97
+ const lengthValidation = exactLength(counter.value, true)(phoneNumber.value) === true
98
+
99
+ hasError.value = !(requiredValidation && lengthValidation)
100
+ onBlur.value = true
101
+ }
102
+
103
+ const validationRules = computed(() => {
104
+ const rules = [exactLength(counter.value, true)]
105
+ if (props.required) {
106
+ rules.unshift(RequiredRule)
107
+ }
108
+ return rules
109
+ })
110
+
111
+ const computedValue = computed(() =>
112
+ phoneNumber.value ? applyPhoneMask(phoneNumber.value) : '',
113
+ )
114
+
115
+ watch(() => props.modelValue, (newVal) => {
116
+ phoneNumber.value = newVal || ''
117
+ })
118
+
119
+ watch(dialCode, (newVal) => {
120
+ emit('update:selectedDialCode', newVal)
121
+ })
122
+
123
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
124
+ watch(dialCode, (selectedPhoneCode: any) => {
125
+ if (selectedPhoneCode) {
126
+ counter.value = selectedPhoneCode?.phoneLength || 10
127
+ phoneMask.value = selectedPhoneCode?.mask || '## ## ## ## ##'
128
+ }
129
+ })
130
+
131
+ defineExpose({
132
+ computedValue,
133
+ dialCode,
134
+ phoneMask,
135
+ counter,
136
+ hasError,
137
+ phoneNumber,
138
+ mergedDialCodes,
139
+ })
140
+
141
+ </script>
142
+
143
+ <template>
144
+ <div class="phone-field-container">
145
+ <SySelect
146
+ v-if="props.withCountryCode"
147
+ v-model="dialCode"
148
+ :items="dialCodeOptions"
149
+ text-key="displayText"
150
+ value-key="code"
151
+ :label="locales.indicatifLabel"
152
+ :required="props.countryCodeRequired"
153
+ class="custom-select"
154
+ :outlined="outlinedIndicatif"
155
+ />
156
+ <SyTextField
157
+ v-maska="phoneMask"
158
+ :model-value="computedValue"
159
+ :rules="validationRules"
160
+ :required="props.required"
161
+ :counter="counter"
162
+ :counter-value="(value: string) => value.replace(/\s/g, '').length"
163
+ :label="locales.label"
164
+ :variant="outlined ? 'outlined' : 'underlined'"
165
+ color="primary"
166
+ class="phoneField"
167
+ @input="handlePhoneInput"
168
+ @blur="validateInputOnBlur"
169
+ >
170
+ <template #append-inner>
171
+ <VIcon
172
+ class="mr-2"
173
+ color="#222324"
174
+ >
175
+ {{ mdiPhone }}
176
+ </VIcon>
177
+ <VIcon v-if="hasError">
178
+ {{ mdiInformation }}
179
+ </VIcon>
180
+ </template>
181
+ </SyTextField>
182
+ </div>
183
+ </template>
184
+
185
+ <style scoped>
186
+ .phone-field-container {
187
+ display: flex;
188
+ flex-direction: column;
189
+ align-items: flex-start;
190
+ width: 100%;
191
+ }
192
+
193
+ .phoneField {
194
+ width: 100%;
195
+ }
196
+
197
+ .custom-select {
198
+ width: 30%;
199
+ }
200
+
201
+ @media (min-width: 600px) {
202
+ .phone-field-container {
203
+ flex-direction: row;
204
+ align-items: center;
205
+ }
206
+
207
+ .custom-select {
208
+ margin-right: 1rem;
209
+ margin-bottom: 0;
210
+ min-width: 144px;
211
+ }
212
+
213
+ .phoneField {
214
+ min-width: 350px;
215
+ }
216
+ }
217
+
218
+ :deep(.v-list) {
219
+ position: absolute;
220
+ left: inherit !important;
221
+ margin-top: 58px;
222
+ background-color: white;
223
+ max-height: 300px;
224
+ padding: 0;
225
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.08);
226
+ border-radius: 4px;
227
+ overflow-y: auto;
228
+ z-index: 2;
229
+ }
230
+ </style>
@@ -0,0 +1,104 @@
1
+ export const indicatifs = [
2
+ { code: '+1', country: 'USA/Canada', abbreviation: 'US/CA', phoneLength: 10, mask: '###-###-####' },
3
+ { code: '+7', country: 'Russia/Kazakhstan', abbreviation: 'RU/KZ', phoneLength: 10, mask: '### ### ## ##' },
4
+ { code: '+20', country: 'Egypt', abbreviation: 'EG', phoneLength: 9, mask: '### ### ####' },
5
+ { code: '+27', country: 'South Africa', abbreviation: 'ZA', phoneLength: 9, mask: '### ### ####' },
6
+ { code: '+30', country: 'Greece', abbreviation: 'GR', phoneLength: 10, mask: '### ### ####' },
7
+ { code: '+31', country: 'Netherlands', abbreviation: 'NL', phoneLength: 9, mask: '## ### ####' },
8
+ { code: '+32', country: 'Belgium', abbreviation: 'BE', phoneLength: 9, mask: '### ### ###' },
9
+ { code: '+33', country: 'France', abbreviation: 'FR', phoneLength: 10, mask: '## ## ## ## ##' },
10
+ { code: '+34', country: 'Spain', abbreviation: 'ES', phoneLength: 9, mask: '### ### ###' },
11
+ { code: '+36', country: 'Hungary', abbreviation: 'HU', phoneLength: 9, mask: '## ### ####' },
12
+ { code: '+39', country: 'Italy', abbreviation: 'IT', phoneLength: 10, mask: '### ### ####' },
13
+ { code: '+40', country: 'Romania', abbreviation: 'RO', phoneLength: 9, mask: '### ### ###' },
14
+ { code: '+41', country: 'Switzerland', abbreviation: 'CH', phoneLength: 9, mask: '## ### ## ##' },
15
+ { code: '+44', country: 'United Kingdom', abbreviation: 'GB', phoneLength: 10, mask: '#### ### ####' },
16
+ { code: '+45', country: 'Denmark', abbreviation: 'DK', phoneLength: 8, mask: '## ## ## ##' },
17
+ { code: '+46', country: 'Sweden', abbreviation: 'SE', phoneLength: 9, mask: '## ### ## ##' },
18
+ { code: '+47', country: 'Norway', abbreviation: 'NO', phoneLength: 8, mask: '### ## ###' },
19
+ { code: '+48', country: 'Poland', abbreviation: 'PL', phoneLength: 9, mask: '### ### ###' },
20
+ { code: '+49', country: 'Germany', abbreviation: 'DE', phoneLength: 10, mask: '#### ### ####' },
21
+ { code: '+51', country: 'Peru', abbreviation: 'PE', phoneLength: 9, mask: '### ### ###' },
22
+ { code: '+52', country: 'Mexico', abbreviation: 'MX', phoneLength: 10, mask: '## #### ####' },
23
+ { code: '+53', country: 'Cuba', abbreviation: 'CU', phoneLength: 8, mask: '### ### ###' },
24
+ { code: '+54', country: 'Argentina', abbreviation: 'AR', phoneLength: 10, mask: '### ### ####' },
25
+ { code: '+55', country: 'Brazil', abbreviation: 'BR', phoneLength: 11, mask: '## ##### ####' },
26
+ { code: '+56', country: 'Chile', abbreviation: 'CL', phoneLength: 9, mask: '## #### ####' },
27
+ { code: '+57', country: 'Colombia', abbreviation: 'CO', phoneLength: 10, mask: '### ### ####' },
28
+ { code: '+58', country: 'Venezuela', abbreviation: 'VE', phoneLength: 10, mask: '### ### ####' },
29
+ { code: '+60', country: 'Malaysia', abbreviation: 'MY', phoneLength: 10, mask: '## ### ####' },
30
+ { code: '+61', country: 'Australia', abbreviation: 'AU', phoneLength: 9, mask: '### ### ###' },
31
+ { code: '+62', country: 'Indonesia', abbreviation: 'ID', phoneLength: 10, mask: '### ### ####' },
32
+ { code: '+63', country: 'Philippines', abbreviation: 'PH', phoneLength: 10, mask: '### ### ####' },
33
+ { code: '+64', country: 'New Zealand', abbreviation: 'NZ', phoneLength: 9, mask: '### ### ###' },
34
+ { code: '+65', country: 'Singapore', abbreviation: 'SG', phoneLength: 8, mask: '#### ####' },
35
+ { code: '+66', country: 'Thailand', abbreviation: 'TH', phoneLength: 9, mask: '### ### ###' },
36
+ { code: '+81', country: 'Japan', abbreviation: 'JP', phoneLength: 10, mask: '## #### ####' },
37
+ { code: '+82', country: 'South Korea', abbreviation: 'KR', phoneLength: 10, mask: '## #### ####' },
38
+ { code: '+84', country: 'Vietnam', abbreviation: 'VN', phoneLength: 9, mask: '## ### ####' },
39
+ { code: '+86', country: 'China', abbreviation: 'CN', phoneLength: 11, mask: '### #### ####' },
40
+ { code: '+90', country: 'Turkey', abbreviation: 'TR', phoneLength: 10, mask: '### ### ## ##' },
41
+ { code: '+91', country: 'India', abbreviation: 'IN', phoneLength: 10, mask: '##### #####' },
42
+ { code: '+92', country: 'Pakistan', abbreviation: 'PK', phoneLength: 10, mask: '### #### ####' },
43
+ { code: '+93', country: 'Afghanistan', abbreviation: 'AF', phoneLength: 9, mask: '## ### ####' },
44
+ { code: '+94', country: 'Sri Lanka', abbreviation: 'LK', phoneLength: 9, mask: '### ### ####' },
45
+ { code: '+95', country: 'Myanmar', abbreviation: 'MM', phoneLength: 9, mask: '## ### ###' },
46
+ { code: '+98', country: 'Iran', abbreviation: 'IR', phoneLength: 10, mask: '### ### ####' },
47
+ { code: '+212', country: 'Morocco', abbreviation: 'MA', phoneLength: 9, mask: '### #### ###' },
48
+ { code: '+213', country: 'Algeria', abbreviation: 'DZ', phoneLength: 9, mask: '### ### ####' },
49
+ { code: '+216', country: 'Tunisia', abbreviation: 'TN', phoneLength: 8, mask: '## ### ###' },
50
+ { code: '+218', country: 'Libya', abbreviation: 'LY', phoneLength: 9, mask: '### ### ###' },
51
+ { code: '+262', country: 'Réunion', abbreviation: 'FR', phoneLength: 9, mask: '### ### ###' },
52
+ { code: '+508', country: 'Saint Pierre and Miquelon', abbreviation: 'FR', phoneLength: 6, mask: '## ## ##' },
53
+ { code: '+590', country: 'Guadeloupe', abbreviation: 'FR', phoneLength: 9, mask: '### ### ###' },
54
+ { code: '+594', country: 'French Guiana', abbreviation: 'FR', phoneLength: 9, mask: '### ### ###' },
55
+ { code: '+596', country: 'Martinique', abbreviation: 'FR', phoneLength: 9, mask: '### ### ###' },
56
+ { code: '+687', country: 'New Caledonia', abbreviation: 'FR', phoneLength: 6, mask: '## ## ##' },
57
+ { code: '+689', country: 'French Polynesia', abbreviation: 'FR', phoneLength: 6, mask: '## ## ##' },
58
+ { code: '+220', country: 'Gambia', abbreviation: 'GM', phoneLength: 8, mask: '### ## ##' },
59
+ { code: '+221', country: 'Senegal', abbreviation: 'SN', phoneLength: 9, mask: '## ### ####' },
60
+ { code: '+222', country: 'Mauritania', abbreviation: 'MR', phoneLength: 8, mask: '## ## ## ##' },
61
+ { code: '+223', country: 'Mali', abbreviation: 'ML', phoneLength: 8, mask: '## ## ## ##' },
62
+ { code: '+224', country: 'Guinea', abbreviation: 'GN', phoneLength: 9, mask: '## ### ####' },
63
+ { code: '+225', country: 'Ivory Coast', abbreviation: 'CI', phoneLength: 8, mask: '## ## ## ##' },
64
+ { code: '+226', country: 'Burkina Faso', abbreviation: 'BF', phoneLength: 8, mask: '## ## ## ##' },
65
+ { code: '+227', country: 'Niger', abbreviation: 'NE', phoneLength: 8, mask: '## ## ## ##' },
66
+ { code: '+228', country: 'Togo', abbreviation: 'TG', phoneLength: 8, mask: '## ## ## ##' },
67
+ { code: '+229', country: 'Benin', abbreviation: 'BJ', phoneLength: 8, mask: '## ## ## ##' },
68
+ { code: '+230', country: 'Mauritius', abbreviation: 'MU', phoneLength: 7, mask: '### ####' },
69
+ { code: '+231', country: 'Liberia', abbreviation: 'LR', phoneLength: 7, mask: '## ### ###' },
70
+ { code: '+232', country: 'Sierra Leone', abbreviation: 'SL', phoneLength: 8, mask: '## #### ####' },
71
+ { code: '+233', country: 'Ghana', abbreviation: 'GH', phoneLength: 9, mask: '### ### ###' },
72
+ { code: '+234', country: 'Nigeria', abbreviation: 'NG', phoneLength: 8, mask: '### ### ###' },
73
+ { code: '+235', country: 'Chad', abbreviation: 'TD', phoneLength: 8, mask: '## ## ## ##' },
74
+ { code: '+236', country: 'Central African Republic', abbreviation: 'CF', phoneLength: 8, mask: '## ## ## ##' },
75
+ { code: '+237', country: 'Cameroon', abbreviation: 'CM', phoneLength: 9, mask: '## ### ####' },
76
+ { code: '+238', country: 'Cape Verde', abbreviation: 'CV', phoneLength: 7, mask: '### ####' },
77
+ { code: '+239', country: 'Sao Tome and Principe', abbreviation: 'ST', phoneLength: 7, mask: '### ####' },
78
+ { code: '+240', country: 'Equatorial Guinea', abbreviation: 'GQ', phoneLength: 9, mask: '### ### ####' },
79
+ { code: '+241', country: 'Gabon', abbreviation: 'GA', phoneLength: 9, mask: '## ### ####' },
80
+ { code: '+242', country: 'Republic of the Congo', abbreviation: 'CG', phoneLength: 9, mask: '## ### ####' },
81
+ { code: '+243', country: 'Democratic Republic of the Congo', abbreviation: 'CD', phoneLength: 9, mask: '### ### ####' },
82
+ { code: '+244', country: 'Angola', abbreviation: 'AO', phoneLength: 9, mask: '### ### ####' },
83
+ { code: '+245', country: 'Guinea-Bissau', abbreviation: 'GW', phoneLength: 7, mask: '### ####' },
84
+ { code: '+248', country: 'Seychelles', abbreviation: 'SC', phoneLength: 7, mask: '### ####' },
85
+ { code: '+249', country: 'Sudan', abbreviation: 'SD', phoneLength: 9, mask: '### ### ####' },
86
+ { code: '+250', country: 'Rwanda', abbreviation: 'RW', phoneLength: 9, mask: '### ### ###' },
87
+ { code: '+251', country: 'Ethiopia', abbreviation: 'ET', phoneLength: 9, mask: '### ### ###' },
88
+ { code: '+252', country: 'Somalia', abbreviation: 'SO', phoneLength: 8, mask: '### ### ##' },
89
+ { code: '+253', country: 'Djibouti', abbreviation: 'DJ', phoneLength: 8, mask: '## ## ## ##' },
90
+ { code: '+254', country: 'Kenya', abbreviation: 'KE', phoneLength: 9, mask: '### ### ###' },
91
+ { code: '+255', country: 'Tanzania', abbreviation: 'TZ', phoneLength: 9, mask: '### ### ###' },
92
+ { code: '+256', country: 'Uganda', abbreviation: 'UG', phoneLength: 9, mask: '### ### ###' },
93
+ { code: '+257', country: 'Burundi', abbreviation: 'BI', phoneLength: 8, mask: '## ## ## ##' },
94
+ { code: '+258', country: 'Mozambique', abbreviation: 'MZ', phoneLength: 9, mask: '## ### ####' },
95
+ { code: '+260', country: 'Zambia', abbreviation: 'ZM', phoneLength: 9, mask: '### ### ###' },
96
+ { code: '+261', country: 'Madagascar', abbreviation: 'MG', phoneLength: 9, mask: '## ## ###' },
97
+ { code: '+263', country: 'Zimbabwe', abbreviation: 'ZW', phoneLength: 9, mask: '### ### ###' },
98
+ { code: '+264', country: 'Namibia', abbreviation: 'NA', phoneLength: 9, mask: '### ### ###' },
99
+ { code: '+265', country: 'Malawi', abbreviation: 'MW', phoneLength: 9, mask: '### ### ###' },
100
+ { code: '+266', country: 'Lesotho', abbreviation: 'LS', phoneLength: 8, mask: '## ### ###' },
101
+ { code: '+267', country: 'Botswana', abbreviation: 'BW', phoneLength: 8, mask: '## ### ###' },
102
+ { code: '+268', country: 'Eswatini', abbreviation: 'SZ', phoneLength: 9, mask: '### ### ###' },
103
+ { code: '+269', country: 'Comoros', abbreviation: 'KM', phoneLength: 7, mask: '### ####' },
104
+ ]
@@ -0,0 +1,4 @@
1
+ export const locales = {
2
+ label: 'Numéro de téléphone',
3
+ indicatifLabel: 'Indicatif',
4
+ }
@@ -0,0 +1,179 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import PhoneField from '../PhoneField.vue'
3
+ import { describe, it, expect } from 'vitest'
4
+ import { createVuetify } from 'vuetify'
5
+ import * as components from 'vuetify/components'
6
+ import * as directives from 'vuetify/directives'
7
+
8
+ const vuetify = createVuetify({
9
+ components,
10
+ directives,
11
+ })
12
+ describe('PhoneField', () => {
13
+ it('renders correctly with default props', () => {
14
+ const wrapper = mount(PhoneField, {
15
+ global: {
16
+ plugins: [vuetify],
17
+ },
18
+ })
19
+ expect(wrapper.exists()).toBe(true)
20
+ })
21
+
22
+ it('emits update:modelValue and change events on phone input', async () => {
23
+ const wrapper = mount(PhoneField, {
24
+ global: {
25
+ plugins: [vuetify],
26
+ },
27
+ })
28
+ const input = wrapper.find('input')
29
+ await input.setValue('1234567890')
30
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy()
31
+ expect(wrapper.emitted('change')).toBeTruthy()
32
+ })
33
+
34
+ it('validates phone number and country code on blur', async () => {
35
+ })
36
+
37
+ it('applies default phone mask correctly', async () => {
38
+ const wrapper = mount(PhoneField, {
39
+ global: {
40
+ plugins: [vuetify],
41
+ },
42
+ props: { modelValue: '0619123456' },
43
+ })
44
+ expect(wrapper.vm.computedValue).toBe('06 19 12 34 56')
45
+ })
46
+
47
+ it('renders SySelect when withCountryCode is true', () => {
48
+ const wrapper = mount(PhoneField, {
49
+ global: {
50
+ plugins: [vuetify],
51
+ },
52
+ props: { withCountryCode: true },
53
+ })
54
+ expect(wrapper.findComponent({ name: 'SySelect' }).exists()).toBe(true)
55
+ })
56
+
57
+ it('validates country code when countryCodeRequired is true', async () => {
58
+ })
59
+
60
+ it('updates phone mask and counter when dialCode changes', async () => {
61
+ const wrapper = mount(PhoneField, {
62
+ global: {
63
+ plugins: [vuetify],
64
+ },
65
+ props: { withCountryCode: true },
66
+ })
67
+ wrapper.vm.dialCode = { code: '+1', phoneLength: 10, mask: '###-###-####' }
68
+ await wrapper.vm.$nextTick()
69
+ expect(wrapper.vm.phoneMask).toBe('###-###-####')
70
+ expect(wrapper.vm.counter).toBe(10)
71
+ })
72
+
73
+ it('validates phone number and country code on blur', async () => {
74
+ const wrapper = mount(PhoneField, {
75
+ global: {
76
+ plugins: [vuetify],
77
+ },
78
+ props: {
79
+ required: true,
80
+ countryCodeRequired: true,
81
+ modelValue: '1234567890',
82
+ withCountryCode: true,
83
+ isValidatedOnBlur: true,
84
+ },
85
+ })
86
+
87
+ // Simulate selecting a country code
88
+ wrapper.vm.dialCode = { code: '+1', phoneLength: 10, mask: '###-###-####' }
89
+ await wrapper.vm.$nextTick()
90
+
91
+ // Simulate blur event
92
+ const input = wrapper.find('input')
93
+ await input.trigger('blur')
94
+
95
+ // Check if validation was performed
96
+ expect(wrapper.vm.hasError).toBe(false)
97
+ })
98
+
99
+ it('updates phoneNumber when modelValue prop changes', async () => {
100
+ const wrapper = mount(PhoneField, {
101
+ global: {
102
+ plugins: [vuetify],
103
+ },
104
+ props: {
105
+ modelValue: '1234567890',
106
+ },
107
+ })
108
+
109
+ await wrapper.setProps({ modelValue: '0987654321' })
110
+
111
+ expect(wrapper.vm.phoneNumber).toBe('0987654321')
112
+ })
113
+
114
+ it('uses only custom indicatifs when useCustomIndicatifsOnly is true', () => {
115
+ const customIndicatifs = [{ code: '+99', abbreviation: 'XX', country: 'Testland', phoneLength: 10 }]
116
+ const wrapper = mount(PhoneField, {
117
+ global: {
118
+ plugins: [vuetify],
119
+ },
120
+ props: {
121
+ useCustomIndicatifsOnly: true,
122
+ customIndicatifs,
123
+ },
124
+ })
125
+
126
+ expect(wrapper.vm.mergedDialCodes).toEqual(customIndicatifs)
127
+ })
128
+
129
+ it('validates phone number and country code on blur', async () => {
130
+ const wrapper = mount(PhoneField, {
131
+ global: {
132
+ plugins: [vuetify],
133
+ },
134
+ props: {
135
+ required: true,
136
+ countryCodeRequired: true,
137
+ modelValue: '1234567890',
138
+ withCountryCode: true,
139
+ isValidatedOnBlur: true,
140
+ },
141
+ })
142
+
143
+ wrapper.vm.dialCode = { code: '+1', phoneLength: 10, mask: '###-###-####' }
144
+ await wrapper.vm.$nextTick()
145
+
146
+ const input = wrapper.find('input')
147
+ await input.trigger('blur')
148
+
149
+ expect(wrapper.vm.hasError).toBe(false)
150
+ })
151
+
152
+ it('renders VTextField with outlined variant when outlined prop is true', () => {
153
+ const wrapper = mount(PhoneField, {
154
+ global: {
155
+ plugins: [vuetify],
156
+ },
157
+ props: {
158
+ outlined: true,
159
+ },
160
+ })
161
+
162
+ const textField = wrapper.findComponent({ name: 'VTextField' })
163
+ expect(textField.props('variant')).toBe('outlined')
164
+ })
165
+
166
+ it('renders VTextField with underlined variant when outlined prop is false', () => {
167
+ const wrapper = mount(PhoneField, {
168
+ global: {
169
+ plugins: [vuetify],
170
+ },
171
+ props: {
172
+ outlined: false,
173
+ },
174
+ })
175
+
176
+ const textField = wrapper.findComponent({ name: 'VTextField' })
177
+ expect(textField.props('variant')).toBe('underlined')
178
+ })
179
+ })
@@ -0,0 +1,14 @@
1
+ import { Meta, Story } from '@storybook/addon-docs';
2
+ import * as AccessStories from './Accessibilite.stories.ts';
3
+
4
+ <Meta of={AccessStories} />
5
+
6
+ Accessibilité
7
+ =============
8
+ <Story of={AccessStories.Legende} />
9
+ <br />
10
+
11
+ --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
12
+
13
+ <Story of={AccessStories.AccessibilitePanel} />
14
+ <br />