@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
@@ -31,6 +31,7 @@ const meta = {
31
31
  },
32
32
  isValidatedOnBlur: { control: 'boolean' },
33
33
  displayAsterisk: { control: 'boolean' },
34
+ disableErrorHandling: { control: 'boolean' },
34
35
  },
35
36
  } satisfies Meta<typeof PhoneField>
36
37
 
@@ -896,3 +897,103 @@ export const DisplayModels: Story = {
896
897
  }
897
898
  },
898
899
  }
900
+
901
+ /**
902
+ * Story qui montre le comportement du composant lorsque la gestion des erreurs est désactivée.
903
+ * Aucun message d'erreur ne sera affiché, même si le champ est requis et vide.
904
+ */
905
+ export const DisabledErrorHandling: Story = {
906
+ parameters: {
907
+ sourceCode: [
908
+ {
909
+ name: 'Template',
910
+ code: `
911
+ <template>
912
+ <PhoneField
913
+ v-model="modelValue"
914
+ :required="required"
915
+ :withCountryCode="withCountryCode"
916
+ :countryCodeRequired="countryCodeRequired"
917
+ :displayFormat="displayFormat"
918
+ :isValidatedOnBlur="isValidatedOnBlur"
919
+ :disableErrorHandling="disableErrorHandling"
920
+ />
921
+ </template>
922
+ `,
923
+ },
924
+ {
925
+ name: 'Script',
926
+ code: `
927
+ <script setup lang="ts">
928
+ import { PhoneField } from '@cnamts/synapse'
929
+
930
+ const modelValue = ref('')
931
+ const required = ref(true)
932
+ const withCountryCode = ref(true)
933
+ const countryCodeRequired = ref(true)
934
+ const displayFormat = ref('code')
935
+ const isValidatedOnBlur = ref(true)
936
+ const disableErrorHandling = ref(true)
937
+ </script>
938
+ `,
939
+ },
940
+ ],
941
+ },
942
+ args: {
943
+ modelValue: '',
944
+ required: true,
945
+ outlined: true,
946
+ outlinedIndicatif: true,
947
+ withCountryCode: true,
948
+ countryCodeRequired: true,
949
+ displayFormat: 'code',
950
+ customIndicatifs: [],
951
+ useCustomIndicatifsOnly: false,
952
+ isValidatedOnBlur: true,
953
+ disableErrorHandling: true,
954
+ },
955
+ render: (args) => {
956
+ return {
957
+ components: { PhoneField },
958
+ setup() {
959
+ return { args }
960
+ },
961
+ template: `
962
+ <div class="pa-4">
963
+ <h3>Gestion des erreurs désactivée</h3>
964
+ <p>Ce champ est requis mais n'affichera pas d'erreur même s'il est vide.</p>
965
+ <PhoneField
966
+ v-model="args.modelValue"
967
+ :required="args.required"
968
+ :outlined="args.outlined"
969
+ :outlinedIndicatif="args.outlinedIndicatif"
970
+ :withCountryCode="args.withCountryCode"
971
+ :countryCodeRequired="args.countryCodeRequired"
972
+ :displayFormat="args.displayFormat"
973
+ :customIndicatifs="args.customIndicatifs"
974
+ :useCustomIndicatifsOnly="args.useCustomIndicatifsOnly"
975
+ :isValidatedOnBlur="args.isValidatedOnBlur"
976
+ :disableErrorHandling="args.disableErrorHandling"
977
+ />
978
+ <div class="mt-6">
979
+ <h3>Comparaison avec gestion des erreurs activée</h3>
980
+ <p>Ce champ est requis et affichera une erreur s'il est vide.</p>
981
+ <PhoneField
982
+ v-model="args.modelValue"
983
+ :required="args.required"
984
+ :outlined="args.outlined"
985
+ :outlinedIndicatif="args.outlinedIndicatif"
986
+ :withCountryCode="args.withCountryCode"
987
+ :countryCodeRequired="args.countryCodeRequired"
988
+ :displayFormat="args.displayFormat"
989
+ :customIndicatifs="args.customIndicatifs"
990
+ :useCustomIndicatifsOnly="args.useCustomIndicatifsOnly"
991
+ :isValidatedOnBlur="args.isValidatedOnBlur"
992
+ :disableErrorHandling="false"
993
+ />
994
+ </div>
995
+ </div>
996
+ `,
997
+ }
998
+ },
999
+ }
@@ -1,14 +1,13 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref, watch } from 'vue'
3
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'
4
+ import { mdiPhone } from '@mdi/js'
7
5
  import { indicatifs } from './indicatifs'
8
6
  import { vMaska } from 'maska/vue'
9
7
  import { locales } from './locales'
10
8
  import SySelect from '@/components/Customs/SySelect/SySelect.vue'
11
9
  import SyTextField from '@/components/Customs/SyTextField/SyTextField.vue'
10
+ import { useValidation, type ValidationRule } from '@/composables/validation/useValidation'
12
11
 
13
12
  type DisplayFormat = 'code' | 'code-abbreviation' | 'code-country' | 'country' | 'abbreviation'
14
13
  type Indicatif = {
@@ -33,6 +32,7 @@
33
32
  useCustomIndicatifsOnly: { type: Boolean, default: false },
34
33
  isValidatedOnBlur: { type: Boolean, default: true },
35
34
  displayAsterisk: { type: Boolean, default: false },
35
+ disableErrorHandling: { type: Boolean, default: false },
36
36
  })
37
37
 
38
38
  const emit = defineEmits(['update:modelValue', 'update:selectedDialCode', 'change'])
@@ -42,7 +42,6 @@
42
42
  const dialCode = ref<string | Record<string, any>>(props.dialCodeModel || '')
43
43
  const counter = ref(10)
44
44
  const phoneMask = ref('## ## ## ## ##')
45
- const hasError = ref(false)
46
45
  const onBlur = ref(false)
47
46
 
48
47
  function formatPhoneNumber(value: string): string {
@@ -95,25 +94,74 @@
95
94
  return format[props.displayFormat] || ind.code
96
95
  }
97
96
 
98
- const validationRules = computed(() => {
99
- const rules = [exactLength(counter.value, true)]
97
+ const validationRules = computed<ValidationRule[]>(() => {
98
+ const rules = [{
99
+ type: 'exactLength',
100
+ options: {
101
+ length: counter.value,
102
+ ignoreSpace: true, // Ignorer les espaces dans la validation
103
+ message: `Le numéro de téléphone doit contenir ${counter.value} chiffres.`,
104
+ fieldIdentifier: locales.label,
105
+ },
106
+ }]
100
107
  if (props.required) {
101
- rules.unshift(RequiredRule)
108
+ rules.unshift({
109
+ type: 'required',
110
+ options: {
111
+ length: counter.value,
112
+ ignoreSpace: true, // Ignorer les espaces dans la validation
113
+ message: `Le champ ${locales.label} est requis.`,
114
+ fieldIdentifier: locales.label,
115
+ },
116
+ })
102
117
  }
103
118
  return rules
104
119
  })
105
120
 
121
+ // Initialisation du composable de validation
122
+ const validation = useValidation({
123
+ customRules: validationRules.value,
124
+ showSuccessMessages: true,
125
+ fieldIdentifier: locales.label,
126
+ disableErrorHandling: props.disableErrorHandling,
127
+ })
128
+
129
+ // Computed pour l'affichage des états
130
+ const hasError = computed(() => validation.hasError.value)
131
+ const hasWarning = computed(() => validation.hasWarning.value)
132
+ const hasSuccess = computed(() => validation.hasSuccess.value)
133
+
134
+ const errors = computed(() => validation.errors.value)
135
+ const warnings = computed(() => validation.warnings.value)
136
+ const successes = computed(() => validation.successes.value)
137
+
106
138
  function validateInputOnBlur() {
107
139
  if (!props.isValidatedOnBlur) return
108
140
 
109
- hasError.value = false
110
- const requiredValidation = !props.required || RequiredRule(phoneNumber.value) === true
111
- const lengthValidation = exactLength(counter.value, true)(phoneNumber.value) === true
112
-
113
- hasError.value = !(requiredValidation && lengthValidation)
114
141
  onBlur.value = true
142
+ // On nettoie la valeur des espaces avant de la valider
143
+ const cleanedValue = phoneNumber.value.replace(/\s/g, '')
144
+ validation.validateField(cleanedValue, validationRules.value)
115
145
  }
116
146
 
147
+ // Mise à jour de la validation lorsque le numéro de téléphone change
148
+ watch(phoneNumber, (newValue) => {
149
+ if (!props.isValidatedOnBlur || onBlur.value) {
150
+ // On nettoie la valeur des espaces avant de la valider
151
+ const cleanedValue = newValue.replace(/\s/g, '')
152
+ validation.validateField(cleanedValue, validationRules.value)
153
+ }
154
+ })
155
+
156
+ // Mise à jour de la validation lorsque les règles changent
157
+ watch(validationRules, () => {
158
+ if (onBlur.value) {
159
+ // On nettoie la valeur des espaces avant de la valider
160
+ const cleanedValue = phoneNumber.value.replace(/\s/g, '')
161
+ validation.validateField(cleanedValue, validationRules.value)
162
+ }
163
+ })
164
+
117
165
  defineExpose({
118
166
  computedValue,
119
167
  dialCode,
@@ -122,6 +170,7 @@
122
170
  hasError,
123
171
  phoneNumber,
124
172
  mergedDialCodes,
173
+ validation,
125
174
  })
126
175
  </script>
127
176
 
@@ -135,6 +184,8 @@
135
184
  :outlined="outlinedIndicatif"
136
185
  :required="props.countryCodeRequired"
137
186
  :display-asterisk="props.displayAsterisk"
187
+ :disable-error-handling="props.disableErrorHandling"
188
+ :return-object="true"
138
189
  class="custom-select"
139
190
  text-key="displayText"
140
191
  value-key="code"
@@ -146,10 +197,18 @@
146
197
  :counter-value="(value: string) => value.replace(/\s/g, '').length"
147
198
  :label="locales.label"
148
199
  :required="props.required"
149
- :rules="validationRules"
200
+ :error="hasError"
201
+ :error-messages="errors"
202
+ :warning-messages="warnings"
203
+ :success-messages="successes"
150
204
  :variant="outlined ? 'outlined' : 'underlined'"
151
205
  :display-asterisk="props.displayAsterisk"
152
- class="phone-field"
206
+ :class="{
207
+ 'phone-field': true,
208
+ 'error-field': hasError,
209
+ 'warning-field': hasWarning,
210
+ 'success-field': hasSuccess
211
+ }"
153
212
  color="primary"
154
213
  @blur="validateInputOnBlur"
155
214
  @input="handlePhoneInput"
@@ -161,9 +220,6 @@
161
220
  >
162
221
  {{ mdiPhone }}
163
222
  </VIcon>
164
- <VIcon v-if="hasError">
165
- {{ mdiInformation }}
166
- </VIcon>
167
223
  </template>
168
224
  </SyTextField>
169
225
  </div>
@@ -161,4 +161,44 @@ describe('PhoneField', () => {
161
161
  const textField = wrapper.findComponent({ name: 'VTextField' })
162
162
  expect(textField.props('variant')).toBe('underlined')
163
163
  })
164
+
165
+ it('passes dialCode object to SyTextField when dialCode is set', async () => {
166
+ const wrapper = mount(PhoneField, {
167
+ global: {
168
+ plugins: [vuetify],
169
+ },
170
+ props: {
171
+ withCountryCode: true,
172
+ dialCodeModel: { code: '+33', abbreviation: 'FR', country: 'France', phoneLength: 10, mask: '## ## ## ## ##' },
173
+ },
174
+ })
175
+
176
+ // Vérifier que le dialCode est bien un objet
177
+ expect(typeof wrapper.vm.dialCode).toBe('object')
178
+
179
+ // Trouver le composant SyTextField
180
+ const textField = wrapper.findComponent({ name: 'SyTextField' })
181
+ expect(textField.exists()).toBe(true)
182
+
183
+ // Vérifier que les propriétés du SyTextField sont correctement définies en fonction du dialCode
184
+ expect(wrapper.vm.phoneMask).toBe('## ## ## ## ##')
185
+ expect(wrapper.vm.counter).toBe(10)
186
+
187
+ // Vérifier que le SyTextField reçoit les bonnes propriétés
188
+ expect(textField.props('counter')).toBe(10)
189
+
190
+ // Vérifier que le SySelect est présent et reçoit l'objet dialCode
191
+ const select = wrapper.findComponent({ name: 'SySelect' })
192
+ expect(select.exists()).toBe(true)
193
+ expect(select.props('returnObject')).toBe(true)
194
+
195
+ // Vérifier que l'objet dialCode est correctement passé au SySelect via v-model
196
+ expect(wrapper.vm.dialCode).toEqual({
197
+ code: '+33',
198
+ abbreviation: 'FR',
199
+ country: 'France',
200
+ phoneLength: 10,
201
+ mask: '## ## ## ## ##',
202
+ })
203
+ })
164
204
  })
@@ -141,7 +141,7 @@ export const Default: Story = {
141
141
  code: `
142
142
  <script setup lang="ts">
143
143
  import { ref } from 'vue'
144
- import RatingPicker from '@cnamts/synapse'
144
+ import { RatingPicker } from '@cnamts/synapse'
145
145
 
146
146
  const ratingEmotion = ref(-1)
147
147
  </script>
@@ -192,7 +192,7 @@ export const TwoEmotions: Story = {
192
192
  code: `
193
193
  <script setup lang="ts">
194
194
  import { ref } from 'vue'
195
- import RatingPicker from '@cnamts/synapse'
195
+ import { RatingPicker } from '@cnamts/synapse'
196
196
 
197
197
  const ratingEmotion = ref(-1)
198
198
  </script>
@@ -241,7 +241,7 @@ export const Numbers: Story = {
241
241
  code: `
242
242
  <script setup lang="ts">
243
243
  import { ref } from 'vue'
244
- import RatingPicker from '@cnamts/synapse'
244
+ import { RatingPicker } from '@cnamts/synapse'
245
245
 
246
246
  const ratingNumber = ref(-1)
247
247
  </script>
@@ -290,7 +290,7 @@ export const Stars: Story = {
290
290
  code: `
291
291
  <script setup lang="ts">
292
292
  import { ref } from 'vue'
293
- import RatingPicker from '@cnamts/synapse'
293
+ import { RatingPicker } from '@cnamts/synapse'
294
294
 
295
295
  const ratingStar = ref(-1)
296
296
  </script>
@@ -341,7 +341,7 @@ export const ReadOnly: Story = {
341
341
  code: `
342
342
  <script setup lang="ts">
343
343
  import { ref } from 'vue'
344
- import RatingPicker from '@cnamts/synapse'
344
+ import { RatingPicker } from '@cnamts/synapse'
345
345
 
346
346
  const ratingEmotion = ref(-1)
347
347
  </script>
@@ -392,7 +392,7 @@ export const HideAlert: Story = {
392
392
  code: `
393
393
  <script setup lang="ts">
394
394
  import { ref } from 'vue'
395
- import RatingPicker from '@cnamts/synapse'
395
+ import { RatingPicker } from '@cnamts/synapse'
396
396
 
397
397
  const ratingEmotion = ref(-1)
398
398
  </script>
@@ -488,7 +488,7 @@ export const DefaultSlot: Story = {
488
488
  code: `
489
489
  <script setup lang="ts">
490
490
  import { ref } from 'vue'
491
- import {RatingPicker, SySelect} from '@cnamts/synapse'
491
+ import { RatingPicker, SySelect } from '@cnamts/synapse'
492
492
  import { VBtn, VSpacer } from 'vuetify/components'
493
493
 
494
494
  const ratingEmotion = ref(-1)
@@ -88,7 +88,7 @@ export const Default: Story = {
88
88
  code: `
89
89
  <script setup lang="ts">
90
90
  import { ref } from 'vue'
91
- import SearchListField from '@cnamts/synapse'
91
+ import { SearchListField } from '@cnamts/synapse'
92
92
 
93
93
  const modelValue = ref('')
94
94
 
@@ -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 />
@@ -0,0 +1,216 @@
1
+ import { VExpansionPanels, VExpansionPanel, VExpansionPanelTitle, VExpansionPanelText, VDataTable, VIcon } from 'vuetify/components'
2
+ import type { StoryObj } from '@storybook/vue3'
3
+ import { AccessibiliteItemsIndeterminate, AccessibiliteItemsValidated } from './AccessibiliteItems'
4
+ import { mdiCheckboxMarkedCircle, mdiLink, mdiEye } from '@mdi/js'
5
+
6
+ const checkIcon = mdiCheckboxMarkedCircle
7
+ const iconEye = mdiEye
8
+ const linkICon = mdiLink
9
+
10
+ export default {
11
+ title: 'Composants/Formulaires/UploadWorkflow/Accessibilité',
12
+ }
13
+
14
+ export const AccessibilitePanel: StoryObj = {
15
+
16
+ render: () => {
17
+ return {
18
+ components: { VExpansionPanels, VExpansionPanel, VExpansionPanelTitle, VExpansionPanelText, VDataTable, VIcon },
19
+
20
+ setup() {
21
+ const icon = checkIcon
22
+
23
+ return { AccessibiliteItemsIndeterminate, AccessibiliteItemsValidated, icon, linkICon, iconEye }
24
+ },
25
+ template: `
26
+ <div class="accessibiliteItems" style="display:flex; max-width: none !important;">
27
+ <v-col cols="6">
28
+ <div style="display:flex; margin-bottom: 10px; justify-content: space-between; align-items: center;">
29
+ <h5>{{ AccessibiliteItemsIndeterminate.length }} critères à prendre en charge par le projet</h5>
30
+ <div style="display: flex; align-items: center;">
31
+ <v-btn variant="tonal" color="red" size="x-small" style="margin: 4px;font-size: 8px;"
32
+ rounded>Tanaguru
33
+ </v-btn>
34
+ </div>
35
+ </div>
36
+
37
+ <v-expansion-panels value="opened" multiple>
38
+ <v-expansion-panel v-for="(item, index) in AccessibiliteItemsIndeterminate" :key="index" style="background-color: rgba(42, 96, 158, 0.1); margin-bottom: 10px;">
39
+ <v-expansion-panel-title>
40
+ <VIcon :icon="iconEye" style="margin-right: 5px; color:#5778b7;"/>
41
+ {{ item.title }}
42
+ </v-expansion-panel-title>
43
+ <v-expansion-panel-text>
44
+ <v-expansion-panels>
45
+
46
+ <v-expansion-panel v-for="(i, index) in item.items2" :key="i" style="margin-bottom: 10px;">
47
+ <v-expansion-panel-title
48
+ style="font-weight: bold; font-size: 13px; line-height: 16px;">
49
+ {{ i.subtitle}}
50
+ </v-expansion-panel-title>
51
+ <v-expansion-panel-text>
52
+ <div>
53
+ <p style="font-size: 13px;line-height: 16px;">
54
+ {{ i.precision }}
55
+ </p>
56
+ <div v-for="(value, index) in i.solution"
57
+ style="margin-top:15px; font-size: 13px;line-height: 16px;">
58
+ <p style="font-weight: bold;">Méthodologie du test : <a
59
+ href="{{i.link}}" target="blank">
60
+ <VIcon :icon="linkICon"/>
61
+ </a></p>
62
+ <p>{{ value.info1 }}</p>
63
+ <p>{{ value.info2 }}</p>
64
+ <p>{{ value.info3 }}</p>
65
+ </div>
66
+ <span style="display:flex; justify-content:center; margin-bottom:5px;">______</span>
67
+ </div>
68
+ </v-expansion-panel-text>
69
+ </v-expansion-panel>
70
+ <v-expansion-panel>
71
+ <v-expansion-panel-title
72
+ style="font-weight: bold; font-size: 13px; line-height: 16px;">
73
+ {{ item.subtitle }}
74
+ </v-expansion-panel-title>
75
+ <v-expansion-panel-text>
76
+ <div v-for="(value, i) in item.items" :key="i">
77
+ <p style="font-size: 13px;line-height: 16px;">
78
+ {{ value.precision }}
79
+ </p>
80
+ <div v-for="element in value.solution"
81
+ style="margin-top:15px; font-size: 13px;line-height: 16px;">
82
+ <p style="font-weight: bold;">Méthodologie du test : <a
83
+ href="value.link" target="blank">
84
+ <VIcon :icon="linkICon"/>
85
+ </a></p>
86
+ <p>{{ element.info1 }}</p>
87
+ <p>{{ element.info2 }}</p>
88
+ <p>{{ element.info3 }}</p>
89
+ </div>
90
+ <span style="display:flex; justify-content:center; margin-bottom:5px;">______</span>
91
+ </div>
92
+ </v-expansion-panel-text>
93
+ </v-expansion-panel>
94
+ </v-expansion-panels>
95
+ </v-expansion-panel-text>
96
+ </v-expansion-panel>
97
+ </v-expansion-panels>
98
+ </v-col>
99
+ <v-col cols="6">
100
+ <div style="display:flex; margin-bottom: 10px; justify-content: space-between; align-items: center;">
101
+ <h5>{{ AccessibiliteItemsValidated.length }} critères pris en charge par l'équipe Design System</h5>
102
+ <div style="display: flex; align-items: center;">
103
+ <v-btn variant="tonal" color="red" size="x-small" style="margin: 4px;font-size: 8px;"
104
+ rounded>Tanaguru
105
+ </v-btn>
106
+ </div>
107
+ </div>
108
+ <v-expansion-panels value="opened" multiple>
109
+ <v-expansion-panel
110
+ v-for="(item, index) in AccessibiliteItemsValidated"
111
+ :key="index" style="background-color: rgba(53,135,0,0.1); margin-bottom: 10px;">
112
+ <v-expansion-panel-title>
113
+ <VIcon color="green" :icon="icon" style="margin-right: 5px;"/>
114
+ {{ item.title }}
115
+ </v-expansion-panel-title>
116
+ <v-expansion-panel-text>
117
+ <v-expansion-panels>
118
+
119
+ <v-expansion-panel v-for="(i, index) in item.items2" :key="i" style="margin-bottom: 10px;">
120
+ <v-expansion-panel-title
121
+ style="font-weight: bold; font-size: 13px; line-height: 16px;">
122
+ {{ i.subtitle}}
123
+ </v-expansion-panel-title>
124
+ <v-expansion-panel-text>
125
+ <div>
126
+ <p style="font-size: 13px;line-height: 16px;">
127
+ {{ i.precision }}
128
+ </p>
129
+ <div v-for="(value, index) in i.solution"
130
+ style="margin-top:15px; font-size: 13px;line-height: 16px;">
131
+ <p style="font-weight: bold;">Méthodologie du test : <a
132
+ href="{{i.link}}" target="blank">
133
+ <VIcon :icon="linkICon"/>
134
+ </a></p>
135
+ <p>{{ value.info1 }}</p>
136
+ <p>{{ value.info2 }}</p>
137
+ <p>{{ value.info3 }}</p>
138
+ </div>
139
+ <span style="display:flex; justify-content:center; margin-bottom:5px;">______</span>
140
+ </div>
141
+ </v-expansion-panel-text>
142
+ </v-expansion-panel>
143
+
144
+ <v-expansion-panel>
145
+ <v-expansion-panel-title
146
+ style="font-weight: bold; font-size: 13px; line-height: 16px;">
147
+ {{ item.subtitle }}
148
+ </v-expansion-panel-title>
149
+ <v-expansion-panel-text>
150
+ <div v-for="(value, i) in item.items" :key="i">
151
+ <p style="font-size: 13px;line-height: 16px;">
152
+ {{ value.precision }}
153
+ </p>
154
+ <div v-for="element in value.solution"
155
+ style="margin-top:15px; font-size: 13px;line-height: 16px;">
156
+ <p style="font-weight: bold;">Méthodologie du test : <a
157
+ href="value.link" target="blank">
158
+ <VIcon :icon="linkICon"/>
159
+ </a></p>
160
+ <p>{{ element.info1 }}</p>
161
+ <p>{{ element.info2 }}</p>
162
+ <p>{{ element.info3 }}</p>
163
+ </div>
164
+ <span style="display:flex; justify-content:center; margin-bottom:5px;">______</span>
165
+ </div>
166
+ </v-expansion-panel-text>
167
+ </v-expansion-panel>
168
+ </v-expansion-panels>
169
+ </v-expansion-panel-text>
170
+ </v-expansion-panel>
171
+ </v-expansion-panels>
172
+ </v-col>
173
+ </div>
174
+ `,
175
+ }
176
+ },
177
+ tags: ['!dev'],
178
+ }
179
+
180
+ export const Legende: StoryObj = {
181
+ args: {
182
+ icon: checkIcon,
183
+ },
184
+ render: (args) => {
185
+ return {
186
+ components: { VIcon },
187
+ setup() {
188
+ return { args }
189
+ },
190
+ template: `
191
+ <p style="color: grey;font-size: 11px; margin-bottom: 12px;">Date de conception: 20/11/2024</p>
192
+ <div>
193
+ <p>Le tableau ci-dessous liste nos recommandations suivant les <a target="blank" style="color:#0C41BD;" href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/#contenu">catégories du RGAA</a>.</p>
194
+ <p style="margin-bottom: 12px;font-weight:bold;">Pour rappel le composant seul ne garantie pas
195
+ l'accessibilité du site.</p>
196
+ <div style="font-size: 14px">
197
+ <p>Nous avons deux façons de relever les problèmes d'accessibilité des composants :</p>
198
+ <div>
199
+ <v-btn variant="tonal" color="grey" size="x-small" style="margin: 2px;font-size: 8px;" rounded>
200
+ Audit
201
+ </v-btn>
202
+ Problèmes relevés par le projet
203
+ </div>
204
+ <div>
205
+ <v-btn variant="tonal" color="red" size="x-small" style="margin: 2px;font-size: 8px;" rounded>
206
+ Tanaguru
207
+ </v-btn>
208
+ Problèmes relevés par Tanaguru
209
+ </div>
210
+ </div>
211
+ </div>
212
+ `,
213
+ }
214
+ },
215
+ tags: ['!dev'],
216
+ }