@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
@@ -78,6 +78,14 @@ const meta: Meta<typeof PeriodField> = {
78
78
  control: 'object',
79
79
  description: 'Règles d\'avertissement',
80
80
  },
81
+ disableErrorHandling: {
82
+ control: 'boolean',
83
+ description: 'Désactive la gestion des erreurs',
84
+ },
85
+ showSuccessMessages: {
86
+ control: 'boolean',
87
+ description: 'Affiche les messages de succès',
88
+ },
81
89
  },
82
90
  } as Meta<typeof PeriodField>
83
91
 
@@ -122,21 +130,19 @@ export const Default: Story = {
122
130
  noIcon: false,
123
131
  modelValue: { from: null, to: null },
124
132
  },
125
- render: (args) => {
126
- return {
127
- components: { PeriodField: PeriodField },
128
- setup() {
129
- const value = ref({ from: null, to: null })
130
- return { args, value }
131
- },
132
- template: `
133
+ render: args => ({
134
+ components: { PeriodField: PeriodField },
135
+ setup() {
136
+ const value = ref({ from: null, to: null })
137
+ return { args, value }
138
+ },
139
+ template: `
133
140
  <div class="pa-4">
134
141
  <PeriodField v-bind="args" v-model="value"/>
135
142
  <p>Période sélectionnée : {{ value }}</p>
136
143
  </div>
137
144
  `,
138
- }
139
- },
145
+ }),
140
146
  }
141
147
 
142
148
  export const CustomPlaceholders: Story = {
@@ -180,21 +186,19 @@ export const CustomPlaceholders: Story = {
180
186
  noIcon: false,
181
187
  modelValue: { from: null, to: null },
182
188
  },
183
- render: (args) => {
184
- return {
185
- components: { PeriodField: PeriodField },
186
- setup() {
187
- const value = ref({ from: null, to: null })
188
- return { args, value }
189
- },
190
- template: `
189
+ render: args => ({
190
+ components: { PeriodField: PeriodField },
191
+ setup() {
192
+ const value = ref({ from: null, to: null })
193
+ return { args, value }
194
+ },
195
+ template: `
191
196
  <div class="pa-4">
192
197
  <PeriodField v-bind="args" v-model="value"/>
193
198
  <p>Période sélectionnée : {{ value }}</p>
194
199
  </div>
195
200
  `,
196
- }
197
- },
201
+ }),
198
202
  }
199
203
 
200
204
  export const Disabled: Story = {
@@ -236,20 +240,18 @@ export const Disabled: Story = {
236
240
  noIcon: false,
237
241
  modelValue: { from: null, to: null },
238
242
  },
239
- render: (args) => {
240
- return {
241
- components: { PeriodField: PeriodField },
242
- setup() {
243
- const value = ref({ from: null, to: null })
244
- return { args, value }
245
- },
246
- template: `
243
+ render: args => ({
244
+ components: { PeriodField: PeriodField },
245
+ setup() {
246
+ const value = ref({ from: null, to: null })
247
+ return { args, value }
248
+ },
249
+ template: `
247
250
  <div class="pa-4">
248
251
  <PeriodField v-bind="args" v-model="value"/>
249
252
  </div>
250
253
  `,
251
- }
252
- },
254
+ }),
253
255
  }
254
256
 
255
257
  export const Required: Story = {
@@ -292,21 +294,19 @@ export const Required: Story = {
292
294
  noIcon: false,
293
295
  modelValue: { from: null, to: null },
294
296
  },
295
- render: (args) => {
296
- return {
297
- components: { PeriodField: PeriodField },
298
- setup() {
299
- const value = ref({ from: null, to: null })
300
- return { args, value }
301
- },
302
- template: `
297
+ render: args => ({
298
+ components: { PeriodField: PeriodField },
299
+ setup() {
300
+ const value = ref({ from: null, to: null })
301
+ return { args, value }
302
+ },
303
+ template: `
303
304
  <div class="pa-4">
304
305
  <PeriodField v-bind="args" v-model="value"/>
305
306
  <p>Période sélectionnée : {{ value }}</p>
306
307
  </div>
307
308
  `,
308
- }
309
- },
309
+ }),
310
310
  }
311
311
 
312
312
  export const AppendIcon: Story = {
@@ -348,21 +348,19 @@ export const AppendIcon: Story = {
348
348
  noIcon: false,
349
349
  modelValue: { from: null, to: null },
350
350
  },
351
- render: (args) => {
352
- return {
353
- components: { PeriodField: PeriodField },
354
- setup() {
355
- const value = ref({ from: null, to: null })
356
- return { args, value }
357
- },
358
- template: `
351
+ render: args => ({
352
+ components: { PeriodField: PeriodField },
353
+ setup() {
354
+ const value = ref({ from: null, to: null })
355
+ return { args, value }
356
+ },
357
+ template: `
359
358
  <div class="pa-4">
360
359
  <PeriodField v-bind="args" v-model="value"/>
361
360
  <p>Période sélectionnée : {{ value }}</p>
362
361
  </div>
363
362
  `,
364
- }
365
- },
363
+ }),
366
364
  }
367
365
 
368
366
  export const WithoutIcon: Story = {
@@ -405,21 +403,19 @@ export const WithoutIcon: Story = {
405
403
  noIcon: false,
406
404
  modelValue: { from: null, to: null },
407
405
  },
408
- render: (args) => {
409
- return {
410
- components: { PeriodField: PeriodField },
411
- setup() {
412
- const value = ref({ from: null, to: null })
413
- return { args, value }
414
- },
415
- template: `
406
+ render: args => ({
407
+ components: { PeriodField: PeriodField },
408
+ setup() {
409
+ const value = ref({ from: null, to: null })
410
+ return { args, value }
411
+ },
412
+ template: `
416
413
  <div class="pa-4">
417
414
  <PeriodField v-bind="args" v-model="value"/>
418
415
  <p>Période sélectionnée : {{ value }}</p>
419
416
  </div>
420
417
  `,
421
- }
422
- },
418
+ }),
423
419
  }
424
420
 
425
421
  export const WithError: Story = {
@@ -467,21 +463,19 @@ export const WithError: Story = {
467
463
  { type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourd\'hui' } },
468
464
  ],
469
465
  },
470
- render: (args) => {
471
- return {
472
- components: { PeriodField: PeriodField },
473
- setup() {
474
- const value = ref({ from: '01/01/2100', to: '05/01/2100' })
475
- return { args, value }
476
- },
477
- template: `
466
+ render: args => ({
467
+ components: { PeriodField: PeriodField },
468
+ setup() {
469
+ const value = ref({ from: '01/01/2100', to: '05/01/2100' })
470
+ return { args, value }
471
+ },
472
+ template: `
478
473
  <div class="pa-4">
479
474
  <PeriodField v-bind="args" v-model="value"/>
480
475
  <p>Période sélectionnée : {{ value }}</p>
481
476
  </div>
482
477
  `,
483
- }
484
- },
478
+ }),
485
479
  }
486
480
 
487
481
  export const WithWarning: Story = {
@@ -540,21 +534,19 @@ export const WithWarning: Story = {
540
534
  },
541
535
  ],
542
536
  },
543
- render: (args) => {
544
- return {
545
- components: { PeriodField: PeriodField },
546
- setup() {
547
- const value = ref({ from: '20/12/2023', to: '21/12/2023' })
548
- return { args, value }
549
- },
550
- template: `
537
+ render: args => ({
538
+ components: { PeriodField: PeriodField },
539
+ setup() {
540
+ const value = ref({ from: '20/12/2023', to: '21/12/2023' })
541
+ return { args, value }
542
+ },
543
+ template: `
551
544
  <div class="pa-4">
552
545
  <PeriodField v-bind="args" v-model="value"/>
553
546
  <p>Période sélectionnée : {{ value }}</p>
554
547
  </div>
555
548
  `,
556
- }
557
- },
549
+ }),
558
550
  }
559
551
 
560
552
  export const WithSuccess: Story = {
@@ -607,21 +599,19 @@ export const WithSuccess: Story = {
607
599
  },
608
600
  ],
609
601
  },
610
- render: (args) => {
611
- return {
612
- components: { PeriodField: PeriodField },
613
- setup() {
614
- const value = ref({ from: '22/01/2024', to: '23/01/2024' })
615
- return { args, value }
616
- },
617
- template: `
602
+ render: args => ({
603
+ components: { PeriodField: PeriodField },
604
+ setup() {
605
+ const value = ref({ from: '22/01/2024', to: '23/01/2024' })
606
+ return { args, value }
607
+ },
608
+ template: `
618
609
  <div class="pa-4">
619
610
  <PeriodField v-bind="args" v-model="value"/>
620
611
  <p>Période sélectionnée : {{ value }}</p>
621
612
  </div>
622
613
  `,
623
- }
624
- },
614
+ }),
625
615
  }
626
616
 
627
617
  export const DifferentFormats: Story = {
@@ -683,18 +673,17 @@ export const DifferentFormats: Story = {
683
673
  noIcon: false,
684
674
  modelValue: { from: '12/10/2023', to: '15/10/2023' },
685
675
  },
686
- render: (args) => {
687
- return {
688
- components: { PeriodField: PeriodField },
689
- setup() {
690
- const value1 = ref({ from: '12/10/2023', to: '15/10/2023' })
691
- const value2 = ref({ from: '10/12/2023', to: '10/15/2023' })
692
- const value3 = ref({ from: '2023-10-12', to: '2023-10-15' })
693
- const value4 = ref({ from: '12-10-23', to: '15-10-23' })
694
- const value5 = ref({ from: '12.10.2023', to: '15.10.2023' })
695
- return { args, value1, value2, value3, value4, value5 }
696
- },
697
- template: `
676
+ render: args => ({
677
+ components: { PeriodField: PeriodField },
678
+ setup() {
679
+ const value1 = ref({ from: '12/10/2023', to: '15/10/2023' })
680
+ const value2 = ref({ from: '10/12/2023', to: '10/15/2023' })
681
+ const value3 = ref({ from: '2023-10-12', to: '2023-10-15' })
682
+ const value4 = ref({ from: '12-10-23', to: '15-10-23' })
683
+ const value5 = ref({ from: '12.10.2023', to: '15.10.2023' })
684
+ return { args, value1, value2, value3, value4, value5 }
685
+ },
686
+ template: `
698
687
  <div class="pa-4">
699
688
  <PeriodField v-bind="args" v-model="value1" format="DD/MM/YYYY" class="mb-4" />
700
689
  <PeriodField v-bind="args" v-model="value2" format="MM/DD/YYYY" class="mb-4" />
@@ -703,8 +692,7 @@ export const DifferentFormats: Story = {
703
692
  <PeriodField v-bind="args" v-model="value5" format="DD.MM.YYYY"/>
704
693
  </div>
705
694
  `,
706
- }
707
- },
695
+ }),
708
696
  }
709
697
 
710
698
  export const WithDateFormatReturn: Story = {
@@ -763,19 +751,18 @@ export const WithDateFormatReturn: Story = {
763
751
  noIcon: false,
764
752
  modelValue: { from: null, to: null },
765
753
  },
766
- render: (args) => {
767
- return {
768
- components: { PeriodField: PeriodField },
769
- setup() {
770
- const value1 = ref({ from: '12/10/2023', to: '15/10/2023' })
771
- const value2 = ref({ from: '12/10/2023', to: '15/10/2023' })
772
- const value3 = ref({ from: '12/10/2023', to: '15/10/2023' })
773
- const valueReturn1 = ref({ from: '12/10/2023', to: '15/10/2023' })
774
- const valueReturn2 = ref({ from: '10/12/2023', to: '10/15/2023' })
775
- const valueReturn3 = ref({ from: '2023/12/10', to: '2023/15/10' })
776
- return { args, value1, value2, value3, valueReturn1, valueReturn2, valueReturn3 }
777
- },
778
- template: `
754
+ render: args => ({
755
+ components: { PeriodField: PeriodField },
756
+ setup() {
757
+ const value1 = ref({ from: '12/10/2023', to: '15/10/2023' })
758
+ const value2 = ref({ from: '12/10/2023', to: '15/10/2023' })
759
+ const value3 = ref({ from: '12/10/2023', to: '15/10/2023' })
760
+ const valueReturn1 = ref({ from: '12/10/2023', to: '15/10/2023' })
761
+ const valueReturn2 = ref({ from: '10/12/2023', to: '10/15/2023' })
762
+ const valueReturn3 = ref({ from: '2023/12/10', to: '2023/15/10' })
763
+ return { args, value1, value2, value3, valueReturn1, valueReturn2, valueReturn3 }
764
+ },
765
+ template: `
779
766
  <div class="pa-4">
780
767
  <span>Période de retour : {{ valueReturn1 }}<br/><br/></span>
781
768
  <PeriodField
@@ -802,6 +789,115 @@ export const WithDateFormatReturn: Story = {
802
789
  />
803
790
  </div>
804
791
  `,
805
- }
792
+ }),
793
+ }
794
+
795
+ export const ValidationBehaviors: Story = {
796
+ parameters: {
797
+ sourceCode: [
798
+ {
799
+ code: `<template>
800
+ <div class="mb-8">
801
+ <h3 class="mb-4">Par défaut (avec validation)</h3>
802
+ <PeriodField
803
+ v-model="periodDefault"
804
+ required
805
+ />
806
+ </div>
807
+
808
+ <div class="mb-8">
809
+ <h3 class="mb-4">Validation désactivée (disableErrorHandling=true)</h3>
810
+ <PeriodField
811
+ v-model="periodNoErrors"
812
+ required
813
+ :disable-error-handling="true"
814
+ />
815
+ </div>
816
+
817
+ <div class="mb-8">
818
+ <h3 class="mb-4">Messages de succès désactivés (showSuccessMessages=false)</h3>
819
+ <PeriodField
820
+ v-model="periodNoSuccess"
821
+ required
822
+ :show-success-messages="false"
823
+ />
824
+ </div>
825
+
826
+ <div class="mb-8">
827
+ <h3 class="mb-4">Validation et messages de succès désactivés</h3>
828
+ <PeriodField
829
+ v-model="periodNoValidation"
830
+ required
831
+ :disable-error-handling="true"
832
+ :show-success-messages="false"
833
+ />
834
+ </div>
835
+ </template>
836
+
837
+ <script setup lang="ts">
838
+ import { ref } from 'vue'
839
+ import PeriodField from '../PeriodField.vue'
840
+
841
+ const periodDefault = ref({ from: null, to: null })
842
+ const periodNoErrors = ref({ from: null, to: null })
843
+ const periodNoSuccess = ref({ from: null, to: null })
844
+ const periodNoValidation = ref({ from: null, to: null })
845
+ </script>`,
846
+ },
847
+ ],
806
848
  },
849
+ render: args => ({
850
+ components: { PeriodField },
851
+ setup() {
852
+ const periodDefault = ref({ from: null, to: null })
853
+ const periodNoErrors = ref({ from: null, to: null })
854
+ const periodNoSuccess = ref({ from: null, to: null })
855
+ const periodNoValidation = ref({ from: null, to: null })
856
+
857
+ return {
858
+ args,
859
+ periodDefault,
860
+ periodNoErrors,
861
+ periodNoSuccess,
862
+ periodNoValidation,
863
+ }
864
+ },
865
+ template: `
866
+ <div class="mb-8">
867
+ <h3 class="mb-4">Par défaut (avec validation)</h3>
868
+ <PeriodField
869
+ v-model="periodDefault"
870
+ required
871
+ />
872
+ </div>
873
+
874
+ <div class="mb-8">
875
+ <h3 class="mb-4">Validation désactivée (disableErrorHandling=true)</h3>
876
+ <PeriodField
877
+ v-model="periodNoErrors"
878
+ required
879
+ :disable-error-handling="true"
880
+ />
881
+ </div>
882
+
883
+ <div class="mb-8">
884
+ <h3 class="mb-4">Messages de succès désactivés (showSuccessMessages=false)</h3>
885
+ <PeriodField
886
+ v-model="periodNoSuccess"
887
+ required
888
+ :show-success-messages="false"
889
+ />
890
+ </div>
891
+
892
+ <div class="mb-8">
893
+ <h3 class="mb-4">Validation et messages de succès désactivés</h3>
894
+ <PeriodField
895
+ v-model="periodNoValidation"
896
+ required
897
+ :disable-error-handling="true"
898
+ :show-success-messages="false"
899
+ />
900
+ </div>
901
+ `,
902
+ }),
807
903
  }