@cnamts/synapse 1.0.0 → 1.0.1

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 (395) hide show
  1. package/dist/DateFilter-BmRuzQ9Z.js +98 -0
  2. package/dist/NumberFilter-CnIPDHqx.js +121 -0
  3. package/dist/PeriodFilter-CZwZ8CnQ.js +112 -0
  4. package/dist/SelectFilter-Cj-GW2Cc.js +97 -0
  5. package/dist/TextFilter-DTxZHJwX.js +114 -0
  6. package/dist/{components/BackBtn → common}/constants/ExpertiseLevelEnum.d.ts +3 -0
  7. package/dist/components/BackBtn/AccessibiliteItems.d.ts +1 -1
  8. package/dist/components/BackToTopBtn/AccessibiliteItems.d.ts +1 -1
  9. package/dist/components/ChipList/AccessibiliteItems.d.ts +1 -1
  10. package/dist/components/CollapsibleList/AccessibiliteItems.d.ts +1 -1
  11. package/dist/components/ContextualMenu/AccessibiliteItems.d.ts +1 -1
  12. package/dist/components/CookieBanner/AccessibiliteItems.d.ts +1 -1
  13. package/dist/components/CopyBtn/AccessibiliteItems.d.ts +1 -1
  14. package/dist/components/Customs/SyBtnSelect/AccessibiliteItems.d.ts +1 -1
  15. package/dist/components/Customs/SyInputSelect/AccessibiliteItems.d.ts +1 -1
  16. package/dist/components/Customs/SySelect/AccessibiliteItems.d.ts +1 -1
  17. package/dist/components/Customs/SyTextField/AccessibiliteItems.d.ts +1 -1
  18. package/dist/components/DataList/AccessibiliteItems.d.ts +1 -1
  19. package/dist/components/DataListGroup/AccessibiliteItems.d.ts +1 -1
  20. package/dist/components/DatePicker/AccessibiliteItems.d.ts +1 -1
  21. package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +4162 -0
  22. package/dist/components/DatePicker/{DatePicker.d.ts → DatePicker/DatePicker.d.ts} +142 -102
  23. package/dist/components/DatePicker/{DateTextInput.d.ts → DateTextInput/DateTextInput.d.ts} +32 -26
  24. package/dist/components/DatePicker/composables/index.d.ts +15 -0
  25. package/dist/components/DatePicker/composables/useDateFormatValidation.d.ts +25 -0
  26. package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +33 -0
  27. package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +16 -0
  28. package/dist/components/DatePicker/composables/useDatePickerVisibility.d.ts +27 -0
  29. package/dist/components/DatePicker/composables/useDateRangeInput.d.ts +29 -0
  30. package/dist/components/DatePicker/composables/useDateRangeValidation.d.ts +11 -0
  31. package/dist/components/DatePicker/composables/useDateSelection.d.ts +10 -0
  32. package/dist/components/DatePicker/composables/useDateValidation.d.ts +35 -0
  33. package/dist/components/DatePicker/composables/useDisplayedDateString.d.ts +16 -0
  34. package/dist/components/DatePicker/composables/useIconState.d.ts +17 -0
  35. package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +30 -0
  36. package/dist/components/DatePicker/composables/useInputHandler.d.ts +32 -0
  37. package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +33 -0
  38. package/dist/components/DatePicker/composables/useMonthButtonCustomization.d.ts +9 -0
  39. package/dist/components/DatePicker/composables/useTodayButton.d.ts +16 -0
  40. package/dist/components/DatePicker/composables/useWeekendDays.d.ts +11 -0
  41. package/dist/components/DatePicker/constants/messages.d.ts +29 -0
  42. package/dist/components/DatePicker/types.d.ts +13 -0
  43. package/dist/components/DialogBox/AccessibiliteItems.d.ts +1 -1
  44. package/dist/components/DownloadBtn/AccessibiliteItems.d.ts +1 -1
  45. package/dist/components/ErrorPage/AccessibiliteItems.d.ts +1 -1
  46. package/dist/components/ExternalLinks/AccessibiliteItems.d.ts +1 -1
  47. package/dist/components/FileList/AccessibiliteItems.d.ts +1 -1
  48. package/dist/components/FilePreview/AccessibiliteItems.d.ts +1 -1
  49. package/dist/components/FileUpload/AccessibiliteItems.d.ts +1 -1
  50. package/dist/components/FilterInline/AccessibiliteItems.d.ts +1 -1
  51. package/dist/components/FilterSideBar/AccessibiliteItems.d.ts +1 -1
  52. package/dist/components/FilterSideBar/FilterSideBar.d.ts +395 -1
  53. package/dist/components/FooterBar/AccessibiliteItems.d.ts +1 -1
  54. package/dist/components/FranceConnectBtn/AccessibiliteItems.d.ts +1 -1
  55. package/dist/components/HeaderBar/AccessibiliteItems.d.ts +1 -1
  56. package/dist/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.d.ts +1 -1
  57. package/dist/components/HeaderLoading/AccessibiliteItems.d.ts +1 -1
  58. package/dist/components/HeaderToolbar/AccessibiliteItems.d.ts +1 -1
  59. package/dist/components/LangBtn/AccessibiliteItems.d.ts +1 -1
  60. package/dist/components/Logo/AccessibiliteItems.d.ts +1 -1
  61. package/dist/components/LogoBrandSection/AccessibiliteItems.d.ts +1 -1
  62. package/dist/components/MaintenancePage/AccessibiliteItems.d.ts +1 -1
  63. package/dist/components/NirField/AccessibiliteItems.d.ts +1 -1
  64. package/dist/components/NotFoundPage/AccessibiliteItems.d.ts +1 -1
  65. package/dist/components/NotificationBar/AccessibiliteItems.d.ts +1 -1
  66. package/dist/components/PageContainer/AccessibiliteItems.d.ts +1 -1
  67. package/dist/components/PaginatedTable/AccessibiliteItems.d.ts +1 -1
  68. package/dist/components/PasswordField/AccessibiliteItems.d.ts +1 -1
  69. package/dist/components/PeriodField/AccessibiliteItems.d.ts +1 -1
  70. package/dist/components/PeriodField/PeriodField.d.ts +171 -37
  71. package/dist/components/PhoneField/AccessibiliteItems.d.ts +1 -1
  72. package/dist/components/RangeField/AccessibiliteItems.d.ts +1 -1
  73. package/dist/components/RatingPicker/AccessibiliteItems.d.ts +1 -1
  74. package/dist/components/SearchListField/AccessibiliteItems.d.ts +1 -1
  75. package/dist/components/SelectBtnField/AccessibiliteItems.d.ts +1 -1
  76. package/dist/components/SkipLink/AccessibiliteItems.d.ts +1 -1
  77. package/dist/components/SocialMediaLinks/AccessibiliteItems.d.ts +1 -1
  78. package/dist/components/SubHeader/AccessibiliteItems.d.ts +1 -1
  79. package/dist/components/SyAlert/AccessibiliteItems.d.ts +1 -1
  80. package/dist/components/TableToolbar/AccessibiliteItems.d.ts +1 -1
  81. package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +647 -0
  82. package/dist/components/Tables/SyTable/SyTable.d.ts +666 -0
  83. package/dist/components/Tables/common/SyTableFilter.d.ts +126 -0
  84. package/dist/components/Tables/common/TableHeader.d.ts +33 -0
  85. package/dist/components/Tables/common/constants/StateEnum.d.ts +6 -0
  86. package/dist/components/Tables/common/filters/DateFilter.d.ts +121 -0
  87. package/dist/components/Tables/common/filters/NumberFilter.d.ts +132 -0
  88. package/dist/components/Tables/common/filters/PeriodFilter.d.ts +135 -0
  89. package/dist/components/Tables/common/filters/SelectFilter.d.ts +120 -0
  90. package/dist/components/Tables/common/filters/TextFilter.d.ts +132 -0
  91. package/dist/components/Tables/common/formatters.d.ts +17 -0
  92. package/dist/components/Tables/common/locales.d.ts +7 -0
  93. package/dist/components/Tables/common/tableAccessibilityUtils.d.ts +8 -0
  94. package/dist/components/Tables/common/tableFilterUtils.d.ts +2 -0
  95. package/dist/components/Tables/common/tableStorageUtils.d.ts +29 -0
  96. package/dist/components/Tables/common/tableUtils.d.ts +42 -0
  97. package/dist/components/Tables/common/types.d.ts +80 -0
  98. package/dist/components/Tables/common/useTableFilter.d.ts +9 -0
  99. package/dist/components/Tables/index.d.ts +2 -0
  100. package/dist/components/UploadWorkflow/AccessibiliteItems.d.ts +1 -1
  101. package/dist/components/UserMenuBtn/AccessibiliteItems.d.ts +1 -1
  102. package/dist/components/index.d.ts +3 -1
  103. package/dist/design-system-v3.js +100 -11944
  104. package/dist/design-system-v3.umd.cjs +22 -4
  105. package/dist/designTokens/index.d.ts +3 -1
  106. package/dist/designTokens/tokens/cnam/cnamFonts.d.ts +140 -0
  107. package/dist/designTokens/tokens/pa/paFonts.d.ts +140 -0
  108. package/dist/designTokens/utils/createFontVariables.d.ts +39 -0
  109. package/dist/designTokens/utils/index.d.ts +2 -1
  110. package/dist/main-WDqeoGM-.js +14788 -0
  111. package/dist/style.css +1 -1
  112. package/dist/utils/rules/isRequired/index.d.ts +1 -1
  113. package/dist/vite-env.d.ts +12 -0
  114. package/package.json +3 -3
  115. package/src/assets/_spacers.scss +37 -1
  116. package/src/assets/_typography.scss +158 -0
  117. package/src/assets/settings.scss +7 -0
  118. package/src/common/constants/ExpertiseLevelEnum.ts +7 -0
  119. package/src/components/BackBtn/AccessibiliteItems.ts +1 -1
  120. package/src/components/BackToTopBtn/AccessibiliteItems.ts +1 -1
  121. package/src/components/ChipList/AccessibiliteItems.ts +1 -1
  122. package/src/components/CollapsibleList/AccessibiliteItems.ts +1 -1
  123. package/src/components/ContextualMenu/AccessibiliteItems.ts +1 -1
  124. package/src/components/CookieBanner/AccessibiliteItems.ts +1 -1
  125. package/src/components/CopyBtn/AccessibiliteItems.ts +1 -1
  126. package/src/components/Customs/SyBtnSelect/AccessibiliteItems.ts +1 -1
  127. package/src/components/Customs/SyInputSelect/AccessibiliteItems.ts +1 -1
  128. package/src/components/Customs/SySelect/AccessibiliteItems.ts +1 -1
  129. package/src/components/Customs/SySelect/SySelect.vue +3 -9
  130. package/src/components/Customs/SySelect/tests/SySelect.spec.ts +4 -2
  131. package/src/components/Customs/SyTextField/AccessibiliteItems.ts +1 -1
  132. package/src/components/DataList/AccessibiliteItems.ts +1 -1
  133. package/src/components/DataListGroup/AccessibiliteItems.ts +1 -1
  134. package/src/components/DatePicker/AccessibiliteItems.ts +1 -1
  135. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.mdx +212 -0
  136. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1097 -0
  137. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +497 -180
  138. package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +941 -0
  139. package/src/components/DatePicker/DatePicker/DatePicker.mdx +176 -0
  140. package/src/components/DatePicker/{tests → DatePicker}/DatePicker.spec.ts +1 -1
  141. package/src/components/DatePicker/{DatePicker.stories.ts → DatePicker/DatePicker.stories.ts} +115 -400
  142. package/src/components/DatePicker/{DatePicker.vue → DatePicker/DatePicker.vue} +302 -84
  143. package/src/components/DatePicker/DatePickerOverview.mdx +227 -0
  144. package/src/components/DatePicker/{DatePickerValidation.mdx → DatePickerValidationExample/DatePickerValidation.mdx} +3 -3
  145. package/src/components/DatePicker/{DatePickerValidation.stories.ts → DatePickerValidationExample/DatePickerValidation.stories.ts} +2 -2
  146. package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +310 -0
  147. package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +278 -0
  148. package/src/components/DatePicker/{tests → DateTextInput}/DateTextInput.spec.ts +8 -7
  149. package/src/components/DatePicker/DateTextInput/DateTextInput.vue +916 -0
  150. package/src/components/DatePicker/DateTextInput/NoCalendar.mdx +64 -0
  151. package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +572 -0
  152. package/src/components/DatePicker/composables/index.ts +22 -0
  153. package/src/components/DatePicker/composables/tests/useDateFormatValidation.spec.ts +165 -0
  154. package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +359 -0
  155. package/src/components/DatePicker/composables/tests/useDatePickerViewMode.spec.ts +160 -0
  156. package/src/components/DatePicker/composables/tests/useDatePickerVisibility.spec.ts +339 -0
  157. package/src/components/DatePicker/composables/tests/useDateRangeInput.spec.ts +277 -0
  158. package/src/components/DatePicker/composables/tests/useDateRangeValidation.spec.ts +107 -0
  159. package/src/components/DatePicker/composables/tests/useDateSelection.spec.ts +171 -0
  160. package/src/components/DatePicker/composables/tests/useDateValidation.spec.ts +245 -0
  161. package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +98 -0
  162. package/src/components/DatePicker/composables/tests/useIconState.spec.ts +130 -0
  163. package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +278 -0
  164. package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +233 -0
  165. package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +100 -0
  166. package/src/components/DatePicker/composables/tests/useTodayButton.spec.ts +97 -0
  167. package/src/components/DatePicker/composables/tests/useWeekendDays.spec.ts +28 -0
  168. package/src/components/DatePicker/composables/useDateFormatValidation.ts +95 -0
  169. package/src/components/DatePicker/composables/useDateInputEditing.ts +326 -0
  170. package/src/components/DatePicker/composables/useDatePickerViewMode.ts +61 -0
  171. package/src/components/DatePicker/composables/useDatePickerVisibility.ts +146 -0
  172. package/src/components/DatePicker/composables/useDateRangeInput.ts +375 -0
  173. package/src/components/DatePicker/composables/useDateRangeValidation.ts +48 -0
  174. package/src/components/DatePicker/composables/useDateSelection.ts +121 -0
  175. package/src/components/DatePicker/composables/useDateValidation.ts +225 -0
  176. package/src/components/DatePicker/composables/useDisplayedDateString.ts +58 -0
  177. package/src/components/DatePicker/composables/useIconState.ts +53 -0
  178. package/src/components/DatePicker/composables/useInputBlurHandler.ts +101 -0
  179. package/src/components/DatePicker/composables/useInputHandler.ts +436 -0
  180. package/src/components/DatePicker/composables/useManualDateValidation.ts +161 -0
  181. package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +89 -0
  182. package/src/components/DatePicker/composables/useTodayButton.ts +43 -0
  183. package/src/components/DatePicker/composables/useWeekendDays.ts +21 -0
  184. package/src/components/DatePicker/constants/messages.ts +50 -0
  185. package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +4 -4
  186. package/src/components/DatePicker/docExamples/DatePickerValidationExamples.vue +1 -1
  187. package/src/components/DatePicker/playground/ComplexDatePickerPlayground.vue +172 -0
  188. package/src/components/DatePicker/types.ts +15 -0
  189. package/src/components/DialogBox/AccessibiliteItems.ts +1 -1
  190. package/src/components/DownloadBtn/AccessibiliteItems.ts +1 -1
  191. package/src/components/ErrorPage/AccessibiliteItems.ts +1 -1
  192. package/src/components/ExternalLinks/AccessibiliteItems.ts +1 -1
  193. package/src/components/FileList/AccessibiliteItems.ts +1 -1
  194. package/src/components/FilePreview/AccessibiliteItems.ts +1 -1
  195. package/src/components/FileUpload/AccessibiliteItems.ts +1 -1
  196. package/src/components/FilterInline/AccessibiliteItems.ts +1 -1
  197. package/src/components/FilterSideBar/AccessibiliteItems.ts +1 -1
  198. package/src/components/FilterSideBar/FilterSideBar.vue +108 -90
  199. package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +27 -0
  200. package/src/components/FilterSideBar/tests/__snapshots__/FilterSideBar.spec.ts.snap +114 -109
  201. package/src/components/FooterBar/AccessibiliteItems.ts +1 -1
  202. package/src/components/FooterBar/FooterBar.vue +2 -1
  203. package/src/components/FranceConnectBtn/AccessibiliteItems.ts +1 -1
  204. package/src/components/HeaderBar/AccessibiliteItems.ts +1 -1
  205. package/src/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.ts +1 -1
  206. package/src/components/HeaderLoading/AccessibiliteItems.ts +1 -1
  207. package/src/components/HeaderToolbar/AccessibiliteItems.ts +1 -1
  208. package/src/components/LangBtn/AccessibiliteItems.ts +1 -1
  209. package/src/components/Logo/Accessibilite.stories.ts +4 -0
  210. package/src/components/Logo/AccessibiliteItems.ts +1 -1
  211. package/src/components/LogoBrandSection/AccessibiliteItems.ts +1 -1
  212. package/src/components/MaintenancePage/AccessibiliteItems.ts +1 -1
  213. package/src/components/NirField/AccessibiliteItems.ts +1 -1
  214. package/src/components/NotFoundPage/AccessibiliteItems.ts +1 -1
  215. package/src/components/NotificationBar/AccessibiliteItems.ts +1 -1
  216. package/src/components/PageContainer/AccessibiliteItems.ts +1 -1
  217. package/src/components/PaginatedTable/AccessibiliteItems.ts +1 -1
  218. package/src/components/PaginatedTable/PaginatedTable.stories.ts +19 -0
  219. package/src/components/PaginatedTable/PaginatedTable.vue +51 -13
  220. package/src/components/PaginatedTable/tests/PaginatedTable.spec.ts +0 -2
  221. package/src/components/PasswordField/AccessibiliteItems.ts +1 -1
  222. package/src/components/PeriodField/AccessibiliteItems.ts +1 -1
  223. package/src/components/PeriodField/PeriodField.vue +13 -1
  224. package/src/components/PhoneField/AccessibiliteItems.ts +1 -1
  225. package/src/components/RangeField/AccessibiliteItems.ts +1 -1
  226. package/src/components/RatingPicker/AccessibiliteItems.ts +1 -1
  227. package/src/components/SearchListField/AccessibiliteItems.ts +1 -1
  228. package/src/components/SelectBtnField/AccessibiliteItems.ts +1 -1
  229. package/src/components/SkipLink/AccessibiliteItems.ts +1 -1
  230. package/src/components/SocialMediaLinks/AccessibiliteItems.ts +1 -1
  231. package/src/components/SubHeader/AccessibiliteItems.ts +1 -1
  232. package/src/components/SyAlert/AccessibiliteItems.ts +1 -1
  233. package/src/components/TableToolbar/AccessibiliteItems.ts +1 -1
  234. package/src/components/TableToolbar/TableToolbar.stories.ts +110 -56
  235. package/src/components/Tables/SyServerTable/FilterRules.stories.ts +83 -0
  236. package/src/components/Tables/SyServerTable/SyServerTable.mdx +160 -0
  237. package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +2887 -0
  238. package/src/components/Tables/SyServerTable/SyServerTable.vue +302 -0
  239. package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +450 -0
  240. package/src/components/Tables/SyServerTable/tests/__snapshots__/SyServerTable.spec.ts.snap +521 -0
  241. package/src/components/Tables/SyTable/FilterRules.stories.ts +235 -0
  242. package/src/components/Tables/SyTable/SyTable.mdx +129 -0
  243. package/src/components/Tables/SyTable/SyTable.stories.ts +1966 -0
  244. package/src/components/Tables/SyTable/SyTable.vue +317 -0
  245. package/src/components/Tables/SyTable/tests/SyTable.spec.ts +345 -0
  246. package/src/components/Tables/SyTable/tests/__snapshots__/SyTable.spec.ts.snap +521 -0
  247. package/src/components/Tables/common/SyTableFilter.vue +342 -0
  248. package/src/components/Tables/common/TableHeader.vue +221 -0
  249. package/src/components/Tables/common/constants/StateEnum.ts +6 -0
  250. package/src/components/Tables/common/filters/DateFilter.vue +140 -0
  251. package/src/components/Tables/common/filters/NumberFilter.vue +234 -0
  252. package/src/components/Tables/common/filters/PeriodFilter.vue +147 -0
  253. package/src/components/Tables/common/filters/SelectFilter.vue +126 -0
  254. package/src/components/Tables/common/filters/TextFilter.vue +191 -0
  255. package/src/components/Tables/common/filters/tests/DateFilter.spec.ts +187 -0
  256. package/src/components/Tables/common/filters/tests/NumberFilter.spec.ts +280 -0
  257. package/src/components/Tables/common/filters/tests/PeriodFilter.spec.ts +192 -0
  258. package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +219 -0
  259. package/src/components/Tables/common/filters/tests/TextFilter.spec.ts +260 -0
  260. package/src/components/Tables/common/formatters.ts +72 -0
  261. package/src/components/Tables/common/locales.ts +7 -0
  262. package/src/components/Tables/common/tableAccessibilityUtils.ts +61 -0
  263. package/src/components/Tables/common/tableFilterUtils.ts +327 -0
  264. package/src/components/Tables/common/tableStorageUtils.ts +102 -0
  265. package/src/components/Tables/common/tableStyles.scss +54 -0
  266. package/src/components/Tables/common/tableUtils.ts +115 -0
  267. package/src/components/Tables/common/tests/SyTableFilter.spec.ts +312 -0
  268. package/src/components/Tables/common/tests/resize.spec.ts +161 -0
  269. package/src/components/Tables/common/tests/tableFilterUtils.spec.ts +106 -0
  270. package/src/components/Tables/common/tests/tableUtils.spec.ts +272 -0
  271. package/src/components/Tables/common/types.ts +81 -0
  272. package/src/components/Tables/common/useTableFilter.ts +19 -0
  273. package/src/components/Tables/index.ts +3 -0
  274. package/src/components/UploadWorkflow/AccessibiliteItems.ts +1 -1
  275. package/src/components/UserMenuBtn/AccessibiliteItems.ts +1 -1
  276. package/src/components/index.ts +3 -1
  277. package/src/composables/date/useDateFormatDayjs.ts +8 -3
  278. package/src/composables/date/useDateInitializationDayjs.ts +28 -36
  279. package/src/composables/rules/useFieldValidation.ts +1 -2
  280. package/src/designTokens/index.ts +4 -0
  281. package/src/designTokens/tokens/cnam/cnamFonts.ts +140 -0
  282. package/src/designTokens/tokens/pa/paFonts.ts +140 -0
  283. package/src/designTokens/utils/createFontVariables.ts +143 -0
  284. package/src/designTokens/utils/index.ts +2 -1
  285. package/src/stories/Demarrer/Accueil.stories.ts +12 -3
  286. package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +1 -1
  287. package/src/utils/rules/isRequired/index.ts +2 -1
  288. package/src/vite-env.d.ts +12 -0
  289. package/src/vuetifyConfig.ts +10 -3
  290. package/dist/components/BackToTopBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  291. package/dist/components/ChipList/constants/ExpertiseLevelEnum.d.ts +0 -4
  292. package/dist/components/CollapsibleList/constants/ExpertiseLevelEnum.d.ts +0 -4
  293. package/dist/components/ContextualMenu/constants/ExpertiseLevelEnum.d.ts +0 -4
  294. package/dist/components/CookieBanner/constants/ExpertiseLevelEnum.d.ts +0 -4
  295. package/dist/components/CopyBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  296. package/dist/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.d.ts +0 -4
  297. package/dist/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.d.ts +0 -4
  298. package/dist/components/Customs/SySelect/constants/ExpertiseLevelEnum.d.ts +0 -4
  299. package/dist/components/Customs/SyTextField/constants/ExpertiseLevelEnum.d.ts +0 -4
  300. package/dist/components/DataList/constants/ExpertiseLevelEnum.d.ts +0 -4
  301. package/dist/components/DataListGroup/constants/ExpertiseLevelEnum.d.ts +0 -4
  302. package/dist/components/DatePicker/constants/ExpertiseLevelEnum.d.ts +0 -4
  303. package/dist/components/DialogBox/constants/ExpertiseLevelEnum.d.ts +0 -4
  304. package/dist/components/DownloadBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  305. package/dist/components/ErrorPage/constants/ExpertiseLevelEnum.d.ts +0 -4
  306. package/dist/components/ExternalLinks/constants/ExpertiseLevelEnum.d.ts +0 -4
  307. package/dist/components/FileList/constants/ExpertiseLevelEnum.d.ts +0 -4
  308. package/dist/components/FilePreview/constants/ExpertiseLevelEnum.d.ts +0 -4
  309. package/dist/components/FileUpload/constants/ExpertiseLevelEnum.d.ts +0 -4
  310. package/dist/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +0 -4
  311. package/dist/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  312. package/dist/components/FooterBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  313. package/dist/components/FranceConnectBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  314. package/dist/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.d.ts +0 -4
  315. package/dist/components/HeaderBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  316. package/dist/components/HeaderLoading/constants/ExpertiseLevelEnum.d.ts +0 -4
  317. package/dist/components/HeaderToolbar/constants/ExpertiseLevelEnum.d.ts +0 -4
  318. package/dist/components/LangBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  319. package/dist/components/Logo/constants/ExpertiseLevelEnum.d.ts +0 -4
  320. package/dist/components/LogoBrandSection/constants/ExpertiseLevelEnum.d.ts +0 -4
  321. package/dist/components/MaintenancePage/constants/ExpertiseLevelEnum.d.ts +0 -4
  322. package/dist/components/NirField/constants/ExpertiseLevelEnum.d.ts +0 -4
  323. package/dist/components/NotFoundPage/constants/ExpertiseLevelEnum.d.ts +0 -4
  324. package/dist/components/NotificationBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  325. package/dist/components/PageContainer/constants/ExpertiseLevelEnum.d.ts +0 -4
  326. package/dist/components/PaginatedTable/constants/ExpertiseLevelEnum.d.ts +0 -4
  327. package/dist/components/PasswordField/constants/ExpertiseLevelEnum.d.ts +0 -4
  328. package/dist/components/PeriodField/constants/ExpertiseLevelEnum.d.ts +0 -4
  329. package/dist/components/PhoneField/constants/ExpertiseLevelEnum.d.ts +0 -4
  330. package/dist/components/RangeField/constants/ExpertiseLevelEnum.d.ts +0 -4
  331. package/dist/components/RatingPicker/constants/ExpertiseLevelEnum.d.ts +0 -4
  332. package/dist/components/SearchListField/constants/ExpertiseLevelEnum.d.ts +0 -4
  333. package/dist/components/SelectBtnField/constants/ExpertiseLevelEnum.d.ts +0 -4
  334. package/dist/components/SkipLink/constants/ExpertiseLevelEnum.d.ts +0 -4
  335. package/dist/components/SocialMediaLinks/constants/ExpertiseLevelEnum.d.ts +0 -4
  336. package/dist/components/SubHeader/constants/ExpertiseLevelEnum.d.ts +0 -4
  337. package/dist/components/SyAlert/constants/ExpertiseLevelEnum.d.ts +0 -4
  338. package/dist/components/TableToolbar/constants/ExpertiseLevelEnum.d.ts +0 -4
  339. package/dist/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +0 -4
  340. package/dist/components/UserMenuBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  341. package/src/components/BackBtn/constants/ExpertiseLevelEnum.ts +0 -4
  342. package/src/components/BackToTopBtn/constants/ExpertiseLevelEnum.ts +0 -4
  343. package/src/components/ChipList/constants/ExpertiseLevelEnum.ts +0 -4
  344. package/src/components/CollapsibleList/constants/ExpertiseLevelEnum.ts +0 -4
  345. package/src/components/ContextualMenu/constants/ExpertiseLevelEnum.ts +0 -4
  346. package/src/components/CookieBanner/constants/ExpertiseLevelEnum.ts +0 -4
  347. package/src/components/CopyBtn/constants/ExpertiseLevelEnum.ts +0 -4
  348. package/src/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.ts +0 -4
  349. package/src/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.ts +0 -4
  350. package/src/components/Customs/SySelect/constants/ExpertiseLevelEnum.ts +0 -4
  351. package/src/components/Customs/SyTextField/constants/ExpertiseLevelEnum.ts +0 -4
  352. package/src/components/DataList/constants/ExpertiseLevelEnum.ts +0 -4
  353. package/src/components/DataListGroup/constants/ExpertiseLevelEnum.ts +0 -4
  354. package/src/components/DatePicker/DatePicker.mdx +0 -222
  355. package/src/components/DatePicker/DateTextInput.vue +0 -504
  356. package/src/components/DatePicker/constants/ExpertiseLevelEnum.ts +0 -4
  357. package/src/components/DialogBox/constants/ExpertiseLevelEnum.ts +0 -4
  358. package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +0 -4
  359. package/src/components/ErrorPage/constants/ExpertiseLevelEnum.ts +0 -4
  360. package/src/components/ExternalLinks/constants/ExpertiseLevelEnum.ts +0 -4
  361. package/src/components/FileList/constants/ExpertiseLevelEnum.ts +0 -4
  362. package/src/components/FilePreview/constants/ExpertiseLevelEnum.ts +0 -4
  363. package/src/components/FileUpload/constants/ExpertiseLevelEnum.ts +0 -4
  364. package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +0 -4
  365. package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +0 -4
  366. package/src/components/FooterBar/constants/ExpertiseLevelEnum.ts +0 -4
  367. package/src/components/FranceConnectBtn/constants/ExpertiseLevelEnum.ts +0 -4
  368. package/src/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.ts +0 -4
  369. package/src/components/HeaderBar/constants/ExpertiseLevelEnum.ts +0 -4
  370. package/src/components/HeaderLoading/constants/ExpertiseLevelEnum.ts +0 -4
  371. package/src/components/HeaderToolbar/constants/ExpertiseLevelEnum.ts +0 -4
  372. package/src/components/LangBtn/constants/ExpertiseLevelEnum.ts +0 -4
  373. package/src/components/Logo/constants/ExpertiseLevelEnum.ts +0 -4
  374. package/src/components/LogoBrandSection/constants/ExpertiseLevelEnum.ts +0 -4
  375. package/src/components/MaintenancePage/constants/ExpertiseLevelEnum.ts +0 -4
  376. package/src/components/NirField/constants/ExpertiseLevelEnum.ts +0 -4
  377. package/src/components/NotFoundPage/constants/ExpertiseLevelEnum.ts +0 -4
  378. package/src/components/NotificationBar/constants/ExpertiseLevelEnum.ts +0 -4
  379. package/src/components/PageContainer/constants/ExpertiseLevelEnum.ts +0 -4
  380. package/src/components/PaginatedTable/constants/ExpertiseLevelEnum.ts +0 -4
  381. package/src/components/PasswordField/constants/ExpertiseLevelEnum.ts +0 -4
  382. package/src/components/PeriodField/constants/ExpertiseLevelEnum.ts +0 -4
  383. package/src/components/PhoneField/constants/ExpertiseLevelEnum.ts +0 -4
  384. package/src/components/RangeField/constants/ExpertiseLevelEnum.ts +0 -4
  385. package/src/components/RatingPicker/constants/ExpertiseLevelEnum.ts +0 -4
  386. package/src/components/SearchListField/constants/ExpertiseLevelEnum.ts +0 -4
  387. package/src/components/SelectBtnField/constants/ExpertiseLevelEnum.ts +0 -4
  388. package/src/components/SkipLink/constants/ExpertiseLevelEnum.ts +0 -4
  389. package/src/components/SocialMediaLinks/constants/ExpertiseLevelEnum.ts +0 -4
  390. package/src/components/SubHeader/constants/ExpertiseLevelEnum.ts +0 -4
  391. package/src/components/SyAlert/constants/ExpertiseLevelEnum.ts +0 -4
  392. package/src/components/TableToolbar/constants/ExpertiseLevelEnum.ts +0 -4
  393. package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +0 -4
  394. package/src/components/UserMenuBtn/constants/ExpertiseLevelEnum.ts +0 -4
  395. /package/src/components/DatePicker/{examples → playground}/DatePickerHolidayRule.vue +0 -0
@@ -1,12 +1,32 @@
1
1
  <script lang="ts" setup>
2
- import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick, type ComponentPublicInstance } from 'vue'
2
+ import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick, type ComponentPublicInstance, type Ref } from 'vue'
3
3
  import SyTextField from '@/components/Customs/SyTextField/SyTextField.vue'
4
- import DateTextInput from '../DateTextInput.vue'
4
+ import DateTextInput from '../DateTextInput/DateTextInput.vue'
5
5
  import { VDatePicker } from 'vuetify/components'
6
+ import { useInputHandler } from '../composables/useInputHandler'
6
7
  import { useValidation } from '@/composables/validation/useValidation'
7
8
  import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
8
- import { useDateInitialization, type DateValue, type DateInput } from '@/composables/date/useDateInitializationDayjs'
9
+ import { useDateInitialization, type DateInput, type DateValue } from '@/composables/date/useDateInitializationDayjs'
10
+ import type { DateObjectValue } from '../types'
9
11
  import { useDatePickerAccessibility } from '@/composables/date/useDatePickerAccessibility'
12
+ import { DATE_PICKER_MESSAGES } from '../constants/messages'
13
+ import { useMonthButtonCustomization } from '../composables'
14
+ import { mdiCalendar } from '@mdi/js'
15
+ import {
16
+ useWeekendDays,
17
+ useTodayButton,
18
+ useDatePickerViewMode,
19
+ useDateSelection,
20
+ useDateRangeValidation,
21
+ useDateFormatValidation,
22
+ useIconState,
23
+ useDateValidation,
24
+ useManualDateValidation,
25
+ useInputBlurHandler,
26
+ useDatePickerVisibility,
27
+ useDisplayedDateString,
28
+ } from '../composables'
29
+
10
30
  import dayjs from 'dayjs'
11
31
  import customParseFormat from 'dayjs/plugin/customParseFormat'
12
32
 
@@ -23,6 +43,7 @@
23
43
  format?: string
24
44
  dateFormatReturn?: string
25
45
  isBirthDate?: boolean
46
+ birthDate?: boolean // Alias pour isBirthDate pour compatibilité avec l'attribut kebab-case birth-date
26
47
  showWeekNumber?: boolean
27
48
  required?: boolean
28
49
  displayRange?: boolean
@@ -43,12 +64,19 @@
43
64
  showSuccessMessages?: boolean
44
65
  bgColor?: string
45
66
  textFieldActivator?: boolean
67
+ displayTodayButton?: boolean
68
+ displayWeekendDays?: boolean
69
+ period?: {
70
+ min?: string
71
+ max?: string
72
+ }
46
73
  }>(), {
47
74
  modelValue: undefined,
48
- placeholder: 'Sélectionner une date',
49
- format: 'DD/MM/YYYY',
75
+ placeholder: DATE_PICKER_MESSAGES.PLACEHOLDER_DEFAULT,
76
+ format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
50
77
  dateFormatReturn: '',
51
78
  isBirthDate: false,
79
+ birthDate: false,
52
80
  showWeekNumber: false,
53
81
  required: false,
54
82
  displayRange: false,
@@ -67,6 +95,12 @@
67
95
  showSuccessMessages: true,
68
96
  bgColor: undefined,
69
97
  textFieldActivator: false,
98
+ displayTodayButton: true,
99
+ displayWeekendDays: true,
100
+ period: () => ({
101
+ min: '',
102
+ max: '',
103
+ }),
70
104
  })
71
105
 
72
106
  const emit = defineEmits<{
@@ -74,12 +108,18 @@
74
108
  (e: 'closed'): void
75
109
  (e: 'focus'): void
76
110
  (e: 'blur'): void
111
+ (e: 'input', value: string): void
112
+ (e: 'date-selected', value: DateValue): void
77
113
  }>()
78
114
 
79
- const selectedDates = ref<Date | Date[] | null>(
115
+ // Utilisation du composable pour la saisie manuelle des plages de dates
116
+ const selectedDates = ref<Date | (Date | null)[] | null>(
80
117
  initializeSelectedDates(props.modelValue as DateInput | null, props.format, props.dateFormatReturn),
81
118
  )
82
119
 
120
+ // Utilisation du composable pour la validation des plages de dates
121
+ const { currentRangeIsValid, getRangeValidationError } = useDateRangeValidation(selectedDates as Ref<DateObjectValue>, props.displayRange)
122
+
83
123
  const isDatePickerVisible = ref(false)
84
124
  const validation = useValidation({
85
125
  showSuccessMessages: props.showSuccessMessages,
@@ -90,61 +130,48 @@
90
130
  })
91
131
  const { errors, warnings, successes, validateField, clearValidation } = validation
92
132
 
93
- const errorMessages = errors
94
- const warningMessages = warnings
95
- const successMessages = successes
133
+ const errorMessages = computed(() => errors.value)
134
+ const warningMessages = computed(() => warnings.value)
135
+ const successMessages = computed(() => successes.value)
96
136
  const displayFormattedDate = ref('')
97
137
 
98
138
  const textInputValue = ref<string>('')
99
139
 
140
+ // Variables pour la gestion de la saisie manuelle
141
+ const isManualInputActive = ref(false)
142
+ const isFormatting = ref(false)
143
+
100
144
  // Variable pour éviter les mises à jour récursives
101
145
  const isUpdatingFromInternal = ref(false)
146
+ // Variable pour suivre si l'utilisateur a interagi avec le champ
147
+ const hasInteracted = ref(false)
148
+
149
+ const { validateDateFormat, isDateComplete } = useDateFormatValidation({
150
+ format: props.format,
151
+ dateFormatReturn: props.dateFormatReturn,
152
+ required: props.required,
153
+ hasInteracted,
154
+ disableErrorHandling: props.disableErrorHandling,
155
+ })
102
156
 
103
- // Fonction pour valider les dates
104
- const validateDates = (forceValidation = false) => {
105
- if (props.noCalendar) {
106
- // En mode no-calendar, on délègue la validation au DateTextInput
107
- return
108
- }
109
-
110
- // Réinitialiser la validation
111
- clearValidation()
112
-
113
- // Si la gestion des erreurs est désactivée, on effectue la validation interne
114
- // mais on n'ajoute pas les messages d'erreur
115
- const shouldDisplayErrors = !props.disableErrorHandling
116
-
117
- // Vérifier si le champ est requis et vide
118
- if ((forceValidation || !isUpdatingFromInternal.value) && props.required && (!selectedDates.value || (Array.isArray(selectedDates.value) && selectedDates.value.length === 0))) {
119
- if (shouldDisplayErrors) {
120
- errors.value.push('La date est requise.')
121
- }
122
- return
123
- }
124
-
125
- if (!selectedDates.value) return
126
-
127
- // Préparer les dates à valider
128
- const datesToValidate = Array.isArray(selectedDates.value)
129
- ? selectedDates.value
130
- : [selectedDates.value]
131
-
132
- // Valider chaque date
133
- if (shouldDisplayErrors) {
134
- datesToValidate.forEach((date) => {
135
- validateField(
136
- date,
137
- props.customRules,
138
- props.customWarningRules,
139
- )
140
- })
141
-
142
- // Dédoublonner les messages (au cas où plusieurs dates auraient les mêmes messages)
143
- errors.value = [...new Set(errors.value)]
144
- warnings.value = [...new Set(warnings.value)]
145
- successes.value = [...new Set(successes.value)]
146
- }
147
- }
157
+ // pour valider les dates
158
+ const { validateDates, validateOnSubmit } = useDateValidation({
159
+ noCalendar: props.noCalendar,
160
+ required: props.required,
161
+ displayRange: props.displayRange,
162
+ disableErrorHandling: props.disableErrorHandling,
163
+ customRules: props.customRules,
164
+ customWarningRules: props.customWarningRules,
165
+ selectedDates,
166
+ isUpdatingFromInternal,
167
+ currentRangeIsValid,
168
+ getRangeValidationError,
169
+ clearValidation,
170
+ validateField,
171
+ errors,
172
+ warnings,
173
+ successes,
174
+ })
148
175
 
149
176
  // Fonction centralisée pour mettre à jour le modèle
150
177
  const updateModel = (value: DateValue) => {
@@ -210,17 +237,45 @@
210
237
  'min-width': '100%',
211
238
  }))
212
239
 
240
+ // Déclaration des variables qui seront initialisées par le composable useDateSelection
241
+ const rangeBoundaryDates = ref<[Date | null, Date | null] | null>(null)
242
+ // Initialisation des variables après la déclaration de selectedDates
243
+ const dateSelectionResult = useDateSelection(
244
+ parseDate,
245
+ selectedDates,
246
+ props.format,
247
+ props.displayRange,
248
+ )
249
+
250
+ // Assignation des fonctions et variables retournées par le composable
251
+ // Utiliser une fonction pour wrapper updateSelectedDates afin de maintenir la compatibilité avec le template
252
+ const updateSelectedDates = (date: Date | null) => {
253
+ dateSelectionResult.updateSelectedDates(date)
254
+ }
255
+ // generateDateRange est maintenant utilisé via le composable useInputHandler
256
+ // Synchroniser notre référence locale avec celle du composable
257
+ watch(() => dateSelectionResult.rangeBoundaryDates.value, (newValue) => {
258
+ rangeBoundaryDates.value = newValue
259
+ }, { immediate: true })
260
+
213
261
  // Date(s) formatée(s) en chaîne de caractères pour la valeur de retour
214
262
  const formattedDate = computed<DateValue>(() => {
215
263
  if (!selectedDates.value) return ''
216
264
 
217
265
  const returnFormat = props.dateFormatReturn || props.format
218
266
 
219
- if (Array.isArray(selectedDates.value)) {
267
+ // Pour les plages de dates, utiliser rangeBoundaryDates s'il est disponible
268
+ if (props.displayRange && rangeBoundaryDates.value) {
269
+ return [
270
+ formatDate(rangeBoundaryDates.value[0], returnFormat),
271
+ formatDate(rangeBoundaryDates.value[1], returnFormat),
272
+ ] as [string, string]
273
+ }
274
+ else if (Array.isArray(selectedDates.value)) {
220
275
  if (selectedDates.value.length >= 2) {
221
276
  return [
222
277
  formatDate(selectedDates.value[0], returnFormat),
223
- formatDate(selectedDates.value[1], returnFormat),
278
+ formatDate(selectedDates.value[selectedDates.value.length - 1], returnFormat),
224
279
  ] as [string, string]
225
280
  }
226
281
  return ''
@@ -331,46 +386,28 @@
331
386
  const updateDisplayFormattedDate = () => {
332
387
  if (displayFormattedDateComputed.value) {
333
388
  displayFormattedDate.value = displayFormattedDateComputed.value
334
- }
335
- }
336
-
337
- const updateSelectedDates = (input: DateValue) => {
338
- if (Array.isArray(input)) {
339
- const dates = input
340
- .map(date => (date ? parseDate(date, props.format) : null))
341
- .filter((date): date is Date => date !== null)
342
-
343
- if (dates.length === 0) {
344
- selectedDates.value = null
345
- return
389
+ // Émettre l'événement date-selected pour indiquer qu'une date a été sélectionnée dans le calendrier
390
+ emit('date-selected', formattedDate.value)
391
+
392
+ // En mode plage, ne pas fermer le DatePicker après la sélection de la première date
393
+ // Vérifier si nous sommes en mode plage et si les deux dates sont sélectionnées
394
+ if (!props.displayRange || (props.displayRange && rangeBoundaryDates.value && rangeBoundaryDates.value[0] && rangeBoundaryDates.value[1])) {
395
+ // Fermer le DatePicker seulement si nous ne sommes pas en mode plage
396
+ // ou si les deux dates de la plage sont déjà sélectionnées
397
+ isDatePickerVisible.value = false
398
+ emit('closed')
346
399
  }
347
-
348
- selectedDates.value = dates
349
- return
400
+ validateDates()
350
401
  }
351
-
352
- const date = input ? parseDate(input, props.format) : null
353
- selectedDates.value = date === null ? null : date
354
402
  }
355
403
 
356
- // Gestionnaire de clic en dehors
357
- const handleClickOutside = (event: MouseEvent) => {
358
- if (!isDatePickerVisible.value) return
404
+ // Les variables useDateSelection sont maintenant déclarées et initialisées plus haut dans le code
359
405
 
360
- const target = event.target as HTMLElement
361
- const container = target.closest('.date-picker-container')
362
-
363
- // Si on clique dans le conteneur du DatePicker, on ne fait rien
364
- if (container) return
365
- emit('closed')
366
- // Déclencher la validation à la fermeture
367
- validateDates()
406
+ // Fonction pour émettre l'événement blur (utilisée pour les tests)
407
+ const emitBlurEvent = () => {
408
+ emit('blur')
368
409
  }
369
410
 
370
- const todayInString = computed(() => {
371
- return dayjs().locale('fr').format('dddd D MMMM').replace(/\b\w/g, l => l.toUpperCase())
372
- })
373
-
374
411
  onMounted(() => {
375
412
  document.addEventListener('click', handleClickOutside)
376
413
 
@@ -381,6 +418,9 @@
381
418
 
382
419
  // Valider les dates au montage
383
420
  validateDates()
421
+
422
+ // Configurer l'observateur pour le bouton du mois
423
+ setupMonthButtonObserver()
384
424
  })
385
425
 
386
426
  onBeforeUnmount(() => {
@@ -389,66 +429,96 @@
389
429
 
390
430
  const dateTextInputRef = ref<null | ComponentPublicInstance<typeof DateTextInput>>()
391
431
  const dateCalendarTextInputRef = ref<null | ComponentPublicInstance<typeof SyTextField>>()
392
- const datePickerRef = ref<null | ComponentPublicInstance<typeof VDatePicker>>()
393
432
 
394
- const validateOnSubmit = () => {
395
- if (props.noCalendar) {
396
- return dateTextInputRef.value?.validateOnSubmit()
397
- }
398
- // Forcer la validation pour ignorer les conditions de validation interactive
399
- validateDates(true)
400
- // Retourner directement un booléen pour maintenir la compatibilité avec les tests existants
401
- return errors.value.length === 0
402
- }
433
+ // Initialiser le composable useInputHandler pour gérer la saisie des dates
434
+ const inputHandler = useInputHandler({
435
+ format: props.format,
436
+ displayRange: props.displayRange,
437
+ dateFormatReturn: props.dateFormatReturn,
438
+ disableErrorHandling: props.disableErrorHandling,
439
+ parseDate,
440
+ formatDate,
441
+ generateDateRange: dateSelectionResult.generateDateRange,
442
+ isDateComplete: isDateComplete.value,
443
+ displayFormattedDate,
444
+ selectedDates,
445
+ isFormatting,
446
+ isManualInputActive,
447
+ isUpdatingFromInternal,
448
+ clearValidation,
449
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- validation rules
450
+ validateField: (value, rules, warningRules) => validateField(value, rules as any[], warningRules as any[]),
451
+ updateModel: value => updateModel(value as DateValue),
452
+ emitInput: value => emit('input', value),
453
+ inputRef: dateCalendarTextInputRef as Ref<ComponentPublicInstance | null>,
454
+ })
403
455
 
404
- const openDatePicker = () => {
405
- if (!isDatePickerVisible.value) {
406
- toggleDatePicker()
407
- }
456
+ /**
457
+ * Gère l'entrée utilisateur dans le champ de saisie de date
458
+ * Délègue le traitement au composable useInputHandler
459
+ */
460
+ const handleInput = (event: Event) => {
461
+ // Utiliser la fonction handleInput du composable
462
+ inputHandler.handleInput(event)
408
463
  }
464
+ const datePickerRef = ref<null | ComponentPublicInstance<typeof VDatePicker>>()
409
465
 
410
- type ViewMode = 'month' | 'year' | 'months' | undefined
411
-
412
- // Variable pour suivre le mode d'affichage actuel du DatePicker
413
- const currentViewMode = ref<ViewMode>(props.isBirthDate ? 'year' : 'month')
414
-
415
- watch(() => props.isBirthDate, (newValue) => {
416
- currentViewMode.value = newValue ? 'year' : 'month'
417
- })
466
+ // Utilisation du composable pour personnaliser le bouton du mois
467
+ const { customizeMonthButton, setupMonthButtonObserver } = useMonthButtonCustomization(
468
+ () => isDatePickerVisible.value,
469
+ )
418
470
 
419
- // Fonction pour gérer le changement de mode d'affichage
420
- const handleViewModeUpdate = (newMode: ViewMode) => {
421
- currentViewMode.value = newMode
422
- }
471
+ // Utilisation du composable pour gérer le mode d'affichage du DatePicker
472
+ const { currentViewMode, handleViewModeUpdate, handleYearUpdate, handleMonthUpdate, resetViewMode } = useDatePickerViewMode(
473
+ // Fonction qui retourne la valeur actuelle de isBirthDate (combinaison de isBirthDate et birthDate)
474
+ () => props.isBirthDate || props.birthDate,
475
+ )
423
476
 
424
- // Fonction pour gérer la sélection de l'année quand isBirthDate est true
425
- const handleYearUpdate = () => {
426
- if (props.isBirthDate) {
427
- // Après la sélection de l'année, passer automatiquement à la sélection du mois
428
- currentViewMode.value = 'months'
429
- }
430
- }
477
+ // La fonction isDateComplete est maintenant importée du composable useDateFormatValidation
431
478
 
432
- // Fonction pour gérer la sélection du mois quand isBirthDate est true
433
- const handleMonthUpdate = () => {
434
- if (props.isBirthDate) {
435
- // Après la sélection du mois, passer automatiquement à la sélection du jour
436
- currentViewMode.value = undefined
437
- }
438
- }
479
+ // Fonction pour valider la saisie manuelle, similaire à validateRules dans DateTextInput
480
+ const { validateManualInput } = useManualDateValidation({
481
+ format: props.format,
482
+ required: props.required,
483
+ disableErrorHandling: props.disableErrorHandling,
484
+ customRules: props.customRules,
485
+ customWarningRules: props.customWarningRules,
486
+ hasInteracted,
487
+ errors,
488
+ clearValidation,
489
+ validateDateFormat,
490
+ isDateComplete: isDateComplete.value,
491
+ parseDate,
492
+ validateField,
493
+ })
439
494
 
440
- const handleInputBlur = () => {
441
- emit('blur')
442
- validateDates(true)
443
- }
495
+ const { handleInputBlur } = useInputBlurHandler({
496
+ format: props.format,
497
+ dateFormatReturn: props.dateFormatReturn,
498
+ required: props.required,
499
+ displayFormattedDate,
500
+ hasInteracted,
501
+ isManualInputActive,
502
+ isUpdatingFromInternal,
503
+ selectedDates,
504
+ validateDateFormat,
505
+ parseDate,
506
+ formatDate,
507
+ updateModel,
508
+ validateManualInput,
509
+ emitBlur: emitBlurEvent,
510
+ })
444
511
 
445
512
  watch(isDatePickerVisible, async (isVisible) => {
446
513
  if (!isVisible && props.isBirthDate) {
447
514
  // Réinitialiser le mode d'affichage au type birthdate
448
- currentViewMode.value = 'year'
515
+ resetViewMode()
449
516
  }
450
517
 
451
518
  if (isVisible) {
519
+ // Personnaliser le bouton du mois
520
+ customizeMonthButton()
521
+
452
522
  // set the focus on the date picker
453
523
  await nextTick()
454
524
  const firstButton = datePickerRef.value?.$el.querySelector('button')
@@ -471,21 +541,14 @@
471
541
  }
472
542
  })
473
543
 
474
- const getIcon = () => {
475
- if (props.noCalendar || props.disableErrorHandling) {
476
- return
477
- }
478
- switch (true) {
479
- case errorMessages.value.length > 0:
480
- return 'error'
481
- case warningMessages.value.length > 0:
482
- return 'warning'
483
- case successMessages.value.length > 0:
484
- return 'success'
485
- default:
486
- return
487
- }
488
- }
544
+ // Utilisation du composable useIconState pour déterminer l'icône à afficher
545
+ const { getIcon } = useIconState({
546
+ noCalendar: props.noCalendar,
547
+ disableErrorHandling: props.disableErrorHandling,
548
+ errorMessages,
549
+ warningMessages,
550
+ successMessages,
551
+ })
489
552
 
490
553
  const syncFromModelValue = (newValue: DateInput | undefined) => {
491
554
  if (!newValue || newValue === '') {
@@ -536,40 +599,225 @@
536
599
  }
537
600
  }, { immediate: true })
538
601
 
539
- const toggleDatePicker = () => {
540
- if (props.disabled || props.readonly) return
602
+ const {
603
+ toggleDatePicker,
604
+ openDatePicker,
605
+ openDatePickerOnClick,
606
+ openDatePickerOnFocus,
607
+ openDatePickerOnIconClick,
608
+ handleClickOutside,
609
+ handleKeyboardNavigation,
610
+ } = useDatePickerVisibility({
611
+ disabled: props.disabled,
612
+ readonly: props.readonly,
613
+ textFieldActivator: props.textFieldActivator,
614
+ isDatePickerVisible,
615
+ isManualInputActive,
616
+ hasInteracted,
617
+ updateAccessibility,
618
+ validateDates,
619
+ emitClosed: () => emit('closed'),
620
+ emitFocus: () => emit('focus'),
621
+ })
622
+
623
+ // Fonctions pour la gestion de la saisie manuelle
624
+ const formatDateInput = (input: string, cursorPosition?: number): { formatted: string, cursorPos: number } => {
625
+ // Conserver uniquement les chiffres de l'entrée
626
+ const cleanedInput = input.replace(/[^\d]/g, '')
627
+
628
+ // Déterminer le séparateur utilisé dans le format
629
+ const separator = props.format.match(/[^DMY]/)?.[0] || '/'
630
+
631
+ // Calculer la position du curseur dans l'entrée nettoyée (sans séparateurs)
632
+ // Pour cela, on compte combien de chiffres il y a avant la position du curseur
633
+ const inputBeforeCursor = input.substring(0, cursorPosition || 0)
634
+ const digitsBeforeCursor = inputBeforeCursor.replace(/[^\d]/g, '').length
635
+
636
+ // Construire la chaîne formatée
637
+ let result = ''
638
+ let digitIndex = 0
541
639
 
542
- isDatePickerVisible.value = !isDatePickerVisible.value
640
+ // Parcourir le format pour placer les chiffres et séparateurs
641
+ for (let i = 0; i < props.format.length && digitIndex < cleanedInput.length; i++) {
642
+ const formatChar = props.format[i].toUpperCase()
543
643
 
544
- if (isDatePickerVisible.value) {
545
- // Mettre à jour l'accessibilité après l'ouverture du DatePicker
546
- nextTick(() => {
547
- updateAccessibility()
548
- })
644
+ if (['D', 'M', 'Y'].includes(formatChar)) {
645
+ // Ajouter un chiffre
646
+ result += cleanedInput[digitIndex]
647
+ digitIndex++
648
+ }
649
+ else {
650
+ // Ajouter un séparateur
651
+ result += separator
652
+ }
549
653
  }
550
- else {
551
- emit('closed')
552
- validateDates()
654
+
655
+ // Calculer la nouvelle position du curseur
656
+ // Nombre de chiffres avant le curseur + nombre de séparateurs avant ces chiffres
657
+ let newCursorPos = digitsBeforeCursor
658
+
659
+ // Ajouter les séparateurs qui apparaissent avant la position du curseur
660
+ for (let i = 0, digitCount = 0; i < props.format.length && digitCount < digitsBeforeCursor; i++) {
661
+ if (!['D', 'M', 'Y'].includes(props.format[i].toUpperCase())) {
662
+ newCursorPos++
663
+ }
664
+ else {
665
+ digitCount++
666
+ }
667
+ }
668
+
669
+ return {
670
+ formatted: result,
671
+ cursorPos: Math.min(newCursorPos, result.length),
553
672
  }
554
673
  }
555
674
 
556
- const openDatePickerOnClick = () => {
557
- if (props.textFieldActivator) {
558
- openDatePicker()
675
+ const handleKeydown = (event: KeyboardEvent & { target: HTMLInputElement }) => {
676
+ // Déléguer la gestion de l'ouverture du calendrier au composable
677
+ if (!props.noCalendar && handleKeyboardNavigation(event)) {
678
+ return
679
+ }
680
+
681
+ // Gérer la suppression des séparateurs
682
+ if (event.key === 'Backspace') {
683
+ const input = event.target
684
+ if (!input.selectionStart || input.selectionStart !== input.selectionEnd) {
685
+ return
686
+ }
687
+
688
+ const cursorPos = input.selectionStart
689
+ const charBeforeCursor = input.value[cursorPos - 1]
690
+
691
+ if (!/\d/.test(charBeforeCursor)) {
692
+ // Si le caractère avant le curseur n'est pas un chiffre, on le supprime aussi
693
+ // et on supprime le chiffre avant le séparateur
694
+ event.preventDefault() // Empêcher le comportement par défaut
695
+
696
+ const newValue = input.value.substring(0, cursorPos - 2)
697
+ + input.value.substring(cursorPos)
698
+
699
+ // Mettre à jour la valeur
700
+ displayFormattedDate.value = newValue
701
+
702
+ // Positionner le curseur après un court délai
703
+ setTimeout(() => {
704
+ const newCursorPos = cursorPos - 2
705
+ input.setSelectionRange(newCursorPos, newCursorPos)
706
+ }, 0)
707
+ }
708
+ }
709
+
710
+ // Gérer les touches de direction pour éviter de se retrouver entre un séparateur et un chiffre
711
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
712
+ const input = event.target
713
+ const cursorPos = input.selectionStart || 0
714
+
715
+ // Déterminer le séparateur utilisé dans le format
716
+ const separator = props.format.match(/[^DMY]/)?.[0] || '/'
717
+
718
+ if (event.key === 'ArrowLeft' && cursorPos > 0) {
719
+ const charBeforeCursor = input.value[cursorPos - 1]
720
+
721
+ if (charBeforeCursor === separator) {
722
+ // Si on se déplace à gauche et qu'on rencontre un séparateur, sauter par-dessus
723
+ event.preventDefault()
724
+ input.setSelectionRange(cursorPos - 2, cursorPos - 2)
725
+ }
726
+ }
727
+ else if (event.key === 'ArrowRight' && cursorPos < input.value.length) {
728
+ const charAtCursor = input.value[cursorPos]
729
+
730
+ if (charAtCursor === separator) {
731
+ // Si on se déplace à droite et qu'on rencontre un séparateur, sauter par-dessus
732
+ event.preventDefault()
733
+ input.setSelectionRange(cursorPos + 2, cursorPos + 2)
734
+ }
735
+ }
559
736
  }
560
737
  }
561
738
 
562
- const openDatePickerOnFocus = () => {
563
- // Only open the DatePicker if textFieldActivator is true
564
- if (props.textFieldActivator) {
565
- openDatePicker()
739
+ // Variable pour l'accessibilité
740
+ const accessibilityDescription = ref(DATE_PICKER_MESSAGES.ARIA_DATE_INPUT)
741
+
742
+ // Fonction pour créer une description accessible de la date pour les lecteurs d'écran
743
+ const getDateDescription = (dateStr: string, format: string): string => {
744
+ // Si la chaîne est vide, retourner un message simple
745
+ if (!dateStr || !dateStr.trim()) {
746
+ return 'Aucune date saisie'
747
+ }
748
+
749
+ // Déterminer le séparateur utilisé dans le format
750
+ const separator = format.match(/[^DMY]/)?.[0] || '/'
751
+
752
+ // Extraire les parties de la date
753
+ const dateParts = dateStr.split(separator)
754
+ const formatParts = format.split(separator)
755
+
756
+ // Créer une description en fonction du format
757
+ let description = 'Date en cours de saisie: '
758
+
759
+ for (let i = 0; i < formatParts.length; i++) {
760
+ if (i >= dateParts.length) break
761
+
762
+ const part = dateParts[i].trim()
763
+ const formatPart = formatParts[i].charAt(0).toUpperCase()
764
+
765
+ // Ignorer les parties vides ou contenant uniquement des placeholders
766
+ if (!part || part.replace(/_/g, '').length === 0) {
767
+ continue
768
+ }
769
+
770
+ switch (formatPart) {
771
+ case 'D':
772
+ description += `jour ${part}, `
773
+ break
774
+ case 'M':
775
+ description += `mois ${part}, `
776
+ break
777
+ case 'Y':
778
+ description += `année ${part}, `
779
+ break
780
+ }
566
781
  }
567
- // Always emit the focus event
568
- emit('focus')
782
+
783
+ // Supprimer la virgule finale si elle existe
784
+ return description.endsWith(', ')
785
+ ? description.slice(0, -2)
786
+ : description
569
787
  }
570
788
 
571
- const openDatePickerOnIconClick = () => {
572
- toggleDatePicker()
789
+ // Mettre à jour la description accessible lorsque la valeur affichée change
790
+ watch(displayFormattedDate, (newValue) => {
791
+ if (newValue) {
792
+ // Créer une version accessible pour les lecteurs d'écran (sans les caractères de placeholder)
793
+ const accessibleValue = newValue.replace(/_/g, ' ')
794
+
795
+ // Créer un message descriptif pour le lecteur d'écran
796
+ accessibilityDescription.value = getDateDescription(accessibleValue, props.format)
797
+ }
798
+ else {
799
+ accessibilityDescription.value = 'Aucune date saisie'
800
+ }
801
+ })
802
+
803
+ // Utilisation des composables pour les fonctionnalités du DatePicker
804
+ const { displayWeekendDays } = useWeekendDays(props)
805
+
806
+ // Computed properties pour period
807
+ const minDate = computed(() => props.period?.min || dayjs().subtract(10, 'year').format(props.format))
808
+ const maxDate = computed(() => props.period?.max || dayjs().add(10, 'year').format(props.format))
809
+
810
+ const { todayInString, selectToday } = useTodayButton(props)
811
+
812
+ // Utilisation du composable pour l'affichage formaté des dates
813
+ const { displayedDateString } = useDisplayedDateString({
814
+ selectedDates,
815
+ todayInString,
816
+ })
817
+
818
+ // Wrapper pour la fonction selectToday du composable
819
+ const handleSelectToday = () => {
820
+ selectToday(selectedDates)
573
821
  }
574
822
 
575
823
  defineExpose({
@@ -579,8 +827,18 @@
579
827
  errorMessages,
580
828
  handleClickOutside,
581
829
  initializeSelectedDates,
830
+ handleSelectToday,
582
831
  updateAccessibility,
583
832
  openDatePicker,
833
+ updateDisplayFormattedDate,
834
+ toggleDatePicker,
835
+ validateField,
836
+ clearValidation,
837
+ validateDates,
838
+ formatDateInput,
839
+ emitBlur: emitBlurEvent,
840
+ validateDateFormat,
841
+ displayFormattedDate,
584
842
  })
585
843
  </script>
586
844
 
@@ -589,6 +847,13 @@
589
847
  class="date-picker-container"
590
848
  :style="inputStyle"
591
849
  >
850
+ <!-- Variable pour stocker la description accessible -->
851
+ <span
852
+ v-if="false"
853
+ ref="accessibilityDescriptionRef"
854
+ >
855
+ {{ accessibilityDescription }}
856
+ </span>
592
857
  <template v-if="props.noCalendar">
593
858
  <DateTextInput
594
859
  ref="dateTextInputRef"
@@ -636,14 +901,14 @@
636
901
  ref="dateCalendarTextInputRef"
637
902
  v-model="displayFormattedDate"
638
903
  :append-icon="displayIcon && displayAppendIcon ? 'calendar' : undefined"
639
- :append-inner-icon="getIcon()"
904
+ :append-inner-icon="getIcon"
640
905
  :class="[getMessageClasses(), 'label-hidden-on-focus']"
641
906
  :error-messages="errorMessages"
642
907
  :warning-messages="warningMessages"
643
908
  :success-messages="props.showSuccessMessages ? successMessages : []"
644
909
  :disabled="props.disabled"
645
910
  :disable-click-button="false"
646
- :readonly="true"
911
+ :readonly="props.readonly"
647
912
  :label="props.placeholder"
648
913
  :no-icon="props.noIcon"
649
914
  :prepend-icon="displayIcon && !displayAppendIcon ? 'calendar' : undefined"
@@ -653,10 +918,13 @@
653
918
  :bg-color="props.bgColor"
654
919
  is-clearable
655
920
  title="Date Picker"
921
+ :aria-label="accessibilityDescription"
656
922
  @click="openDatePickerOnClick"
657
923
  @focus="openDatePickerOnFocus"
658
924
  @blur="handleInputBlur"
659
925
  @update:model-value="updateSelectedDates"
926
+ @input="handleInput"
927
+ @keydown="handleKeydown"
660
928
  @prepend-icon-click="openDatePickerOnIconClick"
661
929
  @append-icon-click="openDatePickerOnIconClick"
662
930
  />
@@ -666,11 +934,14 @@
666
934
  ref="datePickerRef"
667
935
  v-model="selectedDates"
668
936
  color="primary"
937
+ :class="displayWeekendDays ? 'weekend' : ''"
669
938
  :first-day-of-week="1"
670
939
  :multiple="props.displayRange ? 'range' : false"
671
940
  :show-adjacent-months="true"
672
941
  :show-week="props.showWeekNumber"
673
942
  :view-mode="currentViewMode"
943
+ :max="maxDate"
944
+ :min="minDate"
674
945
  @update:view-mode="handleViewModeUpdate"
675
946
  @update:year="handleYearUpdate"
676
947
  @update:month="handleMonthUpdate"
@@ -681,9 +952,32 @@
681
952
  </template>
682
953
  <template #header>
683
954
  <h3 class="mx-auto my-auto ml-5 mb-4">
684
- {{ todayInString }}
955
+ {{ displayedDateString }}
685
956
  </h3>
686
957
  </template>
958
+ <template
959
+ v-if="props.displayTodayButton"
960
+ #actions
961
+ >
962
+ <div class="d-flex justify-center align-center w-100">
963
+ <v-btn
964
+ v-if="props.displayTodayButton"
965
+ size="x-small"
966
+ color="primary"
967
+ :title="DATE_PICKER_MESSAGES.BUTTON_TODAY"
968
+ class="my-2 pa-2 mt-2"
969
+ :ripple="false"
970
+ @click="handleSelectToday"
971
+ >
972
+ <VIcon
973
+ class="mr-1"
974
+ >
975
+ {{ mdiCalendar }}
976
+ </VIcon>
977
+ {{ DATE_PICKER_MESSAGES.BUTTON_TODAY }}
978
+ </v-btn>
979
+ </div>
980
+ </template>
687
981
  </VDatePicker>
688
982
  </VMenu>
689
983
  </template>
@@ -693,6 +987,22 @@
693
987
  <style lang="scss" scoped>
694
988
  @use '@/assets/tokens';
695
989
 
990
+ /* Disable ripple effect on month and year buttons */
991
+ :deep(.v-date-picker-controls__month-btn),
992
+ :deep(.v-date-picker-controls__mode-btn) {
993
+ .v-ripple__container,
994
+ .v-ripple__animation {
995
+ display: none !important;
996
+ opacity: 0 !important;
997
+ background-color: transparent !important;
998
+ pointer-events: none !important;
999
+ }
1000
+ }
1001
+
1002
+ :deep(.v-date-picker-controls .v-btn:last-child) {
1003
+ margin-inline-start: 0;
1004
+ }
1005
+
696
1006
  .label-hidden-on-focus:focus + label {
697
1007
  display: none;
698
1008
  }
@@ -783,13 +1093,20 @@
783
1093
  opacity: 1;
784
1094
  }
785
1095
 
786
- .fade-enter-active,
787
- .fade-leave-active {
788
- transition: opacity 0.5s ease;
1096
+ :deep(.weekend .v-date-picker-month__day--week-end .v-btn) {
1097
+ background-color: #afb1b1;
1098
+ }
1099
+
1100
+ /* div avant la class .v-date-picker-month__day--week-end */
1101
+ :deep(.weekend .v-date-picker-month__day:has(+ .v-date-picker-month__day--week-end) .v-btn) {
1102
+ background-color: #afb1b1;
1103
+ }
1104
+
1105
+ :deep(.v-date-picker-controls__mode-btn) {
1106
+ transform: none !important;
789
1107
  }
790
1108
 
791
- .fade-enter-from,
792
- .fade-leave-to {
793
- opacity: 0;
1109
+ :deep(.v-btn--variant-text .v-btn__overlay) {
1110
+ padding: 13px;
794
1111
  }
795
1112
  </style>