@cnamts/synapse 1.0.1 → 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 (217) hide show
  1. package/README.md +1 -1
  2. package/dist/{DateFilter-BmRuzQ9Z.js → DateFilter-YWOTbfeL.js} +1 -1
  3. package/dist/{NumberFilter-CnIPDHqx.js → NumberFilter-DMmMgALM.js} +1 -1
  4. package/dist/{PeriodFilter-CZwZ8CnQ.js → PeriodFilter-Bok5BHcn.js} +1 -1
  5. package/dist/SelectFilter-BKud2WhN.js +136 -0
  6. package/dist/{TextFilter-DTxZHJwX.js → TextFilter-DvMf2thH.js} +1 -1
  7. package/dist/components/Accordion/Accordion.d.ts +2 -1
  8. package/dist/components/Accordion/composables/useAccordionGroupCommunication.d.ts +5 -0
  9. package/dist/components/Accordion/composables/useAccordionKeyboardNavigation.d.ts +12 -0
  10. package/dist/components/Accordion/composables/useAccordionState.d.ts +13 -0
  11. package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +85 -0
  12. package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
  13. package/dist/components/Customs/SySelect/SySelect.d.ts +33 -13
  14. package/dist/components/Customs/SyTextField/SyTextField.d.ts +2 -2
  15. package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +1585 -1452
  16. package/dist/components/DatePicker/DatePicker/DatePicker.d.ts +16 -2
  17. package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +3 -1
  18. package/dist/components/DatePicker/composables/index.d.ts +2 -0
  19. package/dist/components/DatePicker/composables/useAsteriskDisplay.d.ts +14 -0
  20. package/dist/components/DatePicker/composables/useDateAutoClamp.d.ts +16 -0
  21. package/dist/components/DatePicker/composables/useDateRangeInput.d.ts +1 -1
  22. package/dist/components/DatePicker/composables/useDisplayedDateString.d.ts +3 -0
  23. package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +1 -0
  24. package/dist/components/DatePicker/composables/useMonthButtonCustomization.d.ts +5 -2
  25. package/dist/components/NirField/NirField.d.ts +7 -3
  26. package/dist/components/NirField/nirValidation.d.ts +1 -1
  27. package/dist/components/PasswordField/PasswordField.d.ts +2 -0
  28. package/dist/components/PeriodField/PeriodField.d.ts +52 -8
  29. package/dist/components/PhoneField/PhoneField.d.ts +2 -2
  30. package/dist/components/RangeField/RangeField.d.ts +2 -0
  31. package/dist/components/SearchListField/SearchListField.d.ts +9 -0
  32. package/dist/components/SyTextArea/SyTextArea.d.ts +2 -0
  33. package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +14 -9
  34. package/dist/components/Tables/SyTable/SyTable.d.ts +12 -7
  35. package/dist/components/Tables/common/SyTablePagination.d.ts +1636 -0
  36. package/dist/components/Tables/common/TableHeader.d.ts +2 -20
  37. package/dist/components/Tables/common/filters/SelectFilter.d.ts +5 -5
  38. package/dist/components/Tables/common/filters/getFilterComponent.d.ts +1 -0
  39. package/dist/components/Tables/common/filters/locales.d.ts +4 -0
  40. package/dist/components/Tables/common/filters/logics/date.d.ts +1 -0
  41. package/dist/components/Tables/common/filters/logics/number.d.ts +1 -0
  42. package/dist/components/Tables/common/filters/logics/period.d.ts +1 -0
  43. package/dist/components/Tables/common/filters/logics/select.d.ts +1 -0
  44. package/dist/components/Tables/common/filters/logics/text.d.ts +1 -0
  45. package/dist/components/Tables/common/locales.d.ts +21 -0
  46. package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +267 -0
  47. package/dist/components/Tables/common/organizeColumns/sortHeaders.d.ts +2 -0
  48. package/dist/components/Tables/common/tableFilterUtils.d.ts +1 -0
  49. package/dist/components/Tables/common/tableStorageUtils.d.ts +41 -1
  50. package/dist/components/Tables/common/tableUtils.d.ts +42 -5
  51. package/dist/components/Tables/common/types.d.ts +19 -8
  52. package/dist/components/Tables/common/usePagination.d.ts +22 -0
  53. package/dist/components/Tables/common/useTableCheckbox.d.ts +20 -0
  54. package/dist/components/Tables/common/useTableHeaders.d.ts +76 -0
  55. package/dist/components/Tables/common/useTableItems.d.ts +24 -0
  56. package/dist/components/Tables/common/useTableOptions.d.ts +18 -0
  57. package/dist/components/ToolbarContainer/ToolbarContainer.d.ts +11 -0
  58. package/dist/components/UserMenuBtn/UserMenuBtn.d.ts +9 -2
  59. package/dist/components/index.d.ts +8 -6
  60. package/dist/design-system-v3.js +58 -56
  61. package/dist/design-system-v3.umd.cjs +22 -22
  62. package/dist/main-Cx8qG7YR.js +16344 -0
  63. package/dist/stories/Accessibilite/Vuetify/VuetifyItems.d.ts +14 -2
  64. package/dist/stories/DesignTokens/StylesTypographiques.stories.new.d.ts +8 -0
  65. package/dist/stories/DesignTokens/TypographyDisplay.d.ts +28 -0
  66. package/dist/stories/DesignTokens/vue-shims.d.ts +6 -0
  67. package/dist/style.css +1 -1
  68. package/package.json +1 -1
  69. package/src/common/imgs/accessibility-svgrepo-com.svg +4 -0
  70. package/src/components/Accordion/Accessibilite/AccessibilityGuide.mdx +249 -0
  71. package/src/components/Accordion/Accordion.vue +48 -76
  72. package/src/components/Accordion/composables/__tests__/useAccordionGroupCommunication.spec.ts +146 -0
  73. package/src/components/Accordion/composables/__tests__/useAccordionKeyboardNavigation.spec.ts +209 -0
  74. package/src/components/Accordion/composables/__tests__/useAccordionState.spec.ts +144 -0
  75. package/src/components/Accordion/composables/useAccordionGroupCommunication.ts +52 -0
  76. package/src/components/Accordion/composables/useAccordionKeyboardNavigation.ts +111 -0
  77. package/src/components/Accordion/composables/useAccordionState.ts +59 -0
  78. package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +3 -0
  79. package/src/components/Customs/SyCheckbox/Accessibilite.mdx +303 -0
  80. package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +50 -0
  81. package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +630 -0
  82. package/src/components/Customs/SyCheckbox/SyCheckbox.vue +326 -0
  83. package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +201 -0
  84. package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +1 -0
  85. package/src/components/Customs/SyInputSelect/SyInputSelect.vue +8 -1
  86. package/src/components/Customs/SySelect/SySelect.stories.ts +160 -0
  87. package/src/components/Customs/SySelect/SySelect.vue +291 -32
  88. package/src/components/Customs/SySelect/tests/SySelect.spec.ts +230 -0
  89. package/src/components/Customs/SyTextField/SyTextField.stories.ts +3 -2
  90. package/src/components/Customs/SyTextField/SyTextField.vue +19 -8
  91. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +241 -31
  92. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +305 -57
  93. package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.events.spec.ts +161 -0
  94. package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +4 -2
  95. package/src/components/DatePicker/DatePicker/DatePicker.stories.ts +259 -137
  96. package/src/components/DatePicker/DatePicker/DatePicker.vue +153 -25
  97. package/src/components/DatePicker/DatePicker/tests/DatePicker.events.spec.ts +189 -0
  98. package/src/components/DatePicker/DatePicker/{DatePicker.spec.ts → tests/DatePicker.spec.ts} +1 -15
  99. package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +24 -14
  100. package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +148 -0
  101. package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +3 -1
  102. package/src/components/DatePicker/DateTextInput/DateTextInput.vue +200 -5
  103. package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +241 -31
  104. package/src/components/DatePicker/composables/index.ts +2 -0
  105. package/src/components/DatePicker/composables/tests/useDateAutoClamp.spec.ts +190 -0
  106. package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +182 -4
  107. package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +105 -80
  108. package/src/components/DatePicker/composables/useAsteriskDisplay.ts +31 -0
  109. package/src/components/DatePicker/composables/useDateAutoClamp.ts +136 -0
  110. package/src/components/DatePicker/composables/useDateRangeInput.ts +21 -18
  111. package/src/components/DatePicker/composables/useDisplayedDateString.ts +13 -1
  112. package/src/components/DatePicker/composables/useInputBlurHandler.ts +84 -20
  113. package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +149 -51
  114. package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +10 -0
  115. package/src/components/ErrorPage/Accessibilite.stories.ts +8 -0
  116. package/src/components/ErrorPage/ErrorPage.vue +12 -6
  117. package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +4 -4
  118. package/src/components/NirField/NirField.mdx +22 -9
  119. package/src/components/NirField/NirField.stories.ts +26 -2
  120. package/src/components/NirField/NirField.vue +209 -22
  121. package/src/components/NirField/nirValidation.ts +17 -3
  122. package/src/components/NirField/tests/NirField.spec.ts +2 -2
  123. package/src/components/NotFoundPage/Accessibilite.stories.ts +8 -0
  124. package/src/components/NotFoundPage/NotFoundPage.vue +2 -1
  125. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +8 -6
  126. package/src/components/PaginatedTable/PaginatedTable.mdx +2 -0
  127. package/src/components/PasswordField/PasswordField.stories.ts +4 -0
  128. package/src/components/PasswordField/PasswordField.vue +3 -0
  129. package/src/components/PeriodField/PeriodField.vue +2 -0
  130. package/src/components/PhoneField/PhoneField.stories.ts +15 -15
  131. package/src/components/PhoneField/PhoneField.vue +1 -1
  132. package/src/components/RangeField/RangeField.stories.ts +9 -0
  133. package/src/components/RangeField/RangeField.vue +4 -0
  134. package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +12 -0
  135. package/src/components/SearchListField/SearchListField.vue +5 -0
  136. package/src/components/SyTextArea/SyTextArea.vue +3 -0
  137. package/src/components/SyTextArea/tests/SyTextArea.spec.ts +0 -1
  138. package/src/components/Tables/SyServerTable/FilterRules.stories.ts +632 -15
  139. package/src/components/Tables/SyServerTable/SyServerTable.mdx +15 -5
  140. package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +2844 -1377
  141. package/src/components/Tables/SyServerTable/SyServerTable.vue +155 -66
  142. package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +256 -4
  143. package/src/components/Tables/SyTable/FilterRules.stories.ts +183 -0
  144. package/src/components/Tables/SyTable/SyTable.mdx +14 -4
  145. package/src/components/Tables/SyTable/SyTable.stories.ts +1265 -477
  146. package/src/components/Tables/SyTable/SyTable.vue +152 -72
  147. package/src/components/Tables/SyTable/tests/SyTable.spec.ts +366 -4
  148. package/src/components/Tables/common/SyTableFilter.vue +3 -56
  149. package/src/components/Tables/common/SyTablePagination.vue +375 -0
  150. package/src/components/Tables/common/TableHeader.vue +10 -26
  151. package/src/components/Tables/common/filters/SelectFilter.vue +131 -22
  152. package/src/components/Tables/common/filters/getFilterComponent.ts +54 -0
  153. package/src/components/Tables/common/filters/locales.ts +4 -0
  154. package/src/components/Tables/common/filters/logics/date.ts +12 -0
  155. package/src/components/Tables/common/filters/logics/number.ts +48 -0
  156. package/src/components/Tables/common/filters/logics/period.ts +25 -0
  157. package/src/components/Tables/common/filters/logics/select.ts +27 -0
  158. package/src/components/Tables/common/filters/logics/tests/TextFilterLogic.spec.ts +177 -0
  159. package/src/components/Tables/common/filters/logics/text.ts +62 -0
  160. package/src/components/Tables/common/filters/tests/TextFilter.spec.ts +11 -11
  161. package/src/components/Tables/common/locales.ts +24 -0
  162. package/src/components/Tables/common/organizeColumns/OrganizeColumns.vue +269 -0
  163. package/src/components/Tables/common/organizeColumns/sortHeaders.ts +9 -0
  164. package/src/components/Tables/common/tableFilterUtils.ts +43 -295
  165. package/src/components/Tables/common/tableStorageUtils.ts +27 -2
  166. package/src/components/Tables/common/tableStyles.scss +26 -0
  167. package/src/components/Tables/common/tableUtils.ts +3 -16
  168. package/src/components/Tables/common/tests/SyTablePagination.spec.ts +170 -0
  169. package/src/components/Tables/common/tests/filterByRange.spec.ts +215 -0
  170. package/src/components/Tables/common/tests/tableFilterUtils.spec.ts +0 -14
  171. package/src/components/Tables/common/tests/tableUtils.spec.ts +7 -51
  172. package/src/components/Tables/common/types.ts +17 -6
  173. package/src/components/Tables/common/usePagination.ts +83 -0
  174. package/src/components/Tables/common/useTableCheckbox.ts +58 -0
  175. package/src/components/Tables/common/useTableHeaders.ts +88 -0
  176. package/src/components/Tables/common/useTableItems.ts +87 -0
  177. package/src/components/Tables/common/useTableOptions.ts +93 -0
  178. package/src/components/ToolbarContainer/ToolbarContainer.mdx +16 -0
  179. package/src/components/ToolbarContainer/ToolbarContainer.stories.ts +675 -0
  180. package/src/components/ToolbarContainer/ToolbarContainer.vue +128 -0
  181. package/src/components/ToolbarContainer/tests/ToolbarContainer.spec.ts +156 -0
  182. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +74 -0
  183. package/src/components/UserMenuBtn/UserMenuBtn.vue +19 -17
  184. package/src/components/index.ts +8 -6
  185. package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +293 -20
  186. package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +448 -54
  187. package/src/stories/Accessibilite/Audit/RGAA.mdx +231 -23
  188. package/src/stories/Accessibilite/Avancement/Avancement.mdx +591 -7
  189. package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +139 -38
  190. package/src/stories/Accessibilite/Introduction.mdx +258 -18
  191. package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +221 -31
  192. package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +204 -22
  193. package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +537 -24
  194. package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +577 -70
  195. package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +382 -31
  196. package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +419 -81
  197. package/src/stories/Accessibilite/Vuetify/Vuetify.mdx +132 -6
  198. package/src/stories/Accessibilite/Vuetify/Vuetify.stories.ts +370 -146
  199. package/src/stories/Accessibilite/Vuetify/VuetifyItems.ts +35 -57
  200. package/src/stories/Demarrer/Accueil.stories.ts +20 -5
  201. package/src/stories/DesignTokens/StylesTypographiques.mdx +10 -9
  202. package/src/stories/DesignTokens/StylesTypographiques.stories.new.ts +397 -0
  203. package/src/stories/DesignTokens/StylesTypographiques.stories.ts +397 -0
  204. package/src/stories/DesignTokens/TypographyDisplay.vue +155 -0
  205. package/src/stories/DesignTokens/vue-shims.d.ts +6 -0
  206. package/src/stories/GuideDuDev/LesBreackingChanges.mdx +0 -2
  207. package/src/stories/GuideDuDev/MigrationDepuisBridge.mdx +1 -1
  208. package/src/stories/GuideDuDev/MigrationDepuisVue2.mdx +1 -1
  209. package/src/stories/GuideDuDev/PortailAgent.mdx +10 -0
  210. package/src/stories/GuideDuDev/PortailAgent.stories.ts +506 -0
  211. package/src/stories/GuideDuDev/Theme.mdx +41 -0
  212. package/dist/SelectFilter-Cj-GW2Cc.js +0 -97
  213. package/dist/main-WDqeoGM-.js +0 -14788
  214. package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +0 -886
  215. package/src/components/Tables/SyServerTable/tests/__snapshots__/SyServerTable.spec.ts.snap +0 -521
  216. package/src/components/Tables/SyTable/tests/__snapshots__/SyTable.spec.ts.snap +0 -521
  217. package/src/stories/DesignTokens/ThemePA.mdx +0 -35
@@ -12,8 +12,8 @@
12
12
  import { DATE_PICKER_MESSAGES } from '../constants/messages'
13
13
  import { useMonthButtonCustomization } from '../composables'
14
14
  import { mdiCalendar } from '@mdi/js'
15
+ import { useHolidayDay } from '@/composables/date/useHolidayDay'
15
16
  import {
16
- useWeekendDays,
17
17
  useTodayButton,
18
18
  useDatePickerViewMode,
19
19
  useDateSelection,
@@ -25,6 +25,7 @@
25
25
  useInputBlurHandler,
26
26
  useDatePickerVisibility,
27
27
  useDisplayedDateString,
28
+ useAsteriskDisplay,
28
29
  } from '../composables'
29
30
 
30
31
  import dayjs from 'dayjs'
@@ -37,8 +38,81 @@
37
38
  const { initializeSelectedDates } = useDateInitialization()
38
39
  const { updateAccessibility } = useDatePickerAccessibility()
39
40
 
41
+ // Variables pour suivre le mois et l'année actuellement affichés dans le DatePicker
42
+ const currentMonth = ref<string | null>(null)
43
+ const currentYear = ref<string | null>(null)
44
+ const currentMonthName = ref<string | null>(null)
45
+ const currentYearName = ref<string | null>(null)
46
+
47
+ const onUpdateMonth = (month: string) => {
48
+ // Éviter les mises à jour inutiles si le mois n'a pas changé
49
+ if (currentMonth.value === month) return
50
+
51
+ currentMonth.value = month
52
+ currentMonthName.value = dayjs().month(parseInt(month, 10)).format('MMMM')
53
+ handleMonthUpdate()
54
+ nextTick(() => {
55
+ if (isDatePickerVisible.value) {
56
+ customizeMonthButton()
57
+ markHolidayDays()
58
+ }
59
+ })
60
+ }
61
+
62
+ const onUpdateYear = (year: string) => {
63
+ const oldYear = currentYear.value
64
+ currentYear.value = year
65
+ currentYearName.value = year
66
+
67
+ // Gérer le changement d'année entre décembre et janvier
68
+ if (parseInt(year) > parseInt(oldYear || '0') && parseInt(currentMonth.value || '0') === 11) {
69
+ currentMonth.value = '0'
70
+ currentMonthName.value = dayjs().month(0).format('MMMM')
71
+ }
72
+ else if (parseInt(year) < parseInt(oldYear || '0') && parseInt(currentMonth.value || '0') === 0) {
73
+ currentMonth.value = '11'
74
+ currentMonthName.value = dayjs().month(11).format('MMMM')
75
+ }
76
+
77
+ handleYearUpdate()
78
+ handleMonthUpdate()
79
+ nextTick(() => {
80
+ if (isDatePickerVisible.value) {
81
+ customizeMonthButton()
82
+ markHolidayDays()
83
+ }
84
+ })
85
+ }
86
+
87
+ // Fonction pour gérer les dates sélectionnées depuis le DateTextInput
88
+ const handleDateSelected = (value: DateValue) => {
89
+ // Mettre à jour le modèle avec la nouvelle valeur
90
+ updateModel(value)
91
+
92
+ // Mettre à jour les dates sélectionnées
93
+ if (value === null) {
94
+ selectedDates.value = null
95
+ }
96
+ else if (Array.isArray(value)) {
97
+ // Pour les plages de dates
98
+ const dateObjects = value.map((dateStr) => {
99
+ return parseDate(dateStr, props.dateFormatReturn || props.format)
100
+ }).filter(Boolean) as Date[]
101
+ selectedDates.value = dateObjects
102
+ }
103
+ else {
104
+ // Pour une date unique
105
+ const dateObject = parseDate(value, props.dateFormatReturn || props.format)
106
+ selectedDates.value = dateObject
107
+ }
108
+
109
+ // Émettre l'événement date-selected
110
+ emit('date-selected', value)
111
+ }
112
+
40
113
  const props = withDefaults(defineProps<{
41
114
  modelValue?: DateInput
115
+ label?: string
42
116
  placeholder?: string
43
117
  format?: string
44
118
  dateFormatReturn?: string
@@ -66,10 +140,13 @@
66
140
  textFieldActivator?: boolean
67
141
  displayTodayButton?: boolean
68
142
  displayWeekendDays?: boolean
143
+ displayHolidayDays?: boolean
144
+ displayAsterisk?: boolean
69
145
  period?: {
70
146
  min?: string
71
147
  max?: string
72
148
  }
149
+ autoClamp?: boolean
73
150
  }>(), {
74
151
  modelValue: undefined,
75
152
  placeholder: DATE_PICKER_MESSAGES.PLACEHOLDER_DEFAULT,
@@ -93,16 +170,28 @@
93
170
  width: '100%',
94
171
  disableErrorHandling: false,
95
172
  showSuccessMessages: true,
96
- bgColor: undefined,
173
+ bgColor: 'white',
97
174
  textFieldActivator: false,
98
175
  displayTodayButton: true,
99
176
  displayWeekendDays: true,
177
+ displayHolidayDays: true,
178
+ displayAsterisk: false,
100
179
  period: () => ({
101
180
  min: '',
102
181
  max: '',
103
182
  }),
183
+ autoClamp: false,
184
+ label: DATE_PICKER_MESSAGES.PLACEHOLDER_DEFAULT,
104
185
  })
105
186
 
187
+ // Computed properties pour period
188
+ const minDate = computed(() =>
189
+ props.period?.min || dayjs().subtract(10, 'year').format(props.format),
190
+ )
191
+ const maxDate = computed(() =>
192
+ props.period?.max || dayjs().add(10, 'year').format(props.format),
193
+ )
194
+
106
195
  const emit = defineEmits<{
107
196
  (e: 'update:modelValue', value: DateValue): void
108
197
  (e: 'closed'): void
@@ -233,10 +322,6 @@
233
322
  'v-messages__message--warning': warningMessages.value.length > 0 && errorMessages.value.length < 1,
234
323
  })
235
324
 
236
- const inputStyle = computed(() => ({
237
- 'min-width': '100%',
238
- }))
239
-
240
325
  // Déclaration des variables qui seront initialisées par le composable useDateSelection
241
326
  const rangeBoundaryDates = ref<[Date | null, Date | null] | null>(null)
242
327
  // Initialisation des variables après la déclaration de selectedDates
@@ -247,6 +332,10 @@
247
332
  props.displayRange,
248
333
  )
249
334
 
335
+ watch(() => dateSelectionResult.rangeBoundaryDates.value, (newValue) => {
336
+ rangeBoundaryDates.value = newValue
337
+ }, { immediate: true })
338
+
250
339
  // Assignation des fonctions et variables retournées par le composable
251
340
  // Utiliser une fonction pour wrapper updateSelectedDates afin de maintenir la compatibilité avec le template
252
341
  const updateSelectedDates = (date: Date | null) => {
@@ -382,23 +471,83 @@
382
471
  }
383
472
  })
384
473
 
385
- // Fonction pour mettre à jour displayFormattedDate quand le VDatePicker change
474
+ /**
475
+ * Met à jour l'affichage formaté de la date lorsqu'une date est sélectionnée dans le calendrier
476
+ */
386
477
  const updateDisplayFormattedDate = () => {
387
- if (displayFormattedDateComputed.value) {
388
- displayFormattedDate.value = displayFormattedDateComputed.value
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
478
+ // Utiliser setTimeout pour s'assurer que toutes les mises à jour sont terminées
479
+ setTimeout(() => {
480
+ // Mettre à jour l'affichage formaté pour qu'il corresponde à la date sélectionnée
481
+ let formattedValue = ''
482
+
483
+ // Gérer la fermeture du DatePicker en fonction du mode et de l'état de sélection
484
+ if (props.displayRange) {
485
+ // Priorité à rangeBoundaryDates pour les plages
486
+ if (rangeBoundaryDates.value && rangeBoundaryDates.value[0] && rangeBoundaryDates.value[1]) {
487
+ // Les deux dates de la plage sont disponibles dans rangeBoundaryDates
488
+ const startDate = formatDate(rangeBoundaryDates.value[0], props.format)
489
+ const endDate = formatDate(rangeBoundaryDates.value[1], props.format)
490
+
491
+ // Formater l'affichage de la plage
492
+ formattedValue = `${startDate} - ${endDate}`
493
+ displayFormattedDate.value = formattedValue
494
+ textInputValue.value = formattedValue
495
+
496
+ // Mettre à jour le modèle avec les dates formatées
497
+ const formattedDates = [
498
+ formatDate(rangeBoundaryDates.value[0], props.dateFormatReturn || props.format),
499
+ formatDate(rangeBoundaryDates.value[1], props.dateFormatReturn || props.format),
500
+ ] as [string, string]
501
+
502
+ updateModel(formattedDates)
503
+ emit('date-selected', formattedDates)
504
+
505
+ // Les deux dates de la plage sont sélectionnées, fermer le DatePicker
506
+ isDatePickerVisible.value = false
507
+ emit('closed')
508
+ }
509
+ // Fallback sur selectedDates si rangeBoundaryDates n'est pas complet
510
+ else if (Array.isArray(selectedDates.value) && selectedDates.value.length >= 2) {
511
+ // Émettre l'événement date-selected avec les dates formatées
512
+ const formattedDates = [
513
+ formatDate(selectedDates.value[0], props.format),
514
+ formatDate(selectedDates.value[selectedDates.value.length - 1], props.format),
515
+ ] as [string, string]
516
+
517
+ formattedValue = `${formattedDates[0]} - ${formattedDates[1]}`
518
+ displayFormattedDate.value = formattedValue
519
+ textInputValue.value = formattedValue
520
+
521
+ // Mettre à jour le modèle avec les dates formatées
522
+ updateModel(formattedDates)
523
+ emit('date-selected', formattedDates)
524
+
525
+ // Les deux dates de la plage sont sélectionnées, fermer le DatePicker
526
+ isDatePickerVisible.value = false
527
+ emit('closed')
528
+ }
529
+ else {
530
+ // Utiliser la valeur calculée par le computed si disponible
531
+ formattedValue = displayFormattedDateComputed.value || ''
532
+ displayFormattedDate.value = formattedValue
533
+ textInputValue.value = formattedValue
534
+ }
535
+ }
536
+ else {
537
+ // En mode date unique
538
+ formattedValue = displayFormattedDateComputed.value || ''
539
+ displayFormattedDate.value = formattedValue
540
+ textInputValue.value = formattedValue
541
+
542
+ // En mode date unique, fermer le DatePicker après sélection
397
543
  isDatePickerVisible.value = false
398
544
  emit('closed')
545
+ emit('date-selected', formattedDate.value)
399
546
  }
547
+
548
+ // Valider les dates après mise à jour
400
549
  validateDates()
401
- }
550
+ }, 0) // setTimeout avec délai de 0ms pour s'exécuter après le cycle de rendu actuel
402
551
  }
403
552
 
404
553
  // Les variables useDateSelection sont maintenant déclarées et initialisées plus haut dans le code
@@ -408,6 +557,46 @@
408
557
  emit('blur')
409
558
  }
410
559
 
560
+ // Utilisation du composable pour les jours fériés
561
+ const { getJoursFeries } = useHolidayDay()
562
+
563
+ // Fonction pour marquer les jours fériés dans le calendrier
564
+ const markHolidayDays = () => {
565
+ // Si l'affichage des jours fériés est désactivé, ne rien faire
566
+ if (!props.displayHolidayDays) return
567
+
568
+ // Attendre que le DOM soit mis à jour
569
+ nextTick(() => {
570
+ // Récupérer l'année et le mois courants
571
+ const year = parseInt(currentYear.value || new Date().getFullYear().toString(), 10)
572
+ // Utiliser currentMonth.value !== null pour vérifier si la valeur est définie, même si c'est 0
573
+ const month = parseInt(currentMonth.value !== null ? currentMonth.value : new Date().getMonth().toString(), 10)
574
+
575
+ // Récupérer les jours fériés pour cette année
576
+ const joursFeries = getJoursFeries(year)
577
+ // Convertir les jours fériés en objets Date
578
+ const holidayDates = Array.from(joursFeries).map((dateStr) => {
579
+ const [day, monthStr, yearStr] = dateStr.split('/')
580
+ return new Date(parseInt(yearStr), parseInt(monthStr) - 1, parseInt(day))
581
+ })
582
+
583
+ // Filtrer les jours fériés pour le mois courant
584
+ const monthHolidays = holidayDates.filter((holiday) => {
585
+ return holiday.getMonth() === month && holiday.getFullYear() === year
586
+ })
587
+
588
+ // Pour chaque jour férié, trouver l'élément DOM correspondant et ajouter la classe
589
+ monthHolidays.forEach((holiday) => {
590
+ const day = holiday.getDate()
591
+ const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`
592
+ const dayElements = document.querySelectorAll(`[data-v-date="${dateStr}"]`)
593
+ dayElements.forEach((element) => {
594
+ element.classList.add('holiday-day')
595
+ })
596
+ })
597
+ })
598
+ }
599
+
411
600
  onMounted(() => {
412
601
  document.addEventListener('click', handleClickOutside)
413
602
 
@@ -455,17 +644,57 @@
455
644
 
456
645
  /**
457
646
  * Gère l'entrée utilisateur dans le champ de saisie de date
458
- * Délègue le traitement au composable useInputHandler
647
+ * Adapté pour fonctionner avec DateTextInput qui émet une valeur string au lieu d'un Event
459
648
  */
460
- const handleInput = (event: Event) => {
461
- // Utiliser la fonction handleInput du composable
462
- inputHandler.handleInput(event)
649
+ const handleInput = (eventOrValue: Event | string) => {
650
+ // Si c'est un événement standard, utiliser directement
651
+ if (eventOrValue instanceof Event) {
652
+ inputHandler.handleInput(eventOrValue)
653
+ return
654
+ }
655
+
656
+ // Si c'est une valeur string (venant du DateTextInput)
657
+ const inputElement = dateCalendarTextInputRef.value?.$el?.querySelector('input')
658
+ if (!inputElement) return
659
+
660
+ // Mettre à jour la valeur du modèle directement
661
+ textInputValue.value = eventOrValue
662
+
663
+ // Traitement spécifique pour les plages de dates
664
+ if (props.displayRange && typeof eventOrValue === 'string') {
665
+ // Vérifier si la plage est complète (contient un séparateur et deux dates)
666
+ if (eventOrValue.includes(' - ')) {
667
+ const parts = eventOrValue.split(' - ')
668
+ const startDateStr = parts[0]?.trim() || ''
669
+ const endDateStr = parts[1]?.trim() || ''
670
+
671
+ // Si les deux dates sont présentes et valides, mettre à jour le modèle
672
+ if (startDateStr && endDateStr && !endDateStr.includes('_')) {
673
+ // Convertir les dates en objets Date
674
+ const startDate = parseDate(startDateStr, props.format)
675
+ const endDate = parseDate(endDateStr, props.format)
676
+
677
+ if (startDate && endDate) {
678
+ // Mettre à jour les dates sélectionnées
679
+ selectedDates.value = [startDate, endDate]
680
+ // Valider la plage de dates
681
+ validateDates()
682
+ }
683
+ }
684
+ }
685
+ }
686
+ else {
687
+ // Pour une date unique
688
+ validateDates()
689
+ }
463
690
  }
464
691
  const datePickerRef = ref<null | ComponentPublicInstance<typeof VDatePicker>>()
465
692
 
466
- // Utilisation du composable pour personnaliser le bouton du mois
693
+ // Utilisation du composable pour personnaliser les boutons du mois et de l'année
467
694
  const { customizeMonthButton, setupMonthButtonObserver } = useMonthButtonCustomization(
468
695
  () => isDatePickerVisible.value,
696
+ currentMonthName,
697
+ currentYearName,
469
698
  )
470
699
 
471
700
  // Utilisation du composable pour gérer le mode d'affichage du DatePicker
@@ -501,6 +730,7 @@
501
730
  isManualInputActive,
502
731
  isUpdatingFromInternal,
503
732
  selectedDates,
733
+ errors,
504
734
  validateDateFormat,
505
735
  parseDate,
506
736
  formatDate,
@@ -519,6 +749,11 @@
519
749
  // Personnaliser le bouton du mois
520
750
  customizeMonthButton()
521
751
 
752
+ // Marquer les jours fériés lorsque le calendrier devient visible
753
+ if (props.displayHolidayDays) {
754
+ markHolidayDays()
755
+ }
756
+
522
757
  // set the focus on the date picker
523
758
  await nextTick()
524
759
  const firstButton = datePickerRef.value?.$el.querySelector('button')
@@ -788,7 +1023,7 @@
788
1023
 
789
1024
  // Mettre à jour la description accessible lorsque la valeur affichée change
790
1025
  watch(displayFormattedDate, (newValue) => {
791
- if (newValue) {
1026
+ if (newValue && typeof newValue === 'string') {
792
1027
  // Créer une version accessible pour les lecteurs d'écran (sans les caractères de placeholder)
793
1028
  const accessibleValue = newValue.replace(/_/g, ' ')
794
1029
 
@@ -800,18 +1035,13 @@
800
1035
  }
801
1036
  })
802
1037
 
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
1038
  const { todayInString, selectToday } = useTodayButton(props)
1039
+ const { labelWithAsterisk } = useAsteriskDisplay(props)
811
1040
 
812
1041
  // Utilisation du composable pour l'affichage formaté des dates
813
1042
  const { displayedDateString } = useDisplayedDateString({
814
1043
  selectedDates,
1044
+ rangeBoundaryDates,
815
1045
  todayInString,
816
1046
  })
817
1047
 
@@ -831,6 +1061,8 @@
831
1061
  updateAccessibility,
832
1062
  openDatePicker,
833
1063
  updateDisplayFormattedDate,
1064
+ currentMonth, // Exposer le mois actuellement affiché
1065
+ currentMonthName, // Exposer le nom du mois actuellement affiché
834
1066
  toggleDatePicker,
835
1067
  validateField,
836
1068
  clearValidation,
@@ -845,7 +1077,6 @@
845
1077
  <template>
846
1078
  <div
847
1079
  class="date-picker-container"
848
- :style="inputStyle"
849
1080
  >
850
1081
  <!-- Variable pour stocker la description accessible -->
851
1082
  <span
@@ -861,7 +1092,7 @@
861
1092
  :class="[getMessageClasses(), 'label-hidden-on-focus']"
862
1093
  :date-format-return="props.dateFormatReturn"
863
1094
  :format="props.format"
864
- :label="props.placeholder"
1095
+ :label="labelWithAsterisk || ''"
865
1096
  :placeholder="props.placeholder"
866
1097
  :required="props.required"
867
1098
  :custom-rules="props.customRules"
@@ -876,6 +1107,8 @@
876
1107
  :disable-error-handling="props.disableErrorHandling"
877
1108
  :show-success-messages="props.showSuccessMessages"
878
1109
  :bg-color="props.bgColor"
1110
+ :auto-clamp="props.autoClamp"
1111
+ :display-asterisk="props.displayAsterisk"
879
1112
  title="Date text input"
880
1113
  @focus="emit('focus')"
881
1114
  @blur="emit('blur')"
@@ -892,39 +1125,42 @@
892
1125
  :open-on-click="false"
893
1126
  scroll-strategy="none"
894
1127
  transition="fade-transition"
895
- attach="body"
896
- :offset="[-20, 5]"
1128
+ :offset="[0, 10]"
897
1129
  >
898
1130
  <template #activator="{ props: menuProps }">
899
- <SyTextField
1131
+ <DateTextInput
900
1132
  v-bind="menuProps"
901
1133
  ref="dateCalendarTextInputRef"
902
- v-model="displayFormattedDate"
903
- :append-icon="displayIcon && displayAppendIcon ? 'calendar' : undefined"
904
- :append-inner-icon="getIcon"
905
- :class="[getMessageClasses(), 'label-hidden-on-focus']"
906
- :error-messages="errorMessages"
907
- :warning-messages="warningMessages"
908
- :success-messages="props.showSuccessMessages ? successMessages : []"
1134
+ v-model="textInputValue"
1135
+ :label="labelWithAsterisk || ''"
1136
+ :placeholder="props.placeholder"
1137
+ :format="props.format"
1138
+ :date-format-return="props.dateFormatReturn"
1139
+ :required="props.required"
909
1140
  :disabled="props.disabled"
910
- :disable-click-button="false"
911
1141
  :readonly="props.readonly"
912
- :label="props.placeholder"
1142
+ :is-outlined="props.isOutlined"
1143
+ :display-icon="props.displayIcon"
1144
+ :display-append-icon="props.displayAppendIcon"
1145
+ :display-prepend-icon="props.displayPrependIcon"
913
1146
  :no-icon="props.noIcon"
914
- :prepend-icon="displayIcon && !displayAppendIcon ? 'calendar' : undefined"
915
- :variant-style="props.isOutlined ? 'outlined' : 'underlined'"
916
- color="primary"
1147
+ :custom-rules="props.customRules"
1148
+ :custom-warning-rules="props.customWarningRules"
1149
+ :display-asterisk="props.displayAsterisk"
1150
+ :disable-error-handling="props.disableErrorHandling"
917
1151
  :show-success-messages="props.showSuccessMessages"
918
1152
  :bg-color="props.bgColor"
919
- is-clearable
920
- title="Date Picker"
921
- :aria-label="accessibilityDescription"
1153
+ :display-range="props.displayRange"
1154
+ :display-persistent-placeholder="true"
1155
+ :class="[getMessageClasses(), 'label-hidden-on-focus']"
1156
+ :append-inner-icon="getIcon"
1157
+ :auto-clamp="props.autoClamp"
922
1158
  @click="openDatePickerOnClick"
923
1159
  @focus="openDatePickerOnFocus"
924
1160
  @blur="handleInputBlur"
925
- @update:model-value="updateSelectedDates"
926
1161
  @input="handleInput"
927
1162
  @keydown="handleKeydown"
1163
+ @date-selected="handleDateSelected"
928
1164
  @prepend-icon-click="openDatePickerOnIconClick"
929
1165
  @append-icon-click="openDatePickerOnIconClick"
930
1166
  />
@@ -934,7 +1170,7 @@
934
1170
  ref="datePickerRef"
935
1171
  v-model="selectedDates"
936
1172
  color="primary"
937
- :class="displayWeekendDays ? 'weekend' : ''"
1173
+ :class="props.displayWeekendDays ? 'weekend' : ''"
938
1174
  :first-day-of-week="1"
939
1175
  :multiple="props.displayRange ? 'range' : false"
940
1176
  :show-adjacent-months="true"
@@ -942,10 +1178,15 @@
942
1178
  :view-mode="currentViewMode"
943
1179
  :max="maxDate"
944
1180
  :min="minDate"
945
- @update:view-mode="handleViewModeUpdate"
946
- @update:year="handleYearUpdate"
947
- @update:month="handleMonthUpdate"
1181
+ :display-holiday-days="props.displayHolidayDays"
1182
+ :display-asterisk="props.displayAsterisk"
948
1183
  @update:model-value="updateDisplayFormattedDate"
1184
+ @update:view-mode="handleViewModeUpdate"
1185
+ @update:month="onUpdateMonth"
1186
+ @update:year="onUpdateYear"
1187
+ @click:date="updateSelectedDates"
1188
+ @focus="props.displayHolidayDays ? markHolidayDays : undefined"
1189
+ @update:month-year="props.displayHolidayDays ? markHolidayDays : undefined"
949
1190
  >
950
1191
  <template #title>
951
1192
  Sélectionnez une date
@@ -999,6 +1240,13 @@
999
1240
  }
1000
1241
  }
1001
1242
 
1243
+ /* Style pour les jours fériés */
1244
+ :deep(.holiday-day) {
1245
+ background-color: rgb(255 193 7 / 10%);
1246
+ border: 2px dotted tokens.$neutral-black;
1247
+ border-radius: 50%;
1248
+ }
1249
+
1002
1250
  :deep(.v-date-picker-controls .v-btn:last-child) {
1003
1251
  margin-inline-start: 0;
1004
1252
  }
@@ -1073,7 +1321,7 @@
1073
1321
  }
1074
1322
 
1075
1323
  .date-picker-container {
1076
- max-width: 100%;
1324
+ width: 100%;
1077
1325
  position: relative;
1078
1326
 
1079
1327
  :deep(.v-date-picker) {