@cnamts/synapse 1.0.0 → 1.0.2

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 (533) hide show
  1. package/README.md +1 -1
  2. package/dist/DateFilter-YWOTbfeL.js +98 -0
  3. package/dist/NumberFilter-DMmMgALM.js +121 -0
  4. package/dist/PeriodFilter-Bok5BHcn.js +112 -0
  5. package/dist/SelectFilter-BKud2WhN.js +136 -0
  6. package/dist/TextFilter-DvMf2thH.js +114 -0
  7. package/dist/{components/BackBtn → common}/constants/ExpertiseLevelEnum.d.ts +3 -0
  8. package/dist/components/Accordion/Accordion.d.ts +2 -1
  9. package/dist/components/Accordion/composables/useAccordionGroupCommunication.d.ts +5 -0
  10. package/dist/components/Accordion/composables/useAccordionKeyboardNavigation.d.ts +12 -0
  11. package/dist/components/Accordion/composables/useAccordionState.d.ts +13 -0
  12. package/dist/components/BackBtn/AccessibiliteItems.d.ts +1 -1
  13. package/dist/components/BackToTopBtn/AccessibiliteItems.d.ts +1 -1
  14. package/dist/components/ChipList/AccessibiliteItems.d.ts +1 -1
  15. package/dist/components/CollapsibleList/AccessibiliteItems.d.ts +1 -1
  16. package/dist/components/ContextualMenu/AccessibiliteItems.d.ts +1 -1
  17. package/dist/components/CookieBanner/AccessibiliteItems.d.ts +1 -1
  18. package/dist/components/CopyBtn/AccessibiliteItems.d.ts +1 -1
  19. package/dist/components/Customs/SyBtnSelect/AccessibiliteItems.d.ts +1 -1
  20. package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +85 -0
  21. package/dist/components/Customs/SyInputSelect/AccessibiliteItems.d.ts +1 -1
  22. package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
  23. package/dist/components/Customs/SySelect/AccessibiliteItems.d.ts +1 -1
  24. package/dist/components/Customs/SySelect/SySelect.d.ts +33 -13
  25. package/dist/components/Customs/SyTextField/AccessibiliteItems.d.ts +1 -1
  26. package/dist/components/Customs/SyTextField/SyTextField.d.ts +2 -2
  27. package/dist/components/DataList/AccessibiliteItems.d.ts +1 -1
  28. package/dist/components/DataListGroup/AccessibiliteItems.d.ts +1 -1
  29. package/dist/components/DatePicker/AccessibiliteItems.d.ts +1 -1
  30. package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +4295 -0
  31. package/dist/components/DatePicker/{DatePicker.d.ts → DatePicker/DatePicker.d.ts} +158 -104
  32. package/dist/components/DatePicker/{DateTextInput.d.ts → DateTextInput/DateTextInput.d.ts} +35 -27
  33. package/dist/components/DatePicker/composables/index.d.ts +17 -0
  34. package/dist/components/DatePicker/composables/useAsteriskDisplay.d.ts +14 -0
  35. package/dist/components/DatePicker/composables/useDateAutoClamp.d.ts +16 -0
  36. package/dist/components/DatePicker/composables/useDateFormatValidation.d.ts +25 -0
  37. package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +33 -0
  38. package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +16 -0
  39. package/dist/components/DatePicker/composables/useDatePickerVisibility.d.ts +27 -0
  40. package/dist/components/DatePicker/composables/useDateRangeInput.d.ts +29 -0
  41. package/dist/components/DatePicker/composables/useDateRangeValidation.d.ts +11 -0
  42. package/dist/components/DatePicker/composables/useDateSelection.d.ts +10 -0
  43. package/dist/components/DatePicker/composables/useDateValidation.d.ts +35 -0
  44. package/dist/components/DatePicker/composables/useDisplayedDateString.d.ts +19 -0
  45. package/dist/components/DatePicker/composables/useIconState.d.ts +17 -0
  46. package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +31 -0
  47. package/dist/components/DatePicker/composables/useInputHandler.d.ts +32 -0
  48. package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +33 -0
  49. package/dist/components/DatePicker/composables/useMonthButtonCustomization.d.ts +12 -0
  50. package/dist/components/DatePicker/composables/useTodayButton.d.ts +16 -0
  51. package/dist/components/DatePicker/composables/useWeekendDays.d.ts +11 -0
  52. package/dist/components/DatePicker/constants/messages.d.ts +29 -0
  53. package/dist/components/DatePicker/types.d.ts +13 -0
  54. package/dist/components/DialogBox/AccessibiliteItems.d.ts +1 -1
  55. package/dist/components/DownloadBtn/AccessibiliteItems.d.ts +1 -1
  56. package/dist/components/ErrorPage/AccessibiliteItems.d.ts +1 -1
  57. package/dist/components/ExternalLinks/AccessibiliteItems.d.ts +1 -1
  58. package/dist/components/FileList/AccessibiliteItems.d.ts +1 -1
  59. package/dist/components/FilePreview/AccessibiliteItems.d.ts +1 -1
  60. package/dist/components/FileUpload/AccessibiliteItems.d.ts +1 -1
  61. package/dist/components/FilterInline/AccessibiliteItems.d.ts +1 -1
  62. package/dist/components/FilterSideBar/AccessibiliteItems.d.ts +1 -1
  63. package/dist/components/FilterSideBar/FilterSideBar.d.ts +395 -1
  64. package/dist/components/FooterBar/AccessibiliteItems.d.ts +1 -1
  65. package/dist/components/FranceConnectBtn/AccessibiliteItems.d.ts +1 -1
  66. package/dist/components/HeaderBar/AccessibiliteItems.d.ts +1 -1
  67. package/dist/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.d.ts +1 -1
  68. package/dist/components/HeaderLoading/AccessibiliteItems.d.ts +1 -1
  69. package/dist/components/HeaderToolbar/AccessibiliteItems.d.ts +1 -1
  70. package/dist/components/LangBtn/AccessibiliteItems.d.ts +1 -1
  71. package/dist/components/Logo/AccessibiliteItems.d.ts +1 -1
  72. package/dist/components/LogoBrandSection/AccessibiliteItems.d.ts +1 -1
  73. package/dist/components/MaintenancePage/AccessibiliteItems.d.ts +1 -1
  74. package/dist/components/NirField/AccessibiliteItems.d.ts +1 -1
  75. package/dist/components/NirField/NirField.d.ts +7 -3
  76. package/dist/components/NirField/nirValidation.d.ts +1 -1
  77. package/dist/components/NotFoundPage/AccessibiliteItems.d.ts +1 -1
  78. package/dist/components/NotificationBar/AccessibiliteItems.d.ts +1 -1
  79. package/dist/components/PageContainer/AccessibiliteItems.d.ts +1 -1
  80. package/dist/components/PaginatedTable/AccessibiliteItems.d.ts +1 -1
  81. package/dist/components/PasswordField/AccessibiliteItems.d.ts +1 -1
  82. package/dist/components/PasswordField/PasswordField.d.ts +2 -0
  83. package/dist/components/PeriodField/AccessibiliteItems.d.ts +1 -1
  84. package/dist/components/PeriodField/PeriodField.d.ts +219 -41
  85. package/dist/components/PhoneField/AccessibiliteItems.d.ts +1 -1
  86. package/dist/components/PhoneField/PhoneField.d.ts +2 -2
  87. package/dist/components/RangeField/AccessibiliteItems.d.ts +1 -1
  88. package/dist/components/RangeField/RangeField.d.ts +2 -0
  89. package/dist/components/RatingPicker/AccessibiliteItems.d.ts +1 -1
  90. package/dist/components/SearchListField/AccessibiliteItems.d.ts +1 -1
  91. package/dist/components/SearchListField/SearchListField.d.ts +9 -0
  92. package/dist/components/SelectBtnField/AccessibiliteItems.d.ts +1 -1
  93. package/dist/components/SkipLink/AccessibiliteItems.d.ts +1 -1
  94. package/dist/components/SocialMediaLinks/AccessibiliteItems.d.ts +1 -1
  95. package/dist/components/SubHeader/AccessibiliteItems.d.ts +1 -1
  96. package/dist/components/SyAlert/AccessibiliteItems.d.ts +1 -1
  97. package/dist/components/SyTextArea/SyTextArea.d.ts +2 -0
  98. package/dist/components/TableToolbar/AccessibiliteItems.d.ts +1 -1
  99. package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +652 -0
  100. package/dist/components/Tables/SyTable/SyTable.d.ts +671 -0
  101. package/dist/components/Tables/common/SyTableFilter.d.ts +126 -0
  102. package/dist/components/Tables/common/SyTablePagination.d.ts +1636 -0
  103. package/dist/components/Tables/common/TableHeader.d.ts +15 -0
  104. package/dist/components/Tables/common/constants/StateEnum.d.ts +6 -0
  105. package/dist/components/Tables/common/filters/DateFilter.d.ts +121 -0
  106. package/dist/components/Tables/common/filters/NumberFilter.d.ts +132 -0
  107. package/dist/components/Tables/common/filters/PeriodFilter.d.ts +135 -0
  108. package/dist/components/Tables/common/filters/SelectFilter.d.ts +120 -0
  109. package/dist/components/Tables/common/filters/TextFilter.d.ts +132 -0
  110. package/dist/components/Tables/common/filters/getFilterComponent.d.ts +1 -0
  111. package/dist/components/Tables/common/filters/locales.d.ts +4 -0
  112. package/dist/components/Tables/common/filters/logics/date.d.ts +1 -0
  113. package/dist/components/Tables/common/filters/logics/number.d.ts +1 -0
  114. package/dist/components/Tables/common/filters/logics/period.d.ts +1 -0
  115. package/dist/components/Tables/common/filters/logics/select.d.ts +1 -0
  116. package/dist/components/Tables/common/filters/logics/text.d.ts +1 -0
  117. package/dist/components/Tables/common/formatters.d.ts +17 -0
  118. package/dist/components/Tables/common/locales.d.ts +28 -0
  119. package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +267 -0
  120. package/dist/components/Tables/common/organizeColumns/sortHeaders.d.ts +2 -0
  121. package/dist/components/Tables/common/tableAccessibilityUtils.d.ts +8 -0
  122. package/dist/components/Tables/common/tableFilterUtils.d.ts +3 -0
  123. package/dist/components/Tables/common/tableStorageUtils.d.ts +69 -0
  124. package/dist/components/Tables/common/tableUtils.d.ts +79 -0
  125. package/dist/components/Tables/common/types.d.ts +91 -0
  126. package/dist/components/Tables/common/usePagination.d.ts +22 -0
  127. package/dist/components/Tables/common/useTableCheckbox.d.ts +20 -0
  128. package/dist/components/Tables/common/useTableFilter.d.ts +9 -0
  129. package/dist/components/Tables/common/useTableHeaders.d.ts +76 -0
  130. package/dist/components/Tables/common/useTableItems.d.ts +24 -0
  131. package/dist/components/Tables/common/useTableOptions.d.ts +18 -0
  132. package/dist/components/Tables/index.d.ts +2 -0
  133. package/dist/components/ToolbarContainer/ToolbarContainer.d.ts +11 -0
  134. package/dist/components/UploadWorkflow/AccessibiliteItems.d.ts +1 -1
  135. package/dist/components/UserMenuBtn/AccessibiliteItems.d.ts +1 -1
  136. package/dist/components/UserMenuBtn/UserMenuBtn.d.ts +9 -2
  137. package/dist/components/index.d.ts +9 -5
  138. package/dist/design-system-v3.js +102 -11944
  139. package/dist/design-system-v3.umd.cjs +22 -4
  140. package/dist/designTokens/index.d.ts +3 -1
  141. package/dist/designTokens/tokens/cnam/cnamFonts.d.ts +140 -0
  142. package/dist/designTokens/tokens/pa/paFonts.d.ts +140 -0
  143. package/dist/designTokens/utils/createFontVariables.d.ts +39 -0
  144. package/dist/designTokens/utils/index.d.ts +2 -1
  145. package/dist/main-Cx8qG7YR.js +16344 -0
  146. package/dist/stories/Accessibilite/Vuetify/VuetifyItems.d.ts +14 -2
  147. package/dist/stories/DesignTokens/StylesTypographiques.stories.new.d.ts +8 -0
  148. package/dist/stories/DesignTokens/TypographyDisplay.d.ts +28 -0
  149. package/dist/stories/DesignTokens/vue-shims.d.ts +6 -0
  150. package/dist/style.css +1 -1
  151. package/dist/utils/rules/isRequired/index.d.ts +1 -1
  152. package/dist/vite-env.d.ts +12 -0
  153. package/package.json +3 -3
  154. package/src/assets/_spacers.scss +37 -1
  155. package/src/assets/_typography.scss +158 -0
  156. package/src/assets/settings.scss +7 -0
  157. package/src/common/constants/ExpertiseLevelEnum.ts +7 -0
  158. package/src/common/imgs/accessibility-svgrepo-com.svg +4 -0
  159. package/src/components/Accordion/Accessibilite/AccessibilityGuide.mdx +249 -0
  160. package/src/components/Accordion/Accordion.vue +48 -76
  161. package/src/components/Accordion/composables/__tests__/useAccordionGroupCommunication.spec.ts +146 -0
  162. package/src/components/Accordion/composables/__tests__/useAccordionKeyboardNavigation.spec.ts +209 -0
  163. package/src/components/Accordion/composables/__tests__/useAccordionState.spec.ts +144 -0
  164. package/src/components/Accordion/composables/useAccordionGroupCommunication.ts +52 -0
  165. package/src/components/Accordion/composables/useAccordionKeyboardNavigation.ts +111 -0
  166. package/src/components/Accordion/composables/useAccordionState.ts +59 -0
  167. package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +3 -0
  168. package/src/components/BackBtn/AccessibiliteItems.ts +1 -1
  169. package/src/components/BackToTopBtn/AccessibiliteItems.ts +1 -1
  170. package/src/components/ChipList/AccessibiliteItems.ts +1 -1
  171. package/src/components/CollapsibleList/AccessibiliteItems.ts +1 -1
  172. package/src/components/ContextualMenu/AccessibiliteItems.ts +1 -1
  173. package/src/components/CookieBanner/AccessibiliteItems.ts +1 -1
  174. package/src/components/CopyBtn/AccessibiliteItems.ts +1 -1
  175. package/src/components/Customs/SyBtnSelect/AccessibiliteItems.ts +1 -1
  176. package/src/components/Customs/SyCheckbox/Accessibilite.mdx +303 -0
  177. package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +50 -0
  178. package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +630 -0
  179. package/src/components/Customs/SyCheckbox/SyCheckbox.vue +326 -0
  180. package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +201 -0
  181. package/src/components/Customs/SyInputSelect/AccessibiliteItems.ts +1 -1
  182. package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +1 -0
  183. package/src/components/Customs/SyInputSelect/SyInputSelect.vue +8 -1
  184. package/src/components/Customs/SySelect/AccessibiliteItems.ts +1 -1
  185. package/src/components/Customs/SySelect/SySelect.stories.ts +160 -0
  186. package/src/components/Customs/SySelect/SySelect.vue +292 -39
  187. package/src/components/Customs/SySelect/tests/SySelect.spec.ts +234 -2
  188. package/src/components/Customs/SyTextField/AccessibiliteItems.ts +1 -1
  189. package/src/components/Customs/SyTextField/SyTextField.stories.ts +3 -2
  190. package/src/components/Customs/SyTextField/SyTextField.vue +19 -8
  191. package/src/components/DataList/AccessibiliteItems.ts +1 -1
  192. package/src/components/DataListGroup/AccessibiliteItems.ts +1 -1
  193. package/src/components/DatePicker/AccessibiliteItems.ts +1 -1
  194. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.mdx +212 -0
  195. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1307 -0
  196. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +769 -204
  197. package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.events.spec.ts +161 -0
  198. package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +943 -0
  199. package/src/components/DatePicker/DatePicker/DatePicker.mdx +176 -0
  200. package/src/components/DatePicker/{DatePicker.stories.ts → DatePicker/DatePicker.stories.ts} +356 -519
  201. package/src/components/DatePicker/{DatePicker.vue → DatePicker/DatePicker.vue} +435 -89
  202. package/src/components/DatePicker/DatePicker/tests/DatePicker.events.spec.ts +189 -0
  203. package/src/components/DatePicker/{tests → DatePicker/tests}/DatePicker.spec.ts +0 -14
  204. package/src/components/DatePicker/DatePickerOverview.mdx +227 -0
  205. package/src/components/DatePicker/{DatePickerValidation.mdx → DatePickerValidationExample/DatePickerValidation.mdx} +3 -3
  206. package/src/components/DatePicker/{DatePickerValidation.stories.ts → DatePickerValidationExample/DatePickerValidation.stories.ts} +2 -2
  207. package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +320 -0
  208. package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +148 -0
  209. package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +278 -0
  210. package/src/components/DatePicker/{tests → DateTextInput}/DateTextInput.spec.ts +10 -7
  211. package/src/components/DatePicker/DateTextInput/DateTextInput.vue +1111 -0
  212. package/src/components/DatePicker/DateTextInput/NoCalendar.mdx +64 -0
  213. package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +782 -0
  214. package/src/components/DatePicker/composables/index.ts +24 -0
  215. package/src/components/DatePicker/composables/tests/useDateAutoClamp.spec.ts +190 -0
  216. package/src/components/DatePicker/composables/tests/useDateFormatValidation.spec.ts +165 -0
  217. package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +359 -0
  218. package/src/components/DatePicker/composables/tests/useDatePickerViewMode.spec.ts +160 -0
  219. package/src/components/DatePicker/composables/tests/useDatePickerVisibility.spec.ts +339 -0
  220. package/src/components/DatePicker/composables/tests/useDateRangeInput.spec.ts +277 -0
  221. package/src/components/DatePicker/composables/tests/useDateRangeValidation.spec.ts +107 -0
  222. package/src/components/DatePicker/composables/tests/useDateSelection.spec.ts +171 -0
  223. package/src/components/DatePicker/composables/tests/useDateValidation.spec.ts +245 -0
  224. package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +98 -0
  225. package/src/components/DatePicker/composables/tests/useIconState.spec.ts +130 -0
  226. package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +456 -0
  227. package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +233 -0
  228. package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +125 -0
  229. package/src/components/DatePicker/composables/tests/useTodayButton.spec.ts +97 -0
  230. package/src/components/DatePicker/composables/tests/useWeekendDays.spec.ts +28 -0
  231. package/src/components/DatePicker/composables/useAsteriskDisplay.ts +31 -0
  232. package/src/components/DatePicker/composables/useDateAutoClamp.ts +136 -0
  233. package/src/components/DatePicker/composables/useDateFormatValidation.ts +95 -0
  234. package/src/components/DatePicker/composables/useDateInputEditing.ts +326 -0
  235. package/src/components/DatePicker/composables/useDatePickerViewMode.ts +61 -0
  236. package/src/components/DatePicker/composables/useDatePickerVisibility.ts +146 -0
  237. package/src/components/DatePicker/composables/useDateRangeInput.ts +378 -0
  238. package/src/components/DatePicker/composables/useDateRangeValidation.ts +48 -0
  239. package/src/components/DatePicker/composables/useDateSelection.ts +121 -0
  240. package/src/components/DatePicker/composables/useDateValidation.ts +225 -0
  241. package/src/components/DatePicker/composables/useDisplayedDateString.ts +70 -0
  242. package/src/components/DatePicker/composables/useIconState.ts +53 -0
  243. package/src/components/DatePicker/composables/useInputBlurHandler.ts +165 -0
  244. package/src/components/DatePicker/composables/useInputHandler.ts +436 -0
  245. package/src/components/DatePicker/composables/useManualDateValidation.ts +161 -0
  246. package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +187 -0
  247. package/src/components/DatePicker/composables/useTodayButton.ts +43 -0
  248. package/src/components/DatePicker/composables/useWeekendDays.ts +21 -0
  249. package/src/components/DatePicker/constants/messages.ts +50 -0
  250. package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +4 -4
  251. package/src/components/DatePicker/docExamples/DatePickerValidationExamples.vue +1 -1
  252. package/src/components/DatePicker/playground/ComplexDatePickerPlayground.vue +172 -0
  253. package/src/components/DatePicker/types.ts +15 -0
  254. package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +10 -0
  255. package/src/components/DialogBox/AccessibiliteItems.ts +1 -1
  256. package/src/components/DownloadBtn/AccessibiliteItems.ts +1 -1
  257. package/src/components/ErrorPage/Accessibilite.stories.ts +8 -0
  258. package/src/components/ErrorPage/AccessibiliteItems.ts +1 -1
  259. package/src/components/ErrorPage/ErrorPage.vue +12 -6
  260. package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +4 -4
  261. package/src/components/ExternalLinks/AccessibiliteItems.ts +1 -1
  262. package/src/components/FileList/AccessibiliteItems.ts +1 -1
  263. package/src/components/FilePreview/AccessibiliteItems.ts +1 -1
  264. package/src/components/FileUpload/AccessibiliteItems.ts +1 -1
  265. package/src/components/FilterInline/AccessibiliteItems.ts +1 -1
  266. package/src/components/FilterSideBar/AccessibiliteItems.ts +1 -1
  267. package/src/components/FilterSideBar/FilterSideBar.vue +108 -90
  268. package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +27 -0
  269. package/src/components/FilterSideBar/tests/__snapshots__/FilterSideBar.spec.ts.snap +114 -109
  270. package/src/components/FooterBar/AccessibiliteItems.ts +1 -1
  271. package/src/components/FooterBar/FooterBar.vue +2 -1
  272. package/src/components/FranceConnectBtn/AccessibiliteItems.ts +1 -1
  273. package/src/components/HeaderBar/AccessibiliteItems.ts +1 -1
  274. package/src/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.ts +1 -1
  275. package/src/components/HeaderLoading/AccessibiliteItems.ts +1 -1
  276. package/src/components/HeaderToolbar/AccessibiliteItems.ts +1 -1
  277. package/src/components/LangBtn/AccessibiliteItems.ts +1 -1
  278. package/src/components/Logo/Accessibilite.stories.ts +4 -0
  279. package/src/components/Logo/AccessibiliteItems.ts +1 -1
  280. package/src/components/LogoBrandSection/AccessibiliteItems.ts +1 -1
  281. package/src/components/MaintenancePage/AccessibiliteItems.ts +1 -1
  282. package/src/components/NirField/AccessibiliteItems.ts +1 -1
  283. package/src/components/NirField/NirField.mdx +22 -9
  284. package/src/components/NirField/NirField.stories.ts +26 -2
  285. package/src/components/NirField/NirField.vue +209 -22
  286. package/src/components/NirField/nirValidation.ts +17 -3
  287. package/src/components/NirField/tests/NirField.spec.ts +2 -2
  288. package/src/components/NotFoundPage/Accessibilite.stories.ts +8 -0
  289. package/src/components/NotFoundPage/AccessibiliteItems.ts +1 -1
  290. package/src/components/NotFoundPage/NotFoundPage.vue +2 -1
  291. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +8 -6
  292. package/src/components/NotificationBar/AccessibiliteItems.ts +1 -1
  293. package/src/components/PageContainer/AccessibiliteItems.ts +1 -1
  294. package/src/components/PaginatedTable/AccessibiliteItems.ts +1 -1
  295. package/src/components/PaginatedTable/PaginatedTable.mdx +2 -0
  296. package/src/components/PaginatedTable/PaginatedTable.stories.ts +19 -0
  297. package/src/components/PaginatedTable/PaginatedTable.vue +51 -13
  298. package/src/components/PaginatedTable/tests/PaginatedTable.spec.ts +0 -2
  299. package/src/components/PasswordField/AccessibiliteItems.ts +1 -1
  300. package/src/components/PasswordField/PasswordField.stories.ts +4 -0
  301. package/src/components/PasswordField/PasswordField.vue +3 -0
  302. package/src/components/PeriodField/AccessibiliteItems.ts +1 -1
  303. package/src/components/PeriodField/PeriodField.vue +15 -1
  304. package/src/components/PhoneField/AccessibiliteItems.ts +1 -1
  305. package/src/components/PhoneField/PhoneField.stories.ts +15 -15
  306. package/src/components/PhoneField/PhoneField.vue +1 -1
  307. package/src/components/RangeField/AccessibiliteItems.ts +1 -1
  308. package/src/components/RangeField/RangeField.stories.ts +9 -0
  309. package/src/components/RangeField/RangeField.vue +4 -0
  310. package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +12 -0
  311. package/src/components/RatingPicker/AccessibiliteItems.ts +1 -1
  312. package/src/components/SearchListField/AccessibiliteItems.ts +1 -1
  313. package/src/components/SearchListField/SearchListField.vue +5 -0
  314. package/src/components/SelectBtnField/AccessibiliteItems.ts +1 -1
  315. package/src/components/SkipLink/AccessibiliteItems.ts +1 -1
  316. package/src/components/SocialMediaLinks/AccessibiliteItems.ts +1 -1
  317. package/src/components/SubHeader/AccessibiliteItems.ts +1 -1
  318. package/src/components/SyAlert/AccessibiliteItems.ts +1 -1
  319. package/src/components/SyTextArea/SyTextArea.vue +3 -0
  320. package/src/components/SyTextArea/tests/SyTextArea.spec.ts +0 -1
  321. package/src/components/TableToolbar/AccessibiliteItems.ts +1 -1
  322. package/src/components/TableToolbar/TableToolbar.stories.ts +110 -56
  323. package/src/components/Tables/SyServerTable/FilterRules.stories.ts +700 -0
  324. package/src/components/Tables/SyServerTable/SyServerTable.mdx +170 -0
  325. package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +4354 -0
  326. package/src/components/Tables/SyServerTable/SyServerTable.vue +391 -0
  327. package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +702 -0
  328. package/src/components/Tables/SyTable/FilterRules.stories.ts +418 -0
  329. package/src/components/Tables/SyTable/SyTable.mdx +139 -0
  330. package/src/components/Tables/SyTable/SyTable.stories.ts +2754 -0
  331. package/src/components/Tables/SyTable/SyTable.vue +397 -0
  332. package/src/components/Tables/SyTable/tests/SyTable.spec.ts +707 -0
  333. package/src/components/Tables/common/SyTableFilter.vue +289 -0
  334. package/src/components/Tables/common/SyTablePagination.vue +375 -0
  335. package/src/components/Tables/common/TableHeader.vue +205 -0
  336. package/src/components/Tables/common/constants/StateEnum.ts +6 -0
  337. package/src/components/Tables/common/filters/DateFilter.vue +140 -0
  338. package/src/components/Tables/common/filters/NumberFilter.vue +234 -0
  339. package/src/components/Tables/common/filters/PeriodFilter.vue +147 -0
  340. package/src/components/Tables/common/filters/SelectFilter.vue +235 -0
  341. package/src/components/Tables/common/filters/TextFilter.vue +191 -0
  342. package/src/components/Tables/common/filters/getFilterComponent.ts +54 -0
  343. package/src/components/Tables/common/filters/locales.ts +4 -0
  344. package/src/components/Tables/common/filters/logics/date.ts +12 -0
  345. package/src/components/Tables/common/filters/logics/number.ts +48 -0
  346. package/src/components/Tables/common/filters/logics/period.ts +25 -0
  347. package/src/components/Tables/common/filters/logics/select.ts +27 -0
  348. package/src/components/Tables/common/filters/logics/tests/TextFilterLogic.spec.ts +177 -0
  349. package/src/components/Tables/common/filters/logics/text.ts +62 -0
  350. package/src/components/Tables/common/filters/tests/DateFilter.spec.ts +187 -0
  351. package/src/components/Tables/common/filters/tests/NumberFilter.spec.ts +280 -0
  352. package/src/components/Tables/common/filters/tests/PeriodFilter.spec.ts +192 -0
  353. package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +219 -0
  354. package/src/components/Tables/common/filters/tests/TextFilter.spec.ts +260 -0
  355. package/src/components/Tables/common/formatters.ts +72 -0
  356. package/src/components/Tables/common/locales.ts +31 -0
  357. package/src/components/Tables/common/organizeColumns/OrganizeColumns.vue +269 -0
  358. package/src/components/Tables/common/organizeColumns/sortHeaders.ts +9 -0
  359. package/src/components/Tables/common/tableAccessibilityUtils.ts +61 -0
  360. package/src/components/Tables/common/tableFilterUtils.ts +75 -0
  361. package/src/components/Tables/common/tableStorageUtils.ts +127 -0
  362. package/src/components/Tables/common/tableStyles.scss +80 -0
  363. package/src/components/Tables/common/tableUtils.ts +102 -0
  364. package/src/components/Tables/common/tests/SyTableFilter.spec.ts +312 -0
  365. package/src/components/Tables/common/tests/SyTablePagination.spec.ts +170 -0
  366. package/src/components/Tables/common/tests/filterByRange.spec.ts +215 -0
  367. package/src/components/Tables/common/tests/resize.spec.ts +161 -0
  368. package/src/components/Tables/common/tests/tableFilterUtils.spec.ts +92 -0
  369. package/src/components/Tables/common/tests/tableUtils.spec.ts +228 -0
  370. package/src/components/Tables/common/types.ts +92 -0
  371. package/src/components/Tables/common/usePagination.ts +83 -0
  372. package/src/components/Tables/common/useTableCheckbox.ts +58 -0
  373. package/src/components/Tables/common/useTableFilter.ts +19 -0
  374. package/src/components/Tables/common/useTableHeaders.ts +88 -0
  375. package/src/components/Tables/common/useTableItems.ts +87 -0
  376. package/src/components/Tables/common/useTableOptions.ts +93 -0
  377. package/src/components/Tables/index.ts +3 -0
  378. package/src/components/ToolbarContainer/ToolbarContainer.mdx +16 -0
  379. package/src/components/ToolbarContainer/ToolbarContainer.stories.ts +675 -0
  380. package/src/components/ToolbarContainer/ToolbarContainer.vue +128 -0
  381. package/src/components/ToolbarContainer/tests/ToolbarContainer.spec.ts +156 -0
  382. package/src/components/UploadWorkflow/AccessibiliteItems.ts +1 -1
  383. package/src/components/UserMenuBtn/AccessibiliteItems.ts +1 -1
  384. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +74 -0
  385. package/src/components/UserMenuBtn/UserMenuBtn.vue +19 -17
  386. package/src/components/index.ts +9 -5
  387. package/src/composables/date/useDateFormatDayjs.ts +8 -3
  388. package/src/composables/date/useDateInitializationDayjs.ts +28 -36
  389. package/src/composables/rules/useFieldValidation.ts +1 -2
  390. package/src/designTokens/index.ts +4 -0
  391. package/src/designTokens/tokens/cnam/cnamFonts.ts +140 -0
  392. package/src/designTokens/tokens/pa/paFonts.ts +140 -0
  393. package/src/designTokens/utils/createFontVariables.ts +143 -0
  394. package/src/designTokens/utils/index.ts +2 -1
  395. package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +293 -20
  396. package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +448 -54
  397. package/src/stories/Accessibilite/Audit/RGAA.mdx +231 -23
  398. package/src/stories/Accessibilite/Avancement/Avancement.mdx +591 -7
  399. package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +139 -38
  400. package/src/stories/Accessibilite/Introduction.mdx +258 -18
  401. package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +221 -31
  402. package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +204 -22
  403. package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +537 -24
  404. package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +577 -70
  405. package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +382 -31
  406. package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +419 -81
  407. package/src/stories/Accessibilite/Vuetify/Vuetify.mdx +132 -6
  408. package/src/stories/Accessibilite/Vuetify/Vuetify.stories.ts +370 -146
  409. package/src/stories/Accessibilite/Vuetify/VuetifyItems.ts +35 -57
  410. package/src/stories/Demarrer/Accueil.stories.ts +32 -8
  411. package/src/stories/DesignTokens/StylesTypographiques.mdx +10 -9
  412. package/src/stories/DesignTokens/StylesTypographiques.stories.new.ts +397 -0
  413. package/src/stories/DesignTokens/StylesTypographiques.stories.ts +397 -0
  414. package/src/stories/DesignTokens/TypographyDisplay.vue +155 -0
  415. package/src/stories/DesignTokens/vue-shims.d.ts +6 -0
  416. package/src/stories/GuideDuDev/LesBreackingChanges.mdx +0 -2
  417. package/src/stories/GuideDuDev/MigrationDepuisBridge.mdx +1 -1
  418. package/src/stories/GuideDuDev/MigrationDepuisVue2.mdx +1 -1
  419. package/src/stories/GuideDuDev/PortailAgent.mdx +10 -0
  420. package/src/stories/GuideDuDev/PortailAgent.stories.ts +506 -0
  421. package/src/stories/GuideDuDev/Theme.mdx +41 -0
  422. package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +1 -1
  423. package/src/utils/rules/isRequired/index.ts +2 -1
  424. package/src/vite-env.d.ts +12 -0
  425. package/src/vuetifyConfig.ts +10 -3
  426. package/dist/components/BackToTopBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  427. package/dist/components/ChipList/constants/ExpertiseLevelEnum.d.ts +0 -4
  428. package/dist/components/CollapsibleList/constants/ExpertiseLevelEnum.d.ts +0 -4
  429. package/dist/components/ContextualMenu/constants/ExpertiseLevelEnum.d.ts +0 -4
  430. package/dist/components/CookieBanner/constants/ExpertiseLevelEnum.d.ts +0 -4
  431. package/dist/components/CopyBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  432. package/dist/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.d.ts +0 -4
  433. package/dist/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.d.ts +0 -4
  434. package/dist/components/Customs/SySelect/constants/ExpertiseLevelEnum.d.ts +0 -4
  435. package/dist/components/Customs/SyTextField/constants/ExpertiseLevelEnum.d.ts +0 -4
  436. package/dist/components/DataList/constants/ExpertiseLevelEnum.d.ts +0 -4
  437. package/dist/components/DataListGroup/constants/ExpertiseLevelEnum.d.ts +0 -4
  438. package/dist/components/DatePicker/constants/ExpertiseLevelEnum.d.ts +0 -4
  439. package/dist/components/DialogBox/constants/ExpertiseLevelEnum.d.ts +0 -4
  440. package/dist/components/DownloadBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  441. package/dist/components/ErrorPage/constants/ExpertiseLevelEnum.d.ts +0 -4
  442. package/dist/components/ExternalLinks/constants/ExpertiseLevelEnum.d.ts +0 -4
  443. package/dist/components/FileList/constants/ExpertiseLevelEnum.d.ts +0 -4
  444. package/dist/components/FilePreview/constants/ExpertiseLevelEnum.d.ts +0 -4
  445. package/dist/components/FileUpload/constants/ExpertiseLevelEnum.d.ts +0 -4
  446. package/dist/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +0 -4
  447. package/dist/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  448. package/dist/components/FooterBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  449. package/dist/components/FranceConnectBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  450. package/dist/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.d.ts +0 -4
  451. package/dist/components/HeaderBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  452. package/dist/components/HeaderLoading/constants/ExpertiseLevelEnum.d.ts +0 -4
  453. package/dist/components/HeaderToolbar/constants/ExpertiseLevelEnum.d.ts +0 -4
  454. package/dist/components/LangBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  455. package/dist/components/Logo/constants/ExpertiseLevelEnum.d.ts +0 -4
  456. package/dist/components/LogoBrandSection/constants/ExpertiseLevelEnum.d.ts +0 -4
  457. package/dist/components/MaintenancePage/constants/ExpertiseLevelEnum.d.ts +0 -4
  458. package/dist/components/NirField/constants/ExpertiseLevelEnum.d.ts +0 -4
  459. package/dist/components/NotFoundPage/constants/ExpertiseLevelEnum.d.ts +0 -4
  460. package/dist/components/NotificationBar/constants/ExpertiseLevelEnum.d.ts +0 -4
  461. package/dist/components/PageContainer/constants/ExpertiseLevelEnum.d.ts +0 -4
  462. package/dist/components/PaginatedTable/constants/ExpertiseLevelEnum.d.ts +0 -4
  463. package/dist/components/PasswordField/constants/ExpertiseLevelEnum.d.ts +0 -4
  464. package/dist/components/PeriodField/constants/ExpertiseLevelEnum.d.ts +0 -4
  465. package/dist/components/PhoneField/constants/ExpertiseLevelEnum.d.ts +0 -4
  466. package/dist/components/RangeField/constants/ExpertiseLevelEnum.d.ts +0 -4
  467. package/dist/components/RatingPicker/constants/ExpertiseLevelEnum.d.ts +0 -4
  468. package/dist/components/SearchListField/constants/ExpertiseLevelEnum.d.ts +0 -4
  469. package/dist/components/SelectBtnField/constants/ExpertiseLevelEnum.d.ts +0 -4
  470. package/dist/components/SkipLink/constants/ExpertiseLevelEnum.d.ts +0 -4
  471. package/dist/components/SocialMediaLinks/constants/ExpertiseLevelEnum.d.ts +0 -4
  472. package/dist/components/SubHeader/constants/ExpertiseLevelEnum.d.ts +0 -4
  473. package/dist/components/SyAlert/constants/ExpertiseLevelEnum.d.ts +0 -4
  474. package/dist/components/TableToolbar/constants/ExpertiseLevelEnum.d.ts +0 -4
  475. package/dist/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +0 -4
  476. package/dist/components/UserMenuBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
  477. package/src/components/BackBtn/constants/ExpertiseLevelEnum.ts +0 -4
  478. package/src/components/BackToTopBtn/constants/ExpertiseLevelEnum.ts +0 -4
  479. package/src/components/ChipList/constants/ExpertiseLevelEnum.ts +0 -4
  480. package/src/components/CollapsibleList/constants/ExpertiseLevelEnum.ts +0 -4
  481. package/src/components/ContextualMenu/constants/ExpertiseLevelEnum.ts +0 -4
  482. package/src/components/CookieBanner/constants/ExpertiseLevelEnum.ts +0 -4
  483. package/src/components/CopyBtn/constants/ExpertiseLevelEnum.ts +0 -4
  484. package/src/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.ts +0 -4
  485. package/src/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.ts +0 -4
  486. package/src/components/Customs/SySelect/constants/ExpertiseLevelEnum.ts +0 -4
  487. package/src/components/Customs/SyTextField/constants/ExpertiseLevelEnum.ts +0 -4
  488. package/src/components/DataList/constants/ExpertiseLevelEnum.ts +0 -4
  489. package/src/components/DataListGroup/constants/ExpertiseLevelEnum.ts +0 -4
  490. package/src/components/DatePicker/DatePicker.mdx +0 -222
  491. package/src/components/DatePicker/DateTextInput.vue +0 -504
  492. package/src/components/DatePicker/constants/ExpertiseLevelEnum.ts +0 -4
  493. package/src/components/DialogBox/constants/ExpertiseLevelEnum.ts +0 -4
  494. package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +0 -4
  495. package/src/components/ErrorPage/constants/ExpertiseLevelEnum.ts +0 -4
  496. package/src/components/ExternalLinks/constants/ExpertiseLevelEnum.ts +0 -4
  497. package/src/components/FileList/constants/ExpertiseLevelEnum.ts +0 -4
  498. package/src/components/FilePreview/constants/ExpertiseLevelEnum.ts +0 -4
  499. package/src/components/FileUpload/constants/ExpertiseLevelEnum.ts +0 -4
  500. package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +0 -4
  501. package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +0 -4
  502. package/src/components/FooterBar/constants/ExpertiseLevelEnum.ts +0 -4
  503. package/src/components/FranceConnectBtn/constants/ExpertiseLevelEnum.ts +0 -4
  504. package/src/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.ts +0 -4
  505. package/src/components/HeaderBar/constants/ExpertiseLevelEnum.ts +0 -4
  506. package/src/components/HeaderLoading/constants/ExpertiseLevelEnum.ts +0 -4
  507. package/src/components/HeaderToolbar/constants/ExpertiseLevelEnum.ts +0 -4
  508. package/src/components/LangBtn/constants/ExpertiseLevelEnum.ts +0 -4
  509. package/src/components/Logo/constants/ExpertiseLevelEnum.ts +0 -4
  510. package/src/components/LogoBrandSection/constants/ExpertiseLevelEnum.ts +0 -4
  511. package/src/components/MaintenancePage/constants/ExpertiseLevelEnum.ts +0 -4
  512. package/src/components/NirField/constants/ExpertiseLevelEnum.ts +0 -4
  513. package/src/components/NotFoundPage/constants/ExpertiseLevelEnum.ts +0 -4
  514. package/src/components/NotificationBar/constants/ExpertiseLevelEnum.ts +0 -4
  515. package/src/components/PageContainer/constants/ExpertiseLevelEnum.ts +0 -4
  516. package/src/components/PaginatedTable/constants/ExpertiseLevelEnum.ts +0 -4
  517. package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +0 -886
  518. package/src/components/PasswordField/constants/ExpertiseLevelEnum.ts +0 -4
  519. package/src/components/PeriodField/constants/ExpertiseLevelEnum.ts +0 -4
  520. package/src/components/PhoneField/constants/ExpertiseLevelEnum.ts +0 -4
  521. package/src/components/RangeField/constants/ExpertiseLevelEnum.ts +0 -4
  522. package/src/components/RatingPicker/constants/ExpertiseLevelEnum.ts +0 -4
  523. package/src/components/SearchListField/constants/ExpertiseLevelEnum.ts +0 -4
  524. package/src/components/SelectBtnField/constants/ExpertiseLevelEnum.ts +0 -4
  525. package/src/components/SkipLink/constants/ExpertiseLevelEnum.ts +0 -4
  526. package/src/components/SocialMediaLinks/constants/ExpertiseLevelEnum.ts +0 -4
  527. package/src/components/SubHeader/constants/ExpertiseLevelEnum.ts +0 -4
  528. package/src/components/SyAlert/constants/ExpertiseLevelEnum.ts +0 -4
  529. package/src/components/TableToolbar/constants/ExpertiseLevelEnum.ts +0 -4
  530. package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +0 -4
  531. package/src/components/UserMenuBtn/constants/ExpertiseLevelEnum.ts +0 -4
  532. package/src/stories/DesignTokens/ThemePA.mdx +0 -35
  533. /package/src/components/DatePicker/{examples → playground}/DatePickerHolidayRule.vue +0 -0
@@ -0,0 +1,1111 @@
1
+ <script lang="ts" setup>
2
+ import { ref, computed, watch, onMounted } from 'vue'
3
+ import { nextTick } from 'vue'
4
+ import SyTextField from '../../Customs/SyTextField/SyTextField.vue'
5
+ import { useValidation, type ValidationRule, type ValidationResult } from '@/composables/validation/useValidation'
6
+ import dayjs from 'dayjs'
7
+ import customParseFormat from 'dayjs/plugin/customParseFormat'
8
+ import { useDateRangeInput, useDateRangeValidation, useDateFormatValidation, useDateValidation, useDateInputEditing, useManualDateValidation, useDateAutoClamp } from '../composables'
9
+ import { type DateObjectValue } from '../types'
10
+ import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
11
+ import { type DateValue } from '@/composables/date/useDateInitializationDayjs'
12
+ import { DATE_PICKER_MESSAGES } from '../constants/messages'
13
+
14
+ // Initialiser les plugins dayjs
15
+ dayjs.extend(customParseFormat)
16
+
17
+ const props = withDefaults(defineProps<{
18
+ modelValue?: DateValue
19
+ placeholder?: string
20
+ format?: string
21
+ dateFormatReturn?: string
22
+ label?: string
23
+ required?: boolean
24
+ disabled?: boolean
25
+ readonly?: boolean
26
+ isOutlined?: boolean
27
+ displayIcon?: boolean
28
+ displayAppendIcon?: boolean
29
+ noIcon?: boolean
30
+ customRules?: ValidationRule[]
31
+ customWarningRules?: ValidationRule[]
32
+ displayPrependIcon?: boolean
33
+ disableErrorHandling?: boolean
34
+ showSuccessMessages?: boolean
35
+ bgColor?: string
36
+ displayRange?: boolean
37
+ autoClamp?: boolean
38
+ }>(), {
39
+ modelValue: null,
40
+ placeholder: DATE_PICKER_MESSAGES.PLACEHOLDER_DEFAULT,
41
+ format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
42
+ dateFormatReturn: undefined,
43
+ label: undefined,
44
+ required: false,
45
+ disabled: false,
46
+ readonly: false,
47
+ isOutlined: true,
48
+ displayIcon: true,
49
+ displayAppendIcon: false,
50
+ noIcon: false,
51
+ customRules: () => [],
52
+ customWarningRules: () => [],
53
+ displayPrependIcon: true,
54
+ disableErrorHandling: false,
55
+ showSuccessMessages: true,
56
+ bgColor: 'white',
57
+ displayRange: false,
58
+ autoClamp: true,
59
+ })
60
+
61
+ const emit = defineEmits<{
62
+ (e: 'update:model-value', value: DateValue): void
63
+ (e: 'focus'): void
64
+ (e: 'blur'): void
65
+ (e: 'input', value: string): void
66
+ (e: 'date-selected', value: DateValue): void
67
+ }>()
68
+
69
+ const {
70
+ errors,
71
+ warnings,
72
+ successes,
73
+ hasError,
74
+ clearValidation,
75
+ validateField,
76
+ } = !props.readonly
77
+ ? useValidation({
78
+ showSuccessMessages: props.showSuccessMessages,
79
+ fieldIdentifier: props.label || props.placeholder,
80
+ disableErrorHandling: props.disableErrorHandling,
81
+ })
82
+ : {
83
+ errors: ref<string[]>([]),
84
+ warnings: ref<string[]>([]),
85
+ successes: ref<string[]>([]),
86
+ hasError: ref(false),
87
+ clearValidation: () => {},
88
+ validateField: () => ({ hasError: false, hasWarning: false, hasSuccess: false, state: { errors: [], warnings: [], successes: [] } }),
89
+ }
90
+
91
+ const errorMessages = errors
92
+ const warningMessages = warnings
93
+ const successMessages = successes
94
+
95
+ // Fonction intermédiaire pour adapter validateField à la signature attendue par useDateValidation
96
+ const validateFieldAdapter = (value: unknown, rules?: ValidationRule[], warningRules?: ValidationRule[]): ValidationResult => {
97
+ // Si validateField est une fonction vide (cas readonly), retourner un résultat par défaut
98
+ if (typeof validateField === 'function' && validateField.toString().includes('() => {}')) {
99
+ return {
100
+ hasError: false,
101
+ hasWarning: false,
102
+ hasSuccess: false,
103
+ state: {
104
+ errors: [],
105
+ warnings: [],
106
+ successes: [],
107
+ },
108
+ }
109
+ }
110
+
111
+ const result = validateField(value, rules, warningRules)
112
+ if (!result) {
113
+ return {
114
+ hasError: false,
115
+ hasWarning: false,
116
+ hasSuccess: false,
117
+ state: {
118
+ errors: [],
119
+ warnings: [],
120
+ successes: [],
121
+ },
122
+ }
123
+ }
124
+ return result
125
+ }
126
+
127
+ const inputValue = ref('')
128
+
129
+ // Utilisation des composables pour la gestion des plages de dates
130
+ const { parseDate, formatDate } = useDateFormat()
131
+
132
+ // Utilisation du composable pour l'auto-clamping des dates invalides
133
+ const { autoClampDate } = useDateAutoClamp()
134
+
135
+ // Référence pour stocker les dates sélectionnées (pour le mode plage)
136
+ const selectedDates = ref<DateObjectValue>(null)
137
+
138
+ // Utilisation du composable pour la saisie des plages de dates
139
+ const {
140
+ handleRangeInput,
141
+ resetState,
142
+ isValidRange,
143
+ initializeWithDates,
144
+ formatRangeForDisplay,
145
+ parseRangeInput,
146
+ handleKeydown: handleKeydownRangeDate,
147
+ handlePaste: handlePasteRangeDate,
148
+ } = useDateRangeInput(
149
+ props.format,
150
+ props.displayRange,
151
+ parseDate,
152
+ formatDate,
153
+ )
154
+
155
+ // Utilisation du composable pour la validation des plages de dates
156
+ const { currentRangeIsValid, getRangeValidationError } = useDateRangeValidation(selectedDates, props.displayRange)
157
+
158
+ // Variable pour éviter les mises à jour récursives
159
+ const isUpdatingFromInternal = ref(false)
160
+
161
+ const isFocused = ref(false)
162
+ const hasInteracted = ref(false)
163
+
164
+ // Utilisation du composable pour la validation du format des dates
165
+ const { validateDateFormat: validateDateFormatFn } = useDateFormatValidation({
166
+ format: props.format,
167
+ dateFormatReturn: props.dateFormatReturn,
168
+ required: props.required,
169
+ hasInteracted,
170
+ disableErrorHandling: props.disableErrorHandling,
171
+ })
172
+
173
+ // Utilisation du composable pour la validation des dates
174
+ const { validateDates } = useDateValidation({
175
+ noCalendar: false,
176
+ required: props.required,
177
+ displayRange: props.displayRange,
178
+ disableErrorHandling: props.disableErrorHandling,
179
+ customRules: props.customRules,
180
+ customWarningRules: props.customWarningRules,
181
+ selectedDates,
182
+ isUpdatingFromInternal,
183
+ currentRangeIsValid,
184
+ getRangeValidationError,
185
+ clearValidation,
186
+ validateField: validateFieldAdapter,
187
+ errors,
188
+ warnings,
189
+ successes,
190
+ })
191
+
192
+ // Utilisation du composable pour gérer l'édition manuelle des dates
193
+ const ariaLabel = ref('')
194
+
195
+ const updateDisplayValue = (value: string) => {
196
+ inputValue.value = value
197
+ }
198
+
199
+ const updateAriaLabel = (value: string) => {
200
+ ariaLabel.value = value
201
+ }
202
+
203
+ const { formatDateInput, handleKeydown: handleKeydownSingleDate, handlePaste: handlePasteSingleDate } = useDateInputEditing({
204
+ format: props.format,
205
+ updateDisplayValue,
206
+ updateAriaLabel,
207
+ accessiblePlaceholders: true,
208
+ })
209
+
210
+ const validateDateFormat = (dateStr: string): { isValid: boolean, message: string } => {
211
+ if (props.readonly) return { isValid: true, message: '' }
212
+
213
+ // Si nous sommes en mode plage de dates et que la chaîne contient un séparateur de plage
214
+ if (props.displayRange && dateStr.includes(' - ')) {
215
+ // Diviser la chaîne en deux parties
216
+ const parts = dateStr.split(' - ')
217
+ const startDateStr = parts[0]?.trim() || ''
218
+ const endDateStr = parts[1]?.trim() || ''
219
+
220
+ // Valider chaque partie séparément
221
+ const startValidation = validateDateFormatFn(startDateStr)
222
+ const endValidation = endDateStr ? validateDateFormatFn(endDateStr) : { isValid: true, message: '' }
223
+
224
+ // Si les deux parties sont valides ou si la première est valide et la seconde est vide
225
+ if (startValidation.isValid && endValidation.isValid) {
226
+ return { isValid: true, message: '' }
227
+ }
228
+
229
+ // Si la première partie est invalide
230
+ if (!startValidation.isValid) {
231
+ return {
232
+ isValid: false,
233
+ message: `${DATE_PICKER_MESSAGES.ERROR_INVALID_FORMAT_START} (${props.format})`,
234
+ }
235
+ }
236
+
237
+ // Si la seconde partie est invalide
238
+ if (!endValidation.isValid) {
239
+ return {
240
+ isValid: false,
241
+ message: `${DATE_PICKER_MESSAGES.ERROR_INVALID_FORMAT_END} (${props.format})`,
242
+ }
243
+ }
244
+ }
245
+
246
+ // Utiliser le composable pour la validation standard
247
+ return validateDateFormatFn(dateStr)
248
+ }
249
+
250
+ // Initialiser le composable pour la validation manuelle des dates
251
+ const { validateManualInput } = useManualDateValidation({
252
+ format: props.format,
253
+ required: props.required,
254
+ disableErrorHandling: props.disableErrorHandling,
255
+ customRules: props.customRules,
256
+ customWarningRules: props.customWarningRules,
257
+ hasInteracted,
258
+ errors,
259
+ clearValidation,
260
+ validateDateFormat,
261
+ isDateComplete: (value: string) => value.length >= props.format.length,
262
+ parseDate,
263
+ validateField,
264
+ })
265
+
266
+ const validateRules = (value: string) => {
267
+ clearValidation()
268
+
269
+ // Cas spécial : champ vide
270
+ if (!value && props.required && hasInteracted.value) {
271
+ if (props.readonly) return true
272
+ if (!props.disableErrorHandling) {
273
+ errors.value.push(DATE_PICKER_MESSAGES.ERROR_REQUIRED)
274
+ }
275
+ return false
276
+ }
277
+
278
+ if (!value && !props.required) {
279
+ return true
280
+ }
281
+
282
+ // Traitement spécifique pour les plages de dates
283
+ if (props.displayRange && value.includes(' - ')) {
284
+ // Extraire les deux dates de la plage
285
+ const [startDateStr, endDateStr] = value.split(' - ')
286
+
287
+ // Si la plage est incomplète (seulement la première date suivie du séparateur)
288
+ if (startDateStr && !endDateStr) {
289
+ // Utiliser le composable pour valider uniquement la première date
290
+ return validateManualInput(startDateStr)
291
+ }
292
+
293
+ // Si nous avons les deux dates (plage complète)
294
+ if (startDateStr && endDateStr) {
295
+ // Valider le format des deux dates
296
+ const formatValidation = validateDateFormat(value)
297
+ if (!formatValidation.isValid) {
298
+ if (!props.disableErrorHandling && formatValidation.message) {
299
+ errors.value.push(formatValidation.message)
300
+ }
301
+ return false
302
+ }
303
+
304
+ // Valider chaque date séparément
305
+ const startDate = parseDate(startDateStr, props.format)
306
+ const endDate = parseDate(endDateStr, props.format)
307
+
308
+ if (startDate && endDate) {
309
+ // Appliquer les règles à chaque date individuellement
310
+ validateField(
311
+ startDate,
312
+ props.customRules,
313
+ props.customWarningRules,
314
+ )
315
+
316
+ // Si pas d'erreur sur la première date, valider la seconde
317
+ if (errors.value.length === 0) {
318
+ validateField(
319
+ endDate,
320
+ props.customRules,
321
+ props.customWarningRules,
322
+ )
323
+ }
324
+ }
325
+ }
326
+ }
327
+ else {
328
+ // Utiliser le composable pour la validation standard d'une date unique
329
+ return validateManualInput(value)
330
+ }
331
+
332
+ return !hasError.value
333
+ }
334
+
335
+ const isOnError = computed(() => warningMessages.value.length === 0 && successMessages.value.length === 0 && errorMessages.value.length > 0)
336
+ const isOnWarning = computed(() => errorMessages.value.length === 0 && successMessages.value.length === 0 && warningMessages.value.length > 0)
337
+ const isOnSuccess = computed(() => errorMessages.value.length === 0 && warningMessages.value.length === 0 && successMessages.value.length > 0)
338
+
339
+ // Raccourcis pour vérifier la présence d'erreurs, d'avertissements ou de succès
340
+ const hasWarning = computed(() => warningMessages.value.length > 0)
341
+
342
+ const getIcon = computed(() => {
343
+ if (errorMessages.value.length > 0) {
344
+ return 'error'
345
+ }
346
+ if (warningMessages.value.length > 0) {
347
+ return 'warning'
348
+ }
349
+ if (successMessages.value.length > 0 && !warningMessages.value.length) {
350
+ return 'success'
351
+ }
352
+ return undefined
353
+ })
354
+
355
+ const handleKeydown = (event: KeyboardEvent & { target: HTMLInputElement }) => {
356
+ // Utiliser l'implémentation du composable approprié en fonction du mode
357
+ if (props.displayRange) {
358
+ handleKeydownRangeDate(event)
359
+ }
360
+ else {
361
+ handleKeydownSingleDate(event)
362
+ }
363
+ }
364
+
365
+ const handlePaste = (event: ClipboardEvent) => {
366
+ // Utiliser l'implémentation du composable approprié en fonction du mode
367
+ if (props.displayRange) {
368
+ handlePasteRangeDate(event)
369
+ }
370
+ else {
371
+ handlePasteSingleDate(event)
372
+ }
373
+ }
374
+
375
+ const inputRef = ref<InstanceType<typeof SyTextField> | null>(null)
376
+
377
+ const isFormatting = ref(false)
378
+
379
+ watch(inputValue, async (newValue, oldValue) => {
380
+ if (isFormatting.value || newValue === oldValue) return
381
+
382
+ try {
383
+ isFormatting.value = true
384
+
385
+ if (!newValue) {
386
+ emit('update:model-value', null)
387
+ validateRules('')
388
+ // Réinitialiser l'état du composable pour les plages de dates
389
+ if (props.displayRange) {
390
+ resetState()
391
+ selectedDates.value = null
392
+ }
393
+ return
394
+ }
395
+
396
+ // Appliquer l'auto-clamping si activé
397
+ if (props.autoClamp) {
398
+ // Pour les plages de dates, traiter chaque partie séparément
399
+ if (props.displayRange && newValue.includes(' - ')) {
400
+ const parts = newValue.split(' - ')
401
+ const startDateStr = parts[0]?.trim() || ''
402
+ const endDateStr = parts[1]?.trim() || ''
403
+
404
+ // Appliquer l'auto-clamping à chaque partie si nécessaire
405
+ let adjusted = false
406
+ let clampedStart = startDateStr
407
+ let clampedEnd = endDateStr
408
+
409
+ if (startDateStr) {
410
+ const startResult = autoClampDate(startDateStr, props.format)
411
+ if (startResult.adjusted) {
412
+ clampedStart = startResult.clampedDate
413
+ adjusted = true
414
+ }
415
+ }
416
+
417
+ if (endDateStr) {
418
+ const endResult = autoClampDate(endDateStr, props.format)
419
+ if (endResult.adjusted) {
420
+ clampedEnd = endResult.clampedDate
421
+ adjusted = true
422
+ }
423
+ }
424
+
425
+ // Si un ajustement a été fait, mettre à jour la valeur
426
+ if (adjusted) {
427
+ const clampedValue = clampedEnd
428
+ ? `${clampedStart} - ${clampedEnd}`
429
+ : clampedStart
430
+ newValue = clampedValue
431
+ inputValue.value = clampedValue
432
+
433
+ // Mettre à jour le modèle avec les dates ajustées
434
+ const startDate = clampedStart ? parseDate(clampedStart, props.format) : null
435
+ const endDate = clampedEnd ? parseDate(clampedEnd, props.format) : null
436
+
437
+ if (startDate) {
438
+ // Mettre à jour les dates sélectionnées
439
+ if (endDate) {
440
+ selectedDates.value = [startDate, endDate]
441
+
442
+ // Formater les dates pour le modèle
443
+ const format = props.dateFormatReturn || props.format
444
+ const formattedStartDate = formatDate(startDate, format)
445
+ const formattedEndDate = formatDate(endDate, format)
446
+
447
+ // Émettre la plage de dates mise à jour
448
+ emit('update:model-value', [formattedStartDate, formattedEndDate])
449
+ }
450
+ else {
451
+ selectedDates.value = [startDate]
452
+
453
+ // Émettre la date de début mise à jour
454
+ const format = props.dateFormatReturn || props.format
455
+ const formattedStartDate = formatDate(startDate, format)
456
+ emit('update:model-value', formattedStartDate)
457
+ }
458
+ }
459
+ }
460
+ }
461
+ else {
462
+ // Pour une date unique
463
+ const result = autoClampDate(newValue, props.format)
464
+ if (result.adjusted) {
465
+ newValue = result.clampedDate
466
+ inputValue.value = result.clampedDate
467
+
468
+ // Mettre à jour le modèle avec la date ajustée
469
+ const date = parseDate(result.clampedDate, props.format)
470
+ if (date) {
471
+ const formattedDate = props.dateFormatReturn && props.dateFormatReturn !== props.format
472
+ ? formatDate(date, props.dateFormatReturn)
473
+ : formatDate(date, props.format)
474
+ emit('update:model-value', formattedDate)
475
+ }
476
+ }
477
+ }
478
+ }
479
+
480
+ const input = inputRef.value?.$el.querySelector('input')
481
+ const cursorPos = input?.selectionStart || 0
482
+
483
+ // Utiliser le composable de plage de dates si le mode plage est activé
484
+ if (props.displayRange) {
485
+ // S'assurer que newValue est une chaîne de caractères
486
+ if (typeof newValue !== 'string') {
487
+ // Si newValue n'est pas une chaîne, on ne peut pas appliquer le formatage
488
+ return
489
+ }
490
+
491
+ // Appliquer le formatage automatique aux dates saisies
492
+ const cleanedInput = newValue.replace(/[^\d]/g, '')
493
+ let formattedInput = ''
494
+
495
+ // Si l'entrée contient un séparateur de plage, traiter chaque partie séparément
496
+ if (newValue.includes(' - ')) {
497
+ const parts = newValue.split(' - ')
498
+ const firstPart = parts[0]
499
+ const secondPart = parts[1] || ''
500
+
501
+ // Formater la première partie
502
+ const formattedFirst = firstPart.length > 0 ? formatDateInput(firstPart).formatted : ''
503
+
504
+ // Formater la seconde partie
505
+ const formattedSecond = secondPart.length > 0 ? formatDateInput(secondPart).formatted : ''
506
+
507
+ // Combiner les deux parties
508
+ formattedInput = `${formattedFirst} - ${formattedSecond}`
509
+
510
+ newValue = formattedInput
511
+ }
512
+ else if (cleanedInput.length > 0) {
513
+ // Appliquer le formatage automatique à une date unique
514
+ const { formatted } = formatDateInput(newValue)
515
+ formattedInput = formatted
516
+ newValue = formattedInput
517
+ }
518
+
519
+ // Gérer la saisie de plage de dates avec le newValue formaté
520
+ // Lors de la première saisie (oldValue vide), ne pas envoyer la position du curseur
521
+ // car cela peut causer des problèmes avec le formatage initial
522
+ const result = !oldValue
523
+ ? handleRangeInput('', newValue)
524
+ : handleRangeInput(oldValue, newValue, cursorPos)
525
+
526
+ // Mettre à jour la valeur affichée
527
+ inputValue.value = result.formattedValue
528
+
529
+ // Mettre à jour les dates sélectionnées
530
+ if (result.dates[0]) {
531
+ // Si nous avons au moins une date
532
+ selectedDates.value = result.dates
533
+
534
+ // Valider les dates après la mise à jour
535
+ try {
536
+ isUpdatingFromInternal.value = true
537
+ validateDates()
538
+ }
539
+ finally {
540
+ setTimeout(() => {
541
+ isUpdatingFromInternal.value = false
542
+ }, 0)
543
+ }
544
+
545
+ // Si la plage est complète (deux dates)
546
+ if (result.isComplete && result.dates[1]) {
547
+ const [startDate, endDate] = result.dates
548
+
549
+ // Vérifier si la plage est valide
550
+ if (isValidRange(startDate, endDate)) {
551
+ // Formater les dates pour le modèle
552
+ const returnFormat = props.dateFormatReturn || props.format
553
+ const modelValue: [string, string] = [
554
+ formatDate(startDate, returnFormat),
555
+ formatDate(endDate, returnFormat),
556
+ ]
557
+
558
+ // Émettre les événements
559
+ emit('update:model-value', modelValue)
560
+ emit('date-selected', modelValue)
561
+ }
562
+ else {
563
+ errors.value.push(DATE_PICKER_MESSAGES.ERROR_END_BEFORE_START)
564
+ }
565
+ }
566
+ // Si nous venons juste de compléter la première date
567
+ else if (result.justCompletedFirstDate) {
568
+ // Émettre un événement pour la première date
569
+ const returnFormat = props.dateFormatReturn || props.format
570
+ const formattedDate = formatDate(result.dates[0], returnFormat)
571
+
572
+ // Émettre l'événement date-selected pour la première date
573
+ emit('date-selected', formattedDate)
574
+
575
+ // Note: Nous n'émettons pas update:model-value avec un tableau contenant null
576
+ // car le type DateValue n'accepte que [string, string] pour les plages
577
+ }
578
+ }
579
+ else {
580
+ // Aucune date sélectionnée
581
+ selectedDates.value = null
582
+
583
+ // Réinitialiser le modèle si nécessaire
584
+ if (props.modelValue !== null) {
585
+ emit('update:model-value', null)
586
+ }
587
+ }
588
+
589
+ // Émettre l'événement input
590
+ emit('input', result.formattedValue)
591
+
592
+ // Mettre à jour la position du curseur si nécessaire
593
+ if (result.cursorPosition !== undefined) {
594
+ setTimeout(() => {
595
+ if (input) {
596
+ input.setSelectionRange(result.cursorPosition, result.cursorPosition)
597
+ }
598
+ }, 0)
599
+ }
600
+ }
601
+ else {
602
+ // Mode date unique (comportement existant)
603
+ const { formatted, cursorPos: newPos } = formatDateInput(newValue, cursorPos)
604
+
605
+ if (formatted !== newValue) {
606
+ inputValue.value = formatted
607
+ await nextTick()
608
+ input?.setSelectionRange(newPos, newPos)
609
+ }
610
+
611
+ const isDateComplete = !formatted.includes('_')
612
+
613
+ if (isDateComplete) {
614
+ const validation = validateDateFormat(formatted)
615
+ if (validation.isValid) {
616
+ const date = dayjs(formatted, props.format, true).isValid()
617
+ ? dayjs(formatted, props.format).toDate()
618
+ : null
619
+
620
+ if (date) {
621
+ const formattedDate = props.dateFormatReturn
622
+ ? dayjs(date).format(props.dateFormatReturn)
623
+ : formatted
624
+ await nextTick()
625
+ emit('update:model-value', formattedDate)
626
+ emit('date-selected', formattedDate)
627
+ }
628
+ }
629
+ validateRules(formatted)
630
+ }
631
+ else {
632
+ clearValidation()
633
+ }
634
+ }
635
+ }
636
+ finally {
637
+ await nextTick()
638
+ isFormatting.value = false
639
+ }
640
+ })
641
+
642
+ watch(() => props.modelValue, (newValue: DateValue) => {
643
+ if (isFormatting.value) return
644
+
645
+ if (!newValue) {
646
+ inputValue.value = ''
647
+ return
648
+ }
649
+
650
+ // Gérer les plages de dates
651
+ if (props.displayRange && Array.isArray(newValue)) {
652
+ // Conversion explicite du type pour aider TypeScript
653
+ const dateArray = newValue as string[]
654
+
655
+ // Si nous avons une plage de dates complète
656
+ if (dateArray.length === 2) {
657
+ const [startDateStr, endDateStr] = newValue
658
+ const startDate = parseDate(startDateStr, props.dateFormatReturn || props.format)
659
+ const endDate = parseDate(endDateStr, props.dateFormatReturn || props.format)
660
+
661
+ if (startDate && endDate) {
662
+ // Initialiser les dates sélectionnées avec le composable
663
+ initializeWithDates(startDate, endDate)
664
+ selectedDates.value = [startDate, endDate]
665
+
666
+ // Valider les dates après la mise à jour
667
+ try {
668
+ isUpdatingFromInternal.value = true
669
+ validateDates()
670
+ }
671
+ finally {
672
+ setTimeout(() => {
673
+ isUpdatingFromInternal.value = false
674
+ }, 0)
675
+ }
676
+
677
+ // Utiliser le composable pour formater la plage
678
+ inputValue.value = formatRangeForDisplay(startDate, endDate)
679
+ validateRules(inputValue.value)
680
+ }
681
+ }
682
+ else if (dateArray.length === 1 && dateArray[0]) {
683
+ // Si nous avons seulement la première date
684
+ const startDate = parseDate(dateArray[0], props.dateFormatReturn || props.format)
685
+ if (startDate) {
686
+ // Initialiser avec seulement la date de début
687
+ initializeWithDates(startDate, null)
688
+ selectedDates.value = [startDate]
689
+
690
+ // Formater pour l'affichage
691
+ inputValue.value = formatRangeForDisplay(startDate, null)
692
+ }
693
+ }
694
+ }
695
+ // Gérer une date unique (comportement existant)
696
+ else {
697
+ const modelValueStr = typeof newValue === 'string' ? newValue : ''
698
+ const date = dayjs(modelValueStr, props.format, true).isValid()
699
+ ? dayjs(modelValueStr, props.format).toDate()
700
+ : null
701
+
702
+ if (date) {
703
+ if (props.dateFormatReturn && props.dateFormatReturn !== props.format) {
704
+ const formattedForReturn = dayjs(date).format(props.dateFormatReturn)
705
+ emit('update:model-value', formattedForReturn)
706
+ }
707
+
708
+ inputValue.value = dayjs(date).format(props.format)
709
+ validateRules(inputValue.value)
710
+ }
711
+ else {
712
+ inputValue.value = modelValueStr
713
+ validateRules(modelValueStr)
714
+ }
715
+ }
716
+ })
717
+
718
+ const handleFocus = () => {
719
+ isFocused.value = true
720
+ emit('focus')
721
+ }
722
+
723
+ const handleBlur = () => {
724
+ isFocused.value = false
725
+ hasInteracted.value = true
726
+
727
+ // Vérifier si la valeur est vide
728
+ if (inputValue.value) {
729
+ const validation = validateDateFormat(inputValue.value)
730
+ if (validation.isValid) {
731
+ // Si le format est valide, la date est également valide grâce à notre correction dans useDateFormatValidation
732
+ const formattedDate = props.dateFormatReturn
733
+ ? dayjs(inputValue.value, props.format).format(props.dateFormatReturn)
734
+ : inputValue.value
735
+ emit('update:model-value', formattedDate)
736
+ }
737
+ else {
738
+ // Si le format n'est pas valide ou si la date est invalide, ajouter le message d'erreur
739
+ clearValidation()
740
+ errors.value.push(validation.message)
741
+ emit('update:model-value', props.modelValue)
742
+ }
743
+ }
744
+
745
+ // Appliquer l'auto-clamping au moment du blur si activé
746
+ if (props.autoClamp) {
747
+ // Pour les plages de dates, traiter chaque partie séparément
748
+ if (props.displayRange && inputValue.value.includes(' - ')) {
749
+ const parts = inputValue.value.split(' - ')
750
+ const startDateStr = parts[0]?.trim() || ''
751
+ const endDateStr = parts[1]?.trim() || ''
752
+
753
+ // Appliquer l'auto-clamping à chaque partie si nécessaire
754
+ let adjusted = false
755
+ let clampedStart = startDateStr
756
+ let clampedEnd = endDateStr
757
+
758
+ if (startDateStr) {
759
+ const startResult = autoClampDate(startDateStr, props.format)
760
+ if (startResult.adjusted) {
761
+ clampedStart = startResult.clampedDate
762
+ adjusted = true
763
+ }
764
+ }
765
+
766
+ if (endDateStr) {
767
+ const endResult = autoClampDate(endDateStr, props.format)
768
+ if (endResult.adjusted) {
769
+ clampedEnd = endResult.clampedDate
770
+ adjusted = true
771
+ }
772
+ }
773
+
774
+ // Si un ajustement a été fait, mettre à jour la valeur
775
+ if (adjusted) {
776
+ const clampedValue = clampedEnd
777
+ ? `${clampedStart} - ${clampedEnd}`
778
+ : clampedStart
779
+ inputValue.value = clampedValue
780
+ }
781
+ }
782
+ else {
783
+ // Pour une date unique
784
+ const result = autoClampDate(inputValue.value, props.format)
785
+ if (result.adjusted) {
786
+ inputValue.value = result.clampedDate
787
+ }
788
+ }
789
+
790
+ // Après avoir appliqué l'autoClamp, mettre à jour le modèle
791
+ if (props.displayRange) {
792
+ // Utiliser directement parseRangeInput pour analyser la plage de dates
793
+ // sans passer par handleRangeInput qui peut causer des erreurs
794
+ const [startDate, endDate] = parseRangeInput(inputValue.value)
795
+
796
+ // Mettre à jour le modèle avec les dates analysées si la plage est complète
797
+ if (startDate) {
798
+ const returnFormat = props.dateFormatReturn || props.format
799
+ if (endDate) {
800
+ // Plage complète avec deux dates
801
+ const modelValue: [string, string] = [
802
+ formatDate(startDate, returnFormat),
803
+ formatDate(endDate, returnFormat),
804
+ ]
805
+ emit('update:model-value', modelValue)
806
+ }
807
+ // Sinon, on ne met pas à jour le modèle car on n'a qu'une date partielle
808
+ }
809
+ }
810
+ else {
811
+ // Traiter une date unique
812
+ const date = parseDate(inputValue.value, props.format)
813
+ if (date) {
814
+ const formattedDate = props.dateFormatReturn && props.dateFormatReturn !== props.format
815
+ ? formatDate(date, props.dateFormatReturn)
816
+ : formatDate(date, props.format)
817
+ emit('update:model-value', formattedDate)
818
+ }
819
+ }
820
+
821
+ // Valider les règles avec la valeur ajustée
822
+ validateRules(inputValue.value)
823
+ }
824
+
825
+ // Traitement spécifique pour les plages de dates
826
+ if (props.displayRange && inputValue.value) {
827
+ // Utiliser le composable pour analyser la plage de dates
828
+ const [startDate, endDate] = parseRangeInput(inputValue.value)
829
+
830
+ // Si nous avons une plage complète (deux dates)
831
+ if (startDate && endDate) {
832
+ // Vérifier si la plage est valide (date de fin >= date de début)
833
+ if (!isValidRange(startDate, endDate)) {
834
+ // Plage invalide, conserver l'erreur et ne pas mettre à jour le modèle
835
+ clearValidation()
836
+ errors.value.push(DATE_PICKER_MESSAGES.ERROR_END_BEFORE_START)
837
+ emit('update:model-value', props.modelValue)
838
+ return
839
+ }
840
+
841
+ // Mettre à jour les dates sélectionnées
842
+ selectedDates.value = [startDate, endDate]
843
+
844
+ // Formater correctement l'affichage
845
+ inputValue.value = formatRangeForDisplay(startDate, endDate)
846
+
847
+ // Plage valide, mettre à jour le modèle
848
+ const returnFormat = props.dateFormatReturn || props.format
849
+ const modelValue: [string, string] = [
850
+ formatDate(startDate, returnFormat),
851
+ formatDate(endDate, returnFormat),
852
+ ]
853
+ emit('update:model-value', modelValue)
854
+ validateRules(inputValue.value)
855
+ return
856
+ }
857
+ // Si nous avons seulement la première date
858
+ else if (startDate) {
859
+ // Mettre à jour les dates sélectionnées
860
+ selectedDates.value = [startDate]
861
+
862
+ // Valider les dates après la mise à jour
863
+ try {
864
+ isUpdatingFromInternal.value = true
865
+ validateDates()
866
+ }
867
+ finally {
868
+ setTimeout(() => {
869
+ isUpdatingFromInternal.value = false
870
+ }, 0)
871
+ }
872
+
873
+ // Formater correctement l'affichage
874
+ inputValue.value = formatRangeForDisplay(startDate, null)
875
+
876
+ // Mettre à jour l'affichage avec seulement la première date
877
+ const returnFormat = props.dateFormatReturn || props.format
878
+ const formattedDate = formatDate(startDate, returnFormat)
879
+
880
+ // Émettre l'événement date-selected pour la première date
881
+ emit('date-selected', formattedDate)
882
+
883
+ // Note: Nous n'émettons pas update:model-value avec un tableau contenant null
884
+ // car le type DateValue n'accepte que [string, string] pour les plages
885
+ validateRules(inputValue.value)
886
+ return
887
+ }
888
+ }
889
+
890
+ // Traitement standard pour les dates uniques ou les cas non couverts ci-dessus
891
+ if (inputValue.value) {
892
+ const validation = validateDateFormat(inputValue.value)
893
+ if (validation.isValid) {
894
+ const date = dayjs(inputValue.value, props.format, true).isValid()
895
+ ? dayjs(inputValue.value, props.format).toDate()
896
+ : null
897
+
898
+ if (date) {
899
+ const formattedDate = props.dateFormatReturn
900
+ ? dayjs(date).format(props.dateFormatReturn)
901
+ : inputValue.value
902
+ emit('update:model-value', formattedDate)
903
+ }
904
+ }
905
+ else {
906
+ emit('update:model-value', props.modelValue)
907
+ }
908
+ }
909
+ else if (props.required) {
910
+ emit('update:model-value', props.modelValue)
911
+ }
912
+ else {
913
+ emit('update:model-value', null)
914
+ }
915
+
916
+ // Appliquer la validation standard si elle n'a pas déjà été appliquée
917
+ if (errors.value.length === 0) {
918
+ validateRules(inputValue.value || '')
919
+ }
920
+ emit('blur')
921
+ }
922
+
923
+ const isValidating = ref(false)
924
+
925
+ const validateOnSubmit = async (): Promise<boolean> => {
926
+ isValidating.value = true
927
+ hasInteracted.value = true
928
+
929
+ try {
930
+ // Valider le format de la date
931
+ const isFormatValid = validateRules(inputValue.value)
932
+
933
+ if (!isFormatValid) {
934
+ return false
935
+ }
936
+
937
+ // Vérifier si nous avons des erreurs après la validation du format
938
+ if (hasError.value) {
939
+ return false
940
+ }
941
+
942
+ // Ajouter des messages de succès si nécessaire
943
+ if (props.showSuccessMessages && inputValue.value && !hasError.value && !hasWarning.value) {
944
+ successMessages.value.push(DATE_PICKER_MESSAGES.SUCCESS_VALID_DATE)
945
+ }
946
+
947
+ return !hasError.value
948
+ }
949
+ finally {
950
+ isValidating.value = false
951
+ }
952
+ }
953
+
954
+ defineExpose({
955
+ validateOnSubmit,
956
+ focus() {
957
+ // Utiliser un sélecteur plus spécifique pour cibler l'input principal
958
+ // SyTextField peut contenir plusieurs inputs, donc on cible le premier qui n'est pas caché
959
+ const input = inputRef.value?.$el.querySelector('input:not([type="hidden"])')
960
+ if (input) {
961
+ input.focus()
962
+ }
963
+ },
964
+ blur() {
965
+ // Utiliser un sélecteur plus spécifique pour cibler l'input principal
966
+ const input = inputRef.value?.$el.querySelector('input:not([type="hidden"])')
967
+ if (input) {
968
+ input.blur()
969
+ }
970
+ },
971
+ })
972
+
973
+ onMounted(() => {
974
+ if (!props.modelValue) {
975
+ return
976
+ }
977
+
978
+ // Gérer les plages de dates
979
+ if (props.displayRange && Array.isArray(props.modelValue)) {
980
+ // Si nous avons une plage de dates complète
981
+ if (props.modelValue.length === 2) {
982
+ const [startDateStr, endDateStr] = props.modelValue
983
+ const startDate = parseDate(startDateStr, props.dateFormatReturn || props.format)
984
+ const endDate = parseDate(endDateStr, props.dateFormatReturn || props.format)
985
+
986
+ if (startDate && endDate) {
987
+ // Initialiser les dates sélectionnées
988
+ selectedDates.value = [startDate, endDate]
989
+
990
+ // Formater la plage pour l'affichage
991
+ const formattedStart = formatDate(startDate, props.format)
992
+ const formattedEnd = formatDate(endDate, props.format)
993
+ inputValue.value = `${formattedStart} - ${formattedEnd}`
994
+ }
995
+ }
996
+ }
997
+ // Gérer une date unique (comportement existant)
998
+ else {
999
+ const modelValueStr = typeof props.modelValue === 'string' ? props.modelValue : ''
1000
+ const date = dayjs(modelValueStr, props.format, true).isValid()
1001
+ ? dayjs(modelValueStr, props.format).toDate()
1002
+ : null
1003
+
1004
+ if (date) {
1005
+ inputValue.value = dayjs(date).format(props.format)
1006
+ }
1007
+ else {
1008
+ inputValue.value = modelValueStr
1009
+ }
1010
+ }
1011
+ })
1012
+ </script>
1013
+
1014
+ <template>
1015
+ <SyTextField
1016
+ ref="inputRef"
1017
+ v-model="inputValue"
1018
+ :append-icon="displayIcon && displayAppendIcon ? 'calendar' : undefined"
1019
+ :append-inner-icon="getIcon"
1020
+ :class="{
1021
+ 'error-field': isOnError,
1022
+ 'warning-field': isOnWarning,
1023
+ 'success-field': isOnSuccess
1024
+ }"
1025
+ :disabled="props.disabled"
1026
+ :error-messages="errorMessages"
1027
+ :label="props.label || ''"
1028
+ :placeholder="props.placeholder"
1029
+ :no-icon="props.noIcon"
1030
+ :prepend-icon="displayIcon && displayPrependIcon && !displayAppendIcon ? 'calendar' : undefined"
1031
+ :readonly="props.readonly"
1032
+ :variant-style="props.isOutlined ? 'outlined' : 'underlined'"
1033
+ :warning-messages="warningMessages"
1034
+ :success-messages="props.showSuccessMessages ? successMessages : []"
1035
+ :bg-color="props.bgColor"
1036
+ color="primary"
1037
+ is-clearable
1038
+ :display-persistent-placeholder="true"
1039
+ :aria-label="ariaLabel || props.placeholder"
1040
+ title="Date text input"
1041
+ @focus="handleFocus"
1042
+ @blur="handleBlur"
1043
+ @keydown="handleKeydown"
1044
+ @paste="handlePaste"
1045
+ />
1046
+ </template>
1047
+
1048
+ <style lang="scss" scoped>
1049
+ @use '@/assets/tokens';
1050
+
1051
+ :deep(.v-icon__svg) { cursor: default; }
1052
+
1053
+ .warning-field {
1054
+ :deep(.v-input__details > .v-icon),
1055
+ :deep(.v-input__prepend > .v-icon),
1056
+ :deep(.v-input__append > .v-icon) {
1057
+ opacity: 1 !important;
1058
+ }
1059
+
1060
+ :deep(.v-field) {
1061
+ color: tokens.$colors-border-warning !important;
1062
+
1063
+ .v-field__outline {
1064
+ color: tokens.$colors-border-warning !important;
1065
+ }
1066
+ }
1067
+
1068
+ :deep(.v-messages) {
1069
+ opacity: 1 !important;
1070
+
1071
+ .v-messages__message {
1072
+ color: tokens.$colors-border-warning !important;
1073
+ }
1074
+ }
1075
+ }
1076
+
1077
+ .error-field {
1078
+ :deep(.v-input__control),
1079
+ :deep(.v-messages__message) {
1080
+ color: tokens.$colors-text-error !important;
1081
+ }
1082
+
1083
+ .v-field--active & {
1084
+ color: tokens.$colors-border-error !important;
1085
+ }
1086
+ }
1087
+
1088
+ .success-field {
1089
+ :deep(.v-input__details > .v-icon),
1090
+ :deep(.v-input__prepend > .v-icon),
1091
+ :deep(.v-input__append > .v-icon) {
1092
+ opacity: 1 !important;
1093
+ }
1094
+
1095
+ :deep(.v-field) {
1096
+ color: tokens.$colors-border-success !important;
1097
+
1098
+ .v-field__outline {
1099
+ color: tokens.$colors-border-success !important;
1100
+ }
1101
+ }
1102
+
1103
+ :deep(.v-messages) {
1104
+ opacity: 1 !important;
1105
+
1106
+ .v-messages__message {
1107
+ color: tokens.$colors-border-success !important;
1108
+ }
1109
+ }
1110
+ }
1111
+ </style>