@cnamts/synapse 0.0.12-alpha → 0.0.13-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 (250) hide show
  1. package/dist/design-system-v3.js +4913 -4021
  2. package/dist/design-system-v3.umd.cjs +1 -1
  3. package/dist/src/components/Amelipro/types/types.d.ts +30 -57
  4. package/dist/src/components/Customs/SyTextField/SyTextField.d.ts +2 -0
  5. package/dist/src/components/DatePicker/DatePicker.d.ts +36 -44
  6. package/dist/src/components/DatePicker/DateTextInput.d.ts +33 -36
  7. package/dist/src/components/FilterInline/AccessibiliteItems.d.ts +30 -0
  8. package/dist/src/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +4 -0
  9. package/dist/src/components/FilterSideBar/AccessibiliteItems.d.ts +29 -0
  10. package/dist/src/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +4 -0
  11. package/dist/src/components/NirField/NirField.d.ts +14 -2
  12. package/dist/src/components/NotificationBar/NotificationBar.d.ts +5 -5
  13. package/dist/src/components/PasswordField/PasswordField.d.ts +2 -0
  14. package/dist/src/components/PeriodField/PeriodField.d.ts +159 -157
  15. package/dist/src/components/PhoneField/PhoneField.d.ts +22 -1
  16. package/dist/src/components/UploadWorkflow/AccessibiliteItems.d.ts +29 -0
  17. package/dist/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +4 -0
  18. package/dist/src/components/Usages/Usages.d.ts +10 -0
  19. package/dist/src/components/index.d.ts +3 -0
  20. package/dist/src/composables/date/tests/useDatePickerAccessibility.spec.d.ts +1 -0
  21. package/dist/src/composables/date/useDateFormat.d.ts +26 -0
  22. package/dist/src/composables/date/useDateInitialization.d.ts +18 -0
  23. package/dist/src/composables/date/useDatePickerAccessibility.d.ts +8 -0
  24. package/dist/src/composables/useFilterable/useFilterable.d.ts +1 -1
  25. package/dist/src/composables/validation/useValidation.d.ts +1 -0
  26. package/dist/src/main.d.ts +1 -0
  27. package/dist/src/utils/formatDate/index.d.ts +3 -0
  28. package/dist/src/utils/formatDate/tests/formatDate.spec.d.ts +1 -0
  29. package/dist/src/utils/functions/validation/isDateAfter/index.d.ts +2 -0
  30. package/dist/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.d.ts +1 -0
  31. package/dist/src/utils/functions/validation/isDateBefore/index.d.ts +2 -0
  32. package/dist/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.d.ts +1 -0
  33. package/dist/src/utils/functions/validation/isDateInRange/index.d.ts +3 -0
  34. package/dist/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.d.ts +1 -0
  35. package/dist/src/utils/functions/validation/isDateValid/index.d.ts +9 -0
  36. package/dist/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.d.ts +1 -0
  37. package/dist/src/utils/functions/validation/isEmailValid/tests/isEmailValid.spec.d.ts +1 -0
  38. package/dist/src/utils/functions/validation/isWeekend/index.d.ts +3 -0
  39. package/dist/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.d.ts +1 -0
  40. package/dist/src/utils/parseDate/index.d.ts +3 -0
  41. package/dist/src/utils/parseDate/tests/parseDate.spec.d.ts +1 -0
  42. package/dist/src/utils/rules/doMatchPattern/index.d.ts +3 -0
  43. package/dist/src/utils/rules/doMatchPattern/tests/matchPattern.spec.d.ts +1 -0
  44. package/dist/src/utils/rules/index.d.ts +11 -0
  45. package/dist/src/utils/rules/isDateValid/index.d.ts +4 -0
  46. package/dist/src/utils/rules/isDateValid/tests/isDateValid.spec.d.ts +1 -0
  47. package/dist/src/utils/rules/isExactLength/index.d.ts +3 -0
  48. package/dist/src/utils/rules/isExactLength/locales.d.ts +2 -0
  49. package/dist/src/utils/rules/isExactLength/tests/exactLength.spec.d.ts +1 -0
  50. package/dist/src/utils/rules/isMaxLength/index.d.ts +3 -0
  51. package/dist/src/utils/rules/isMaxLength/locales.d.ts +2 -0
  52. package/dist/src/utils/rules/isMaxLength/tests/isMaxLength.spec.d.ts +1 -0
  53. package/dist/src/utils/rules/isMinLength/index.d.ts +3 -0
  54. package/dist/src/utils/rules/isMinLength/locales.d.ts +2 -0
  55. package/dist/src/utils/rules/isMinLength/tests/isMinLength.spec.d.ts +1 -0
  56. package/dist/src/utils/rules/isNotAfterDate/index.d.ts +3 -0
  57. package/dist/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.d.ts +1 -0
  58. package/dist/src/utils/rules/isNotAfterToday/index.d.ts +4 -0
  59. package/dist/src/utils/rules/isNotAfterToday/locales.d.ts +2 -0
  60. package/dist/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.d.ts +1 -0
  61. package/dist/src/utils/rules/isNotBeforeDate/index.d.ts +3 -0
  62. package/dist/src/utils/rules/isNotBeforeDate/locales.d.ts +2 -0
  63. package/dist/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.d.ts +1 -0
  64. package/dist/src/utils/rules/isNotBeforeToday/index.d.ts +4 -0
  65. package/dist/src/utils/rules/isNotBeforeToday/locales.d.ts +2 -0
  66. package/dist/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.d.ts +1 -0
  67. package/dist/src/utils/rules/isRequired/index.d.ts +4 -0
  68. package/dist/src/utils/rules/isRequired/locales.d.ts +2 -0
  69. package/dist/src/utils/rules/isRequired/tests/isRequred.spec.d.ts +1 -0
  70. package/dist/src/utils/rules/isValidEmail/index.d.ts +4 -0
  71. package/dist/src/utils/rules/isValidEmail/locales.d.ts +2 -0
  72. package/dist/src/utils/rules/isValidEmail/tests/isValidEmail.spec.d.ts +1 -0
  73. package/dist/style.css +1 -1
  74. package/package.json +3 -1
  75. package/src/assets/_radius.scss +12 -6
  76. package/src/assets/settings.scss +8 -0
  77. package/src/components/Amelipro/types/types.ts +40 -0
  78. package/src/components/ChipList/ChipList.stories.ts +26 -27
  79. package/src/components/ChipList/ChipList.vue +5 -1
  80. package/src/components/ChipList/config.ts +1 -0
  81. package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -2
  82. package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +1 -1
  83. package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +1 -1
  84. package/src/components/Customs/SySelect/SySelect.mdx +1 -1
  85. package/src/components/Customs/SySelect/SySelect.vue +19 -4
  86. package/src/components/Customs/SyTextField/SyTextField.mdx +2 -2
  87. package/src/components/Customs/SyTextField/SyTextField.stories.ts +239 -0
  88. package/src/components/Customs/SyTextField/SyTextField.vue +3 -0
  89. package/src/components/DatePicker/DatePicker.stories.ts +177 -5
  90. package/src/components/DatePicker/DatePicker.vue +148 -347
  91. package/src/components/DatePicker/DateTextInput.vue +91 -251
  92. package/src/components/DatePicker/tests/DatePicker.spec.ts +118 -48
  93. package/src/components/DatePicker/tests/DateTextInput.spec.ts +202 -6
  94. package/src/components/FileList/Accessibilite.stories.ts +1 -1
  95. package/src/components/FileList/AccessibiliteItems.ts +22 -0
  96. package/src/components/FileUpload/FileUpload.stories.ts +9 -7
  97. package/src/components/FilterInline/Accessibilite.mdx +14 -0
  98. package/src/components/FilterInline/Accessibilite.stories.ts +216 -0
  99. package/src/components/FilterInline/AccessibiliteItems.ts +132 -0
  100. package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +4 -0
  101. package/src/components/FilterSideBar/Accessibilite.mdx +14 -0
  102. package/src/components/FilterSideBar/Accessibilite.stories.ts +216 -0
  103. package/src/components/FilterSideBar/AccessibiliteItems.ts +153 -0
  104. package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +4 -0
  105. package/src/components/NirField/NirField.stories.ts +165 -0
  106. package/src/components/NirField/NirField.vue +6 -2
  107. package/src/components/NirField/tests/config.spec.ts +65 -0
  108. package/src/components/NotificationBar/NotificationBar.mdx +2 -2
  109. package/src/components/NotificationBar/NotificationBar.stories.ts +59 -11
  110. package/src/components/NotificationBar/NotificationBar.vue +42 -114
  111. package/src/components/NotificationBar/tests/NotificationBar.spec.ts +28 -33
  112. package/src/components/NotificationBar/tests/__snapshots__/NotificationBar.spec.ts.snap +1 -1
  113. package/src/components/PaginatedTable/PaginatedTable.vue +6 -10
  114. package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +4 -4
  115. package/src/components/PasswordField/PasswordField.stories.ts +191 -4
  116. package/src/components/PasswordField/PasswordField.vue +3 -0
  117. package/src/components/PeriodField/PeriodField.stories.ts +214 -118
  118. package/src/components/PeriodField/PeriodField.vue +195 -148
  119. package/src/components/PeriodField/tests/PeriodField.spec.ts +146 -0
  120. package/src/components/PhoneField/PhoneField.stories.ts +101 -0
  121. package/src/components/PhoneField/PhoneField.vue +73 -17
  122. package/src/components/PhoneField/tests/PhoneField.spec.ts +40 -0
  123. package/src/components/RatingPicker/RatingPicker.stories.ts +7 -7
  124. package/src/components/SearchListField/SearchListField.stories.ts +1 -1
  125. package/src/components/UploadWorkflow/Accessibilite.mdx +14 -0
  126. package/src/components/UploadWorkflow/Accessibilite.stories.ts +216 -0
  127. package/src/components/UploadWorkflow/AccessibiliteItems.ts +192 -0
  128. package/src/components/UploadWorkflow/UploadWorkflow.vue +2 -2
  129. package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +4 -0
  130. package/src/components/Usages/tests/Usages.spec.ts +183 -0
  131. package/src/components/index.ts +3 -0
  132. package/src/composables/date/tests/useDateFormat.spec.ts +67 -0
  133. package/src/composables/date/tests/useDateInitialization.spec.ts +89 -0
  134. package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +102 -0
  135. package/src/composables/date/useDateFormat.ts +94 -0
  136. package/src/composables/date/useDateInitialization.ts +92 -0
  137. package/src/composables/date/useDatePickerAccessibility.ts +78 -0
  138. package/src/composables/rules/tests/useFieldValidation.spec.ts +385 -4
  139. package/src/composables/useFilterable/useFilterable.ts +5 -4
  140. package/src/composables/validation/useValidation.ts +15 -0
  141. package/src/main.ts +1 -0
  142. package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +28 -0
  143. package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +2 -2
  144. package/src/stories/Accessibilite/Audit/RGAA.mdx +6 -6
  145. package/src/stories/Accessibilite/Introduction.mdx +2 -1
  146. package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +1 -1
  147. package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +1 -1
  148. package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +8 -11
  149. package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +77 -0
  150. package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +9 -3
  151. package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +2 -2
  152. package/src/stories/Demarrer/Introduction.stories.ts +3 -3
  153. package/src/stories/Demarrer/Releases.mdx +8 -0
  154. package/src/stories/Demarrer/Releases.stories.ts +66 -0
  155. package/src/stories/DesignTokens/Conteneurs.stories.ts +3 -3
  156. package/src/stories/GuideDuDev/LesBreackingChanges.mdx +36 -0
  157. package/src/stories/GuideDuDev/UtiliserLesRules.mdx +2 -2
  158. package/src/utils/formatDate/index.ts +6 -0
  159. package/src/utils/formatDate/tests/formatDate.spec.ts +18 -0
  160. package/src/utils/functions/validation/isDateAfter/index.ts +9 -0
  161. package/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.ts +18 -0
  162. package/src/utils/functions/validation/isDateBefore/index.ts +9 -0
  163. package/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.ts +23 -0
  164. package/src/utils/functions/validation/isDateInRange/index.ts +22 -0
  165. package/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.ts +28 -0
  166. package/src/utils/functions/validation/isDateValid/index.ts +67 -0
  167. package/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.ts +46 -0
  168. package/src/utils/functions/validation/isEmailValid/index.ts +9 -0
  169. package/src/utils/functions/validation/isWeekend/index.ts +10 -0
  170. package/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.ts +16 -0
  171. package/src/utils/parseDate/index.ts +29 -0
  172. package/src/utils/parseDate/tests/parseDate.spec.ts +52 -0
  173. package/src/utils/rules/Rules.mdx +16 -0
  174. package/src/utils/rules/doMatchPattern/DoMachPattern.mdx +66 -0
  175. package/src/utils/rules/doMatchPattern/DoMatchPattern.stories.ts +106 -0
  176. package/src/utils/rules/doMatchPattern/index.ts +28 -0
  177. package/src/utils/rules/doMatchPattern/locales.ts +5 -0
  178. package/src/utils/rules/doMatchPattern/tests/matchPattern.spec.ts +38 -0
  179. package/src/utils/rules/index.ts +11 -0
  180. package/src/utils/rules/isDateValid/IsDateValid.mdx +87 -0
  181. package/src/utils/rules/isDateValid/IsDateValid.stories.ts +113 -0
  182. package/src/utils/rules/isDateValid/index.ts +32 -0
  183. package/src/utils/rules/isDateValid/locales.ts +10 -0
  184. package/src/utils/rules/isDateValid/tests/isDateValid.spec.ts +27 -0
  185. package/src/utils/rules/isExactLength/IsExactLenght.mdx +68 -0
  186. package/src/utils/rules/isExactLength/IsExactLength.stories.ts +151 -0
  187. package/src/utils/rules/{exactLength → isExactLength}/index.ts +2 -4
  188. package/src/utils/rules/isExactLength/tests/exactLength.spec.ts +48 -0
  189. package/src/utils/rules/isMaxLength/IsMaxLength.mdx +68 -0
  190. package/src/utils/rules/isMaxLength/IsMaxLength.stories.ts +152 -0
  191. package/src/utils/rules/isMaxLength/index.ts +30 -0
  192. package/src/utils/rules/isMaxLength/locales.ts +6 -0
  193. package/src/utils/rules/isMaxLength/tests/isMaxLength.spec.ts +42 -0
  194. package/src/utils/rules/isMinLength/IsMinLength.mdx +68 -0
  195. package/src/utils/rules/isMinLength/IsMinLength.stories.ts +152 -0
  196. package/src/utils/rules/isMinLength/index.ts +30 -0
  197. package/src/utils/rules/isMinLength/locales.ts +6 -0
  198. package/src/utils/rules/isMinLength/tests/isMinLength.spec.ts +42 -0
  199. package/src/utils/rules/isNotAfterDate/IsNotAfterDate.mdx +68 -0
  200. package/src/utils/rules/isNotAfterDate/IsNotAfterDate.stories.ts +109 -0
  201. package/src/utils/rules/isNotAfterDate/index.ts +25 -0
  202. package/src/utils/rules/isNotAfterDate/locales.ts +6 -0
  203. package/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.ts +25 -0
  204. package/src/utils/rules/isNotAfterToday/IsNotAfterToday.mdx +83 -0
  205. package/src/utils/rules/isNotAfterToday/IsNotAfterToday.stories.ts +110 -0
  206. package/src/utils/rules/isNotAfterToday/index.ts +28 -0
  207. package/src/utils/rules/isNotAfterToday/locales.ts +5 -0
  208. package/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.ts +30 -0
  209. package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.mdx +68 -0
  210. package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.stories.ts +114 -0
  211. package/src/utils/rules/isNotBeforeDate/index.ts +25 -0
  212. package/src/utils/rules/isNotBeforeDate/locales.ts +6 -0
  213. package/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.ts +25 -0
  214. package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.mdx +83 -0
  215. package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.stories.ts +110 -0
  216. package/src/utils/rules/isNotBeforeToday/index.ts +28 -0
  217. package/src/utils/rules/isNotBeforeToday/locales.ts +5 -0
  218. package/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.ts +36 -0
  219. package/src/utils/rules/isRequired/IsRequired.mdx +81 -0
  220. package/src/utils/rules/isRequired/IsRequired.stories.ts +101 -0
  221. package/src/utils/rules/{required → isRequired}/index.ts +3 -3
  222. package/src/utils/rules/{required/tests/index.spec.ts → isRequired/tests/isRequred.spec.ts} +9 -9
  223. package/src/utils/rules/isValidEmail/IsValidEmail.mdx +81 -0
  224. package/src/utils/rules/isValidEmail/IsValidEmail.stories.ts +101 -0
  225. package/src/utils/rules/{email → isValidEmail}/index.ts +3 -5
  226. package/src/utils/rules/{email/tests/email.spec.ts → isValidEmail/tests/isValidEmail.spec.ts} +5 -5
  227. package/dist/src/components/Amelipro/types/languages.d.ts +0 -6
  228. package/dist/src/utils/rules/email/index.d.ts +0 -4
  229. package/dist/src/utils/rules/exactLength/index.d.ts +0 -4
  230. package/dist/src/utils/rules/required/index.d.ts +0 -4
  231. package/dist/src/utils/rules/required/ruleMessageHelper.d.ts +0 -3
  232. package/src/components/Amelipro/types/languages.d.ts +0 -6
  233. package/src/components/Amelipro/types/types.d.ts +0 -65
  234. package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +0 -58
  235. package/src/utils/functions/isEmailValid/index.ts +0 -8
  236. package/src/utils/rules/required/ruleMessageHelper.ts +0 -14
  237. package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +0 -22
  238. /package/dist/src/{utils/functions/isEmailValid/tests/isEmailValid.spec.d.ts → components/NirField/tests/config.spec.d.ts} +0 -0
  239. /package/dist/src/{utils/rules/email/tests/email.spec.d.ts → components/Usages/tests/Usages.spec.d.ts} +0 -0
  240. /package/dist/src/{utils/rules/required/tests/index.spec.d.ts → composables/date/tests/useDateFormat.spec.d.ts} +0 -0
  241. /package/dist/src/{utils/rules/required/tests/rulesMessageHelper.spec.d.ts → composables/date/tests/useDateInitialization.spec.d.ts} +0 -0
  242. /package/dist/src/utils/functions/{isEmailValid → validation/isEmailValid}/index.d.ts +0 -0
  243. /package/dist/src/utils/rules/{exactLength → doMatchPattern}/locales.d.ts +0 -0
  244. /package/dist/src/utils/rules/{email → isDateValid}/locales.d.ts +0 -0
  245. /package/dist/src/utils/rules/{required → isNotAfterDate}/locales.d.ts +0 -0
  246. /package/src/components/NirField/{tests → examples}//342/200/257dataset/342/200/257.md" +0 -0
  247. /package/src/utils/functions/{isEmailValid → validation/isEmailValid}/tests/isEmailValid.spec.ts +0 -0
  248. /package/src/utils/rules/{exactLength → isExactLength}/locales.ts +0 -0
  249. /package/src/utils/rules/{required → isRequired}/locales.ts +0 -0
  250. /package/src/utils/rules/{email → isValidEmail}/locales.ts +0 -0
@@ -28,8 +28,6 @@
28
28
  const currentNotification = ref<Notification>()
29
29
  const isNotificationVisible = ref(false)
30
30
 
31
- const isProcessingNotifications = ref(false) // Nouvelle variable pour suivre le traitement
32
-
33
31
  const hasActionSlot = computed(() => !!instance?.slots.action)
34
32
  const isMobileVersion = computed(() => display.name.value === 'xs')
35
33
  const isTabletVersion = computed(() => display.name.value === 'sm')
@@ -73,91 +71,47 @@
73
71
 
74
72
  const smallCloseBtn = computed(() => isMobileVersion.value && !hasLongContent.value && !hasActionSlot.value)
75
73
 
76
- const setNotification = (notification: Notification) => {
77
- currentNotification.value = { ...notification }
78
- }
79
-
80
- const processNotificationQueue = async () => {
81
- isProcessingNotifications.value = true
74
+ watch(() => notificationQueue.value.length, async (queueLength) => {
75
+ if (queueLength > 0 && currentNotification.value === undefined) {
76
+ openNotification(notificationQueue.value[0])
77
+ }
78
+ }, { immediate: true })
82
79
 
83
- while (notificationQueue.value.length > 0) {
84
- const nextNotification = notificationQueue.value[0]
85
- setNotification(nextNotification)
86
- isNotificationVisible.value = true
80
+ let timeoutID: ReturnType<typeof setTimeout>
81
+ function openNotification(notification: Notification) {
82
+ currentNotification.value = notification
83
+ isNotificationVisible.value = true
87
84
 
88
- let timeout = nextNotification.timeout ?? -1
85
+ if ((notification.timeout || 0) > 0) {
86
+ timeoutID = setTimeout(() => {
87
+ isNotificationVisible.value = false
88
+ }, notification.timeout)
89
+ }
90
+ }
89
91
 
90
- if (timeout <= 0) {
91
- // Attend que la notification soit fermée manuellement car pas de timeout
92
- await new Promise<void>((resolve) => {
93
- const stopWatch = watch(isNotificationVisible, (visible) => {
94
- if (!visible) {
95
- stopWatch()
96
- resolve()
97
- }
98
- })
99
- })
92
+ watch(isNotificationVisible, async (isVisible) => {
93
+ if (!isVisible) {
94
+ // wait for the snackbar close animation to finish
95
+ await new Promise(resolve => setTimeout(resolve, 100))
96
+ if (currentNotification.value) {
97
+ removeNotification(currentNotification.value.id)
100
98
  }
101
- else {
102
- // Attend la fin du délai du timeout avant de fermer la notification automatiquement
103
- await new Promise<void>((resolve) => {
104
- const timeoutId = setTimeout(() => {
105
- handleClearNotification()
106
- resolve()
107
- }, timeout)
99
+ currentNotification.value = undefined
108
100
 
109
- const stopWatch = watch(isNotificationVisible, (visible) => {
110
- if (!visible) {
111
- clearTimeout(timeoutId)
112
- stopWatch()
113
- resolve()
114
- }
115
- })
116
- })
101
+ if (notificationQueue.value.length > 0) {
102
+ openNotification(notificationQueue.value[0])
117
103
  }
118
-
119
- // Retire la notification de la file
120
- removeNotification(nextNotification.id)
121
104
  }
105
+ })
122
106
 
123
- isProcessingNotifications.value = false
124
- }
125
-
126
- const handleClearNotification = () => {
107
+ function showNextNotification() {
108
+ clearTimeout(timeoutID)
127
109
  isNotificationVisible.value = false
128
- if (currentNotification.value) {
129
- removeNotification(currentNotification.value.id)
130
- currentNotification.value = undefined
131
- }
132
- }
133
-
134
- const openNotification = (notification: Notification) => {
135
- setNotification(notification)
136
- isNotificationVisible.value = true
137
- }
138
-
139
- const showNextNotification = () => {
140
- if (notificationQueue.value.length > 0) {
141
- const nextNotification = notificationQueue.value[0]
142
- setNotification(nextNotification)
143
- isNotificationVisible.value = true
144
- }
145
110
  }
146
111
 
147
- watch(
148
- () => notificationQueue.value.length,
149
- (newLength) => {
150
- if (newLength > 0 && !isProcessingNotifications.value) {
151
- processNotificationQueue()
152
- }
153
- },
154
- )
155
-
156
112
  defineExpose({
157
113
  openNotification,
158
- handleClearNotification,
159
114
  showNextNotification,
160
- processNotificationQueue,
161
115
  currentNotification,
162
116
  isNotificationVisible,
163
117
  hasActionSlot,
@@ -173,11 +127,12 @@
173
127
  </script>
174
128
 
175
129
  <template>
176
- <div v-if="currentNotification">
130
+ <div>
177
131
  <VSnackbar
178
132
  v-bind="options.snackbar"
179
133
  v-model="isNotificationVisible"
180
134
  role="status"
135
+ :eager="true"
181
136
  :color="color"
182
137
  :location="props.bottom ? 'bottom' : 'top'"
183
138
  :vertical="hasLongContent"
@@ -195,7 +150,10 @@
195
150
  size="24"
196
151
  aria-hidden="true"
197
152
  />
198
- <p :class="'text-' + contentStyle.contentColor">
153
+ <p
154
+ class="sy-notification-content"
155
+ :class="'text-' + contentStyle.contentColor"
156
+ >
199
157
  {{ currentNotification?.message }}
200
158
  </p>
201
159
  </div>
@@ -212,7 +170,7 @@
212
170
  :class="{ 'ma-0': smallCloseBtn }"
213
171
  aria-label="Fermer la notification"
214
172
  v-bind="options.btn"
215
- @click="handleClearNotification"
173
+ @click="isNotificationVisible = false"
216
174
  >
217
175
  <template v-if="!smallCloseBtn">
218
176
  {{ closeBtnText }}
@@ -230,18 +188,12 @@
230
188
  <style lang="scss" scoped>
231
189
  @use '@/assets/tokens';
232
190
 
233
- .vd-notification-content {
234
- display: flex;
235
- align-items: center;
236
- }
237
-
238
- .vd-notification-bar :deep(.v-snack__wrapper) {
239
- padding: 16px;
240
- min-width: 0;
241
- max-width: none;
191
+ :deep(.v-overlay__content) {
192
+ max-width: 100%;
242
193
  }
243
194
 
244
195
  :deep(.v-snackbar__content) {
196
+ width: 100%;
245
197
  padding: tokens.$padding-4 !important;
246
198
  }
247
199
 
@@ -249,35 +201,6 @@
249
201
  margin-inline-end: 10px;
250
202
  }
251
203
 
252
- .vd-notification-bar.v-snackbar--vertical :deep() {
253
- .v-snackbar--vertical .v-snackbar__wrapper .v-snackbar__actions {
254
- width: 100% !important;
255
- align-self: auto;
256
- }
257
-
258
- .v-snack__wrapper {
259
- align-items: stretch;
260
- flex-direction: row;
261
- }
262
-
263
- .v-snack__action {
264
- align-self: stretch;
265
- align-items: stretch;
266
- flex-direction: column;
267
- }
268
-
269
- .v-snackbar__content {
270
- margin: 0;
271
- width: 100%;
272
- display: flex;
273
- }
274
-
275
- .vd-notification-content {
276
- flex-direction: column;
277
- display: flex;
278
- }
279
- }
280
-
281
204
  .long-text :deep(.v-snackbar__actions) {
282
205
  width: 98% !important;
283
206
  }
@@ -293,4 +216,9 @@
293
216
  .action-section-short-text {
294
217
  justify-content: end !important;
295
218
  }
219
+
220
+ .sy-notification-content {
221
+ min-width: 0;
222
+ word-wrap: break-word;
223
+ }
296
224
  </style>
@@ -1,4 +1,4 @@
1
- import { describe, it, expect, beforeEach } from 'vitest'
1
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
2
2
  import { vi } from 'vitest'
3
3
  import { mount, shallowMount } from '@vue/test-utils'
4
4
  import NotificationBar from '../NotificationBar.vue'
@@ -6,6 +6,7 @@ import { type Notification } from '@/components/NotificationBar/types'
6
6
  import { useNotificationService } from '@/services/NotificationService'
7
7
  import { nextTick, type Ref, ref } from 'vue'
8
8
  import { vuetify } from '@tests/unit/setup'
9
+ import { VDefaultsProvider } from 'vuetify/components'
9
10
 
10
11
  vi.mock('@/services/NotificationService')
11
12
  describe('NotificationBar.vue', () => {
@@ -17,6 +18,7 @@ describe('NotificationBar.vue', () => {
17
18
 
18
19
  let notificationServiceMock: NotificationServiceMock
19
20
  beforeEach(() => {
21
+ vi.useFakeTimers()
20
22
  notificationServiceMock = {
21
23
  notificationQueue: ref([]),
22
24
  addNotification: vi.fn(),
@@ -26,6 +28,11 @@ describe('NotificationBar.vue', () => {
26
28
  (useNotificationService as vi.Mock).mockReturnValue(notificationServiceMock)
27
29
  })
28
30
 
31
+ afterEach(() => {
32
+ vi.restoreAllMocks()
33
+ vi.useRealTimers()
34
+ })
35
+
29
36
  it('should render notification bar', async () => {
30
37
  const notification: Notification = {
31
38
  id: '1',
@@ -67,29 +74,11 @@ describe('NotificationBar.vue', () => {
67
74
  expect(wrapper.vm.color).toBe('#56C271')
68
75
  })
69
76
 
70
- it('should close notification when handleClearNotification is called', async () => {
71
- const notification: Notification = {
72
- id: '1',
73
- message: 'Test message',
74
- type: 'info',
75
- timeout: -1,
76
- icon: null,
77
- }
78
- const wrapper = mount(NotificationBar, {
79
- props: { notification },
80
- global: {
81
- plugins: [vuetify],
82
- },
77
+ it('should show the next notification in the queue', async () => {
78
+ notificationServiceMock.removeNotification = vi.fn(() => {
79
+ notificationServiceMock.notificationQueue.value.shift()
83
80
  })
84
- wrapper.vm.openNotification(notification)
85
- wrapper.vm.handleClearNotification()
86
81
 
87
- await nextTick()
88
- expect(wrapper.vm.isNotificationVisible).toBe(false)
89
- expect(notificationServiceMock.removeNotification).toHaveBeenCalledWith(notification.id)
90
- })
91
-
92
- it('should show the next notification in the queue', async () => {
93
82
  const notification1: Notification = {
94
83
  id: '1',
95
84
  message: 'Test message 1',
@@ -97,26 +86,28 @@ describe('NotificationBar.vue', () => {
97
86
  timeout: -1,
98
87
  icon: null,
99
88
  }
100
- const notification2: Notification = {
89
+ const notification2 = {
101
90
  id: '2',
102
91
  message: 'Test message 2',
103
92
  type: 'success',
104
93
  timeout: -1,
105
94
  icon: null,
106
- }
95
+ } as const satisfies Notification
107
96
  notificationServiceMock.notificationQueue.value = [notification1, notification2]
108
97
 
109
98
  const wrapper = mount(NotificationBar, {
110
- props: { notification: notification1 },
111
99
  global: {
112
100
  plugins: [vuetify],
113
101
  },
114
102
  })
115
103
 
116
104
  wrapper.vm.showNextNotification()
117
-
118
105
  await nextTick()
119
- expect(wrapper.vm.currentNotification).toEqual(notification1)
106
+ vi.runAllTimers()
107
+ await nextTick()
108
+
109
+ expect(notificationServiceMock.removeNotification).toHaveBeenCalledWith(notification1.id)
110
+ expect(wrapper.vm.currentNotification).toEqual(notification2)
120
111
  expect(wrapper.vm.isNotificationVisible).toBe(true)
121
112
  })
122
113
 
@@ -315,8 +306,14 @@ describe('NotificationBar.vue', () => {
315
306
  expect(removeNotification).toHaveBeenCalledWith(1)
316
307
  })
317
308
 
318
- it('should handle empty notification queue correctly', async () => {
319
- notificationServiceMock.notificationQueue.value = []
309
+ it('should show the item in queue', async () => {
310
+ notificationServiceMock.notificationQueue.value = [{
311
+ id: '1',
312
+ message: 'Test message',
313
+ type: 'info',
314
+ timeout: -1,
315
+ icon: null,
316
+ }]
320
317
 
321
318
  const wrapper = mount(NotificationBar, {
322
319
  global: {
@@ -324,9 +321,7 @@ describe('NotificationBar.vue', () => {
324
321
  },
325
322
  })
326
323
 
327
- await wrapper.vm.processNotificationQueue()
328
-
329
- expect(wrapper.vm.isNotificationVisible).toBe(false)
330
- expect(notificationServiceMock.removeNotification).not.toHaveBeenCalled()
324
+ const provider = wrapper.findComponent(VDefaultsProvider)
325
+ expect(provider.element.parentElement.textContent).toContain('Test message')
331
326
  })
332
327
  })
@@ -2,6 +2,6 @@
2
2
 
3
3
  exports[`NotificationBar.vue > should render notification bar 1`] = `
4
4
  "<div data-v-867cdd3c="" notification="[object Object]">
5
- <v-snackbar-stub data-v-867cdd3c="" color="info" width="960px" class="" multiline="false" timer="false" timeout="-1" vertical="false" location="top" rounded="4" tile="false" variant="elevated" absolute="false" attach="false" closeonback="true" contained="false" disabled="false" modelvalue="true" zindex="2000" activatorprops="[object Object]" openonhover="false" closeoncontentclick="false" eager="false" locationstrategy="static" origin="auto" transition="v-snackbar-transition" role="status"></v-snackbar-stub>
5
+ <v-snackbar-stub data-v-867cdd3c="" color="info" width="960px" class="" multiline="false" timer="false" timeout="-1" vertical="false" location="top" rounded="4" tile="false" variant="elevated" absolute="false" attach="false" closeonback="true" contained="false" disabled="false" modelvalue="true" zindex="2000" activatorprops="[object Object]" openonhover="false" closeoncontentclick="false" eager="true" locationstrategy="static" origin="auto" transition="v-snackbar-transition" role="status"></v-snackbar-stub>
6
6
  </div>"
7
7
  `;
@@ -134,7 +134,10 @@
134
134
  </script>
135
135
 
136
136
  <template>
137
- <div id="paginated-table">
137
+ <div
138
+ id="paginated-table"
139
+ class="sy-paginated-table"
140
+ >
138
141
  <VDataTable
139
142
  v-if="!serverItemsLength"
140
143
  color="primary"
@@ -170,11 +173,10 @@
170
173
  </div>
171
174
  </template>
172
175
 
173
- <style lang="scss">
176
+ <style lang="scss" scoped>
174
177
  @use '@/assets/tokens';
175
178
 
176
- .vd-data-table,
177
- .v-data-table {
179
+ .sy-paginated-table :deep() {
178
180
  table thead tr {
179
181
  white-space: nowrap;
180
182
  }
@@ -187,12 +189,6 @@
187
189
  }
188
190
  }
189
191
 
190
- table :not(thead) tr {
191
- &:hover {
192
- background-color: rgb(12 65 154 / 10%);
193
- }
194
- }
195
-
196
192
  &.row-clickable table tbody tr {
197
193
  cursor: pointer;
198
194
  }
@@ -1,8 +1,8 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`PaginatedTable > render correctly in server mode 1`] = `
4
- "<div id="paginated-table">
5
- <div class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
4
+ "<div data-v-50a8727d="" id="paginated-table" class="sy-paginated-table">
5
+ <div data-v-50a8727d="" class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
6
6
  <!---->
7
7
  <div class="v-table__wrapper">
8
8
  <table>
@@ -109,8 +109,8 @@ exports[`PaginatedTable > render correctly in server mode 1`] = `
109
109
  `;
110
110
 
111
111
  exports[`PaginatedTable > renders correctly in local mode 1`] = `
112
- "<div id="paginated-table" items="[object Object],[object Object],[object Object]" headers="[object Object],[object Object],[object Object]">
113
- <div class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
112
+ "<div data-v-50a8727d="" id="paginated-table" class="sy-paginated-table" items="[object Object],[object Object],[object Object]" headers="[object Object],[object Object],[object Object]">
113
+ <div data-v-50a8727d="" class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
114
114
  <!---->
115
115
  <div class="v-table__wrapper">
116
116
  <table>
@@ -751,7 +751,7 @@ export const WithCustomRules: Story = {
751
751
  {
752
752
  type: 'custom',
753
753
  options: {
754
- validate: (value: string) => {
754
+ validate: (value) => {
755
755
  if (!value || !/[A-Z]/.test(value)) {
756
756
  return 'Le mot de passe doit contenir au moins une lettre majuscule'
757
757
  }
@@ -763,7 +763,7 @@ export const WithCustomRules: Story = {
763
763
  {
764
764
  type: 'custom',
765
765
  options: {
766
- validate: (value: string) => {
766
+ validate: (value) => {
767
767
  if (!value || !/[0-9]/.test(value)) {
768
768
  return 'Le mot de passe doit contenir au moins un chiffre'
769
769
  }
@@ -893,7 +893,7 @@ export const WithFormValidation: Story = {
893
893
  {
894
894
  type: 'custom',
895
895
  options: {
896
- validate: (value: string) => {
896
+ validate: (value) => {
897
897
  if (!value || value.length < 8) {
898
898
  return 'Le mot de passe doit contenir au moins 8 caractères'
899
899
  }
@@ -905,7 +905,7 @@ export const WithFormValidation: Story = {
905
905
  {
906
906
  type: 'custom',
907
907
  options: {
908
- validate: (value: string) => {
908
+ validate: (value) => {
909
909
  if (!value || !/[A-Z]/.test(value)) {
910
910
  return 'Le mot de passe doit contenir au moins une lettre majuscule'
911
911
  }
@@ -1015,3 +1015,190 @@ export const WithFormValidation: Story = {
1015
1015
  `,
1016
1016
  }),
1017
1017
  }
1018
+
1019
+ export const WithoutSuccessMessages: Story = {
1020
+ parameters: {
1021
+ docs: {
1022
+ description: {
1023
+ story: `
1024
+ ### Messages de succès
1025
+
1026
+ Cette story illustre l'utilisation de la propriété \`showSuccessMessages\` qui permet de contrôler
1027
+ l'affichage des messages de succès lors de la validation. Par défaut, cette propriété est à \`true\`.
1028
+
1029
+ Cela peut être utile pour réduire la verbosité de l'interface lorsque les messages de succès
1030
+ ne sont pas nécessaires dans certains contextes.
1031
+ `,
1032
+ },
1033
+ },
1034
+ sourceCode: [
1035
+ {
1036
+ name: 'Template',
1037
+ code: `<template>
1038
+ <!-- Champ avec messages de succès (par défaut) -->
1039
+ <PasswordField
1040
+ v-model="value1"
1041
+ label="Mot de passe avec messages de succès"
1042
+ required
1043
+ />
1044
+
1045
+ <!-- Champ sans messages de succès -->
1046
+ <PasswordField
1047
+ v-model="value2"
1048
+ label="Mot de passe sans messages de succès"
1049
+ required
1050
+ :showSuccessMessages="false"
1051
+ />
1052
+ </template>`,
1053
+ },
1054
+ ],
1055
+ },
1056
+ render: () => ({
1057
+ components: { PasswordField },
1058
+ setup() {
1059
+ const value1 = ref('P@ssw0rd123')
1060
+ const value2 = ref('P@ssw0rd123')
1061
+
1062
+ return { value1, value2 }
1063
+ },
1064
+ template: `
1065
+ <div>
1066
+ <p class="mb-4">Cette démonstration compare un PasswordField avec <code>showSuccessMessages=true</code> (par défaut) et un avec <code>showSuccessMessages=false</code>.</p>
1067
+
1068
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 16px;">
1069
+ <div>
1070
+ <p class="text-subtitle-2 mb-2">Avec messages de succès</p>
1071
+ <PasswordField
1072
+ v-model="value1"
1073
+ label="Mot de passe avec messages de succès"
1074
+ required
1075
+ showSuccessMessages
1076
+ />
1077
+ </div>
1078
+
1079
+ <div>
1080
+ <p class="text-subtitle-2 mb-2">Sans messages de succès</p>
1081
+ <PasswordField
1082
+ v-model="value2"
1083
+ label="Mot de passe sans messages de succès"
1084
+ required
1085
+ :showSuccessMessages="false"
1086
+ />
1087
+ </div>
1088
+ </div>
1089
+
1090
+ <div class="mt-4 text-body-2">
1091
+ <p>Observations :</p>
1092
+ <ul>
1093
+ <li class="ml-4">Les deux champs ont la même valeur valide</li>
1094
+ <li class="ml-4">Le champ de gauche affiche un message de succès et un indicateur visuel vert</li>
1095
+ <li class="ml-4">Le champ de droite n'affiche pas de message de succès, mais conserve l'indicateur visuel</li>
1096
+ <li class="ml-4">Essayez de modifier les valeurs puis de les rendre à nouveau valides</li>
1097
+ </ul>
1098
+ </div>
1099
+ </div>
1100
+ `,
1101
+ }),
1102
+ }
1103
+
1104
+ export const DisableErrorHandling: Story = {
1105
+ parameters: {
1106
+ docs: {
1107
+ description: {
1108
+ story: `
1109
+ ### Désactivation de la gestion des erreurs
1110
+
1111
+ Cette story illustre l'utilisation de la propriété \`disableErrorHandling\` qui permet de désactiver complètement
1112
+ la gestion et l'affichage des erreurs dans un champ, même si des règles de validation sont définies.
1113
+
1114
+ Cela peut être utile dans des cas particuliers où vous souhaitez définir des règles de validation
1115
+ mais gérer leur affichage différemment, ou utiliser la validation uniquement au niveau du formulaire parent.
1116
+ `,
1117
+ },
1118
+ },
1119
+ sourceCode: [
1120
+ {
1121
+ name: 'Template',
1122
+ code: `<template>
1123
+ <!-- Champ avec validation normale -->
1124
+ <PasswordField
1125
+ v-model="value1"
1126
+ label="Mot de passe avec validation"
1127
+ required
1128
+ :custom-rules="customRules"
1129
+ />
1130
+
1131
+ <!-- Champ avec gestion d'erreurs désactivée -->
1132
+ <PasswordField
1133
+ v-model="value2"
1134
+ label="Mot de passe sans gestion d'erreurs"
1135
+ required
1136
+ disableErrorHandling
1137
+ :custom-rules="customRules"
1138
+ />
1139
+ </template>`,
1140
+ },
1141
+ ],
1142
+ },
1143
+ render: () => ({
1144
+ components: { PasswordField },
1145
+ setup() {
1146
+ const value1 = ref('')
1147
+ const value2 = ref('')
1148
+
1149
+ const customRules = [
1150
+ {
1151
+ type: 'custom',
1152
+ options: {
1153
+ validate: (value: string) => {
1154
+ if (!value || value.length < 8) {
1155
+ return 'Le mot de passe doit contenir au moins 8 caractères'
1156
+ }
1157
+ return true
1158
+ },
1159
+ fieldIdentifier: 'password',
1160
+ },
1161
+ },
1162
+ ]
1163
+
1164
+ return { value1, value2, customRules }
1165
+ },
1166
+ template: `
1167
+ <div>
1168
+ <p class="mb-4">Cette démonstration compare un PasswordField standard et un avec \`disableErrorHandling=true\`.</p>
1169
+
1170
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 16px;">
1171
+ <div>
1172
+ <p class="text-subtitle-2 mb-2">Validation normale</p>
1173
+ <PasswordField
1174
+ v-model="value1"
1175
+ label="Mot de passe avec validation"
1176
+ required
1177
+ :custom-rules="customRules"
1178
+ />
1179
+ </div>
1180
+
1181
+ <div>
1182
+ <p class="text-subtitle-2 mb-2">Sans gestion d'erreurs</p>
1183
+ <PasswordField
1184
+ v-model="value2"
1185
+ label="Mot de passe sans gestion d'erreurs"
1186
+ required
1187
+ disableErrorHandling
1188
+ :custom-rules="customRules"
1189
+ />
1190
+ </div>
1191
+ </div>
1192
+
1193
+ <div class="mt-4 text-body-2">
1194
+ <p>Instructions :</p>
1195
+ <ol>
1196
+ <li class="ml-4">Cliquez dans un champ puis en dehors pour déclencher la validation</li>
1197
+ <li class="ml-4">Le champ de gauche affichera une erreur requise, mais pas celui de droite</li>
1198
+ <li class="ml-4">Vous pouvez également essayer de soumettre les deux champs pour voir la différence de comportement</li>
1199
+ </ol>
1200
+ </div>
1201
+ </div>
1202
+ `,
1203
+ }),
1204
+ }
@@ -32,6 +32,7 @@
32
32
  showSuccessMessages?: boolean
33
33
  displayAsterisk?: boolean
34
34
  isValidateOnBlur?: boolean
35
+ disableErrorHandling?: boolean
35
36
  } & CustomizableOptions>(), {
36
37
  modelValue: null,
37
38
  variantStyle: 'outlined',
@@ -50,6 +51,7 @@
50
51
  showSuccessMessages: true,
51
52
  displayAsterisk: false,
52
53
  isValidateOnBlur: true,
54
+ disableErrorHandling: false,
53
55
  })
54
56
 
55
57
  const options = useCustomizableOptions(config, props)
@@ -105,6 +107,7 @@
105
107
  successRules: props.customSuccessRules || [],
106
108
  showSuccessMessages: props.showSuccessMessages,
107
109
  fieldIdentifier: props.label || 'password',
110
+ disableErrorHandling: props.disableErrorHandling,
108
111
  })
109
112
 
110
113
  // Computed pour les états de validation