@cnamts/synapse 1.0.23 → 1.0.24
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.
- package/dist/AutocompleteFilter-BWLR3U7W.js +114 -0
- package/dist/AutocompleteFilter-D9jzRzAL.cjs +1 -0
- package/dist/{DateFilter-Dc-gSGwk.js → DateFilter-BpwFexzi.js} +1 -1
- package/dist/DateFilter-DTUl8hb1.cjs +1 -0
- package/dist/{NumberFilter-vP38Wp6j.js → NumberFilter-Bz_NTdX9.js} +3 -3
- package/dist/NumberFilter-MAEojdk0.cjs +1 -0
- package/dist/PeriodFilter-CC4WgIhl.cjs +1 -0
- package/dist/{PeriodFilter-Ba1uYUnT.js → PeriodFilter-DX_wy9g-.js} +1 -1
- package/dist/SelectFilter-BR3fvl-a.cjs +1 -0
- package/dist/SelectFilter-xqiPtPgX.js +135 -0
- package/dist/{TextFilter-B84dpnoq.js → TextFilter-BBl3JFqK.js} +7 -7
- package/dist/TextFilter-CCfYFl5F.cjs +1 -0
- package/dist/apLightTheme-CFSRrjv2.cjs +1 -0
- package/dist/apLightTheme-D1P4jcD0.js +1231 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +7022 -9616
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.d.ts +40 -40
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.d.ts +60 -60
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +7168 -9762
- package/dist/components/Amelipro/AmeliproStepper/AmeliproStepper.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +7501 -10095
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +21 -21
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +41 -41
- package/dist/components/Amelipro/StructureMenu/StructureTabs/StructureTabs.d.ts +2 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +20 -498
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +108 -146
- package/dist/components/Customs/Selects/SyInputSelect/SyInputSelect.d.ts +5 -5
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +12 -16
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +8 -8
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +28 -506
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +28 -506
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +65 -85
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +627 -771
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +315 -402
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +112 -155
- package/dist/components/DatePicker/composables/index.d.ts +1 -0
- package/dist/components/DatePicker/composables/useDatePickerFocusTrap.d.ts +11 -0
- package/dist/components/DatePicker/composables/useDateTextField.d.ts +4 -4
- package/dist/components/DatePicker/composables/useDateValidation.d.ts +3 -3
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +2 -2
- package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +2 -2
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +4 -4
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +20 -28
- package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +3 -3
- package/dist/components/MonthPicker/MonthPicker.d.ts +86 -122
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +85 -121
- package/dist/components/NirField/NirField.d.ts +206 -270
- package/dist/components/NirField/locales.d.ts +10 -10
- package/dist/components/NirField/useNirValidation.d.ts +64 -0
- package/dist/components/PasswordField/PasswordField.d.ts +8 -9
- package/dist/components/PeriodField/PeriodField.d.ts +1352 -1640
- package/dist/components/PhoneField/PhoneField.d.ts +88 -124
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +12 -12
- package/dist/components/SyTextArea/SyTextArea.d.ts +34 -14
- package/dist/components/SyTextArea/useDefaultValidationRules.d.ts +11 -0
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +9 -6
- package/dist/components/Tables/SyTable/SyTable.d.ts +9 -6
- package/dist/components/Tables/common/SyTableFilter.d.ts +2 -3
- package/dist/components/Tables/common/SyTablePagination.d.ts +17 -19
- package/dist/components/Tables/common/filters/AutocompleteFilter.d.ts +120 -0
- package/dist/components/Tables/common/filters/locales.d.ts +0 -1
- package/dist/components/Tables/common/types.d.ts +19 -3
- package/dist/components/Tables/common/useClickableTableRow.d.ts +17 -0
- package/dist/components/Tables/common/usePagination.d.ts +3 -1
- package/dist/components/Tables/common/usePinnedColumns.d.ts +31 -0
- package/dist/components/Tables/common/useTableHeaders.d.ts +2 -0
- package/dist/components/Tables/common/useTableRowCheckboxAccessibility.d.ts +5 -0
- package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +6 -6
- package/dist/composables/date/useDatePickerAccessibility.d.ts +1 -1
- package/dist/composables/rules/useFieldValidation.d.ts +4 -4
- package/dist/composables/unifyValidation/useCustomValidation.d.ts +8 -0
- package/dist/composables/unifyValidation/useValidation.d.ts +102 -0
- package/dist/composables/unifyValidation/useVuetifyValidation.d.ts +18 -0
- package/dist/composables/useFormFieldErrorHandling.d.ts +2 -2
- package/dist/composables/validation/useFormValidation.d.ts +11 -2
- package/dist/composables/validation/useValidation.d.ts +15 -9
- package/dist/design-system-v3.d.ts +2 -0
- package/dist/design-system-v3.js +186 -187
- package/dist/design-system-v3.umd.cjs +1 -1066
- package/dist/{main-aLKwdMi1.js → main-BtTqyn4z.js} +16434 -15672
- package/dist/main-C1e3eoxd.cjs +1067 -0
- package/dist/main.d.ts +0 -1
- package/dist/synapse.css +1 -0
- package/dist/tooth-11-D3sLWv2n.cjs +1 -0
- package/dist/tooth-12-CXrLuH03.cjs +1 -0
- package/dist/tooth-13-BSfo5fpT.cjs +1 -0
- package/dist/tooth-14-DMzulx0h.cjs +1 -0
- package/dist/tooth-15-BKRFVi-9.cjs +1 -0
- package/dist/tooth-16-CpuxAbuM.cjs +1 -0
- package/dist/tooth-17-BPoahUdg.cjs +1 -0
- package/dist/tooth-18-DhHJz8sy.cjs +1 -0
- package/dist/tooth-21-Dgd5hn_X.cjs +1 -0
- package/dist/tooth-22-C2Tn19sB.cjs +1 -0
- package/dist/tooth-23-C9uaaSGb.cjs +1 -0
- package/dist/tooth-24-BrK9UGpf.cjs +1 -0
- package/dist/tooth-25-CE_EfGNp.cjs +1 -0
- package/dist/tooth-26-Ctv4i9Fy.cjs +1 -0
- package/dist/tooth-27-C5J7JkWM.cjs +1 -0
- package/dist/tooth-28-Z9oWqjo0.cjs +1 -0
- package/dist/tooth-31-BrYqmkTi.cjs +1 -0
- package/dist/tooth-32-BNNR0oCZ.cjs +1 -0
- package/dist/tooth-33-DuxvqO2J.cjs +1 -0
- package/dist/tooth-34-BCSCXMB6.cjs +1 -0
- package/dist/tooth-35-BLUXkX88.cjs +1 -0
- package/dist/tooth-36-IrKHYqlA.cjs +1 -0
- package/dist/tooth-37-BYqpdMwo.cjs +1 -0
- package/dist/tooth-38-B_eNXXdu.cjs +1 -0
- package/dist/tooth-41-Ddva4Ot8.cjs +1 -0
- package/dist/tooth-42-szcDqlM0.cjs +1 -0
- package/dist/tooth-43-B3ka6rQm.cjs +1 -0
- package/dist/tooth-44-CazyQucj.cjs +1 -0
- package/dist/tooth-45-B4HQtc8n.cjs +1 -0
- package/dist/tooth-46-BPM40gbG.cjs +1 -0
- package/dist/tooth-47-Dvr20dlh.cjs +1 -0
- package/dist/tooth-48-Bd8ljGsF.cjs +1 -0
- package/dist/tooth-51-OBpwCOF3.cjs +1 -0
- package/dist/tooth-52-aKxyHcmq.cjs +1 -0
- package/dist/tooth-53-vCwJjTOc.cjs +1 -0
- package/dist/tooth-54-DsWu2iFy.cjs +1 -0
- package/dist/tooth-55-BxC1X2Dn.cjs +1 -0
- package/dist/tooth-61-BbLvxMQi.cjs +1 -0
- package/dist/tooth-62-CmTkWczP.cjs +1 -0
- package/dist/tooth-63-DI7l_2qI.cjs +1 -0
- package/dist/tooth-64-B21sOsJh.cjs +1 -0
- package/dist/tooth-65-D2ZC2VEr.cjs +1 -0
- package/dist/tooth-71-D473PPO5.cjs +1 -0
- package/dist/tooth-72-Drh1wnNu.cjs +1 -0
- package/dist/tooth-73-DzlwYI23.cjs +1 -0
- package/dist/tooth-74-8aGvcZPg.cjs +1 -0
- package/dist/tooth-75-BFK7At_r.cjs +1 -0
- package/dist/tooth-81-BZmR-I0M.cjs +1 -0
- package/dist/tooth-82-euVfUUZV.cjs +1 -0
- package/dist/tooth-83-KV010j64.cjs +1 -0
- package/dist/tooth-84-BBg1RjhZ.cjs +1 -0
- package/dist/tooth-85-Cr-kc1wM.cjs +1 -0
- package/dist/vuetifyConfig.js +561 -0
- package/dist/vuetifyConfig.umd.cjs +1 -0
- package/package.json +10 -4
- package/src/assets/overrides/_btns.scss +0 -6
- package/src/assets/overrides/_icons.scss +9 -1
- package/src/assets/overrides/_typography.scss +0 -10
- package/src/components/Amelipro/AmeliproAutoCompleteField/__tests__/__snapshots__/AmeliproAutoCompleteField.spec.ts.snap +2 -2
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/__tests__/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +1 -1
- package/src/components/Amelipro/AmeliproTextArea/__tests__/__snapshots__/AmeliproTextArea.spec.ts.snap +2 -2
- package/src/components/Captcha/accessibilite/Accessibility.mdx +86 -8
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +12 -12
- package/src/components/ChipList/ChipList.stories.ts +0 -15
- package/src/components/ChipList/ChipList.vue +5 -1
- package/src/components/ChipList/accessibilite/Accessibility.mdx +83 -10
- package/src/components/ChipList/tests/ChipList.a11y.spec.ts +41 -0
- package/src/components/Customs/Selects/SelectBtnField/accessibilite/Accessibility.mdx +0 -9
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +22 -5
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +143 -0
- package/src/components/Customs/Selects/SyAutocomplete/utils/ariaManager.ts +14 -10
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.stories.ts +4 -4
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.vue +8 -9
- package/src/components/Customs/Selects/SyInputSelect/tests/SyInputSelect.spec.ts +10 -10
- package/src/components/Customs/Selects/SySelect/SySelect.vue +14 -11
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +54 -0
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +6 -9
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +10 -16
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +16 -11
- package/src/components/Customs/SyCheckbox/accessibilite/Accessibility.mdx +35 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.a11y.spec.ts +134 -2
- package/src/components/Customs/SyForm/SyForm.stories.ts +31 -5
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +4 -7
- package/src/components/Customs/SyTextField/SyTextField.mdx +1 -1
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +29 -27
- package/src/components/Customs/SyTextField/SyTextField.vue +154 -157
- package/src/components/Customs/SyTextField/tests/SyTextField.a11y.spec.ts +32 -0
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +120 -11
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +62 -58
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +330 -223
- package/src/components/DatePicker/CalendarMode/accessibilite/Accessibility.mdx +82 -0
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.a11y.spec.ts +141 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +2 -56
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +195 -159
- package/src/components/DatePicker/ComplexDatePicker/accessibilite/Accessibility.mdx +76 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +10 -10
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +8 -8
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +106 -8
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +12 -11
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +12 -12
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +0 -12
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +63 -57
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +3 -0
- package/src/components/DatePicker/DateTextInput/accessibilite/Accessibility.mdx +66 -0
- package/src/components/DatePicker/DateTextInput/tests/DateTextInput.spec.ts +52 -1
- package/src/components/DatePicker/composables/index.ts +1 -0
- package/src/components/DatePicker/composables/tests/useCalendarKeyboardNavigation.spec.ts +109 -65
- package/src/components/DatePicker/composables/tests/useDatePickerFocusTrap.spec.ts +138 -0
- package/src/components/DatePicker/composables/tests/useDateValidation.spec.ts +74 -18
- package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +39 -0
- package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +91 -0
- package/src/components/DatePicker/composables/useCalendarKeyboardNavigation.ts +442 -36
- package/src/components/DatePicker/composables/useDatePickerFocusTrap.ts +92 -0
- package/src/components/DatePicker/composables/useDateTextField.ts +7 -6
- package/src/components/DatePicker/composables/useDateValidation.ts +36 -35
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +3 -3
- package/src/components/DatePicker/composables/useManualDateValidation.ts +6 -2
- package/src/components/DiacriticPicker/accessibilite/Accessibility.mdx +76 -8
- package/src/components/HeaderBar/HeaderBar.stories.ts +14 -2
- package/src/components/Logo/accessibilite/Accessibility.mdx +73 -11
- package/src/components/LogoBrandSection/accessibilite/Accessibility.mdx +85 -9
- package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +3 -1
- package/src/components/LunarCalendar/useLunarCalendarValidation.ts +4 -5
- package/src/components/MonthPicker/tests/MonthPicker.spec.ts +2 -1
- package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +7 -7
- package/src/components/NirField/NirField.stories.ts +4 -0
- package/src/components/NirField/NirField.vue +64 -260
- package/src/components/NirField/accessibilite/Accessibility.mdx +2 -2
- package/src/components/NirField/locales.ts +1 -1
- package/src/components/NirField/tests/NirField.spec.ts +6 -0
- package/src/components/NirField/useNirValidation.ts +271 -0
- package/src/components/PasswordField/PasswordField.stories.ts +4 -4
- package/src/components/PasswordField/PasswordField.vue +18 -24
- package/src/components/PasswordField/tests/PasswordField.spec.ts +6 -3
- package/src/components/PeriodField/PeriodField.stories.ts +4 -4
- package/src/components/PeriodField/PeriodField.vue +57 -57
- package/src/components/PeriodField/__tests__/PeriodField.async.spec.ts +32 -0
- package/src/components/PeriodField/accessibilite/Accessibility.mdx +68 -8
- package/src/components/PeriodField/tests/PeriodField.spec.ts +28 -2
- package/src/components/PhoneField/PhoneField.vue +5 -6
- package/src/components/PhoneField/tests/PhoneField.spec.ts +1 -0
- package/src/components/RangeField/RangeField.vue +6 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +138 -2
- package/src/components/SyTextArea/SyTextArea.vue +53 -23
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +126 -3
- package/src/components/SyTextArea/useDefaultValidationRules.ts +74 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +25 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +673 -1
- package/src/components/Tables/SyServerTable/SyServerTable.vue +148 -91
- package/src/components/Tables/SyServerTable/tests/SyServerTable.a11y.spec.ts +58 -0
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +122 -0
- package/src/components/Tables/SyTable/SyTable.mdx +25 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +452 -1
- package/src/components/Tables/SyTable/SyTable.vue +130 -56
- package/src/components/Tables/SyTable/tests/SyTable.a11y.spec.ts +57 -0
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +108 -0
- package/src/components/Tables/common/SyTableFilter.vue +22 -2
- package/src/components/Tables/common/TableHeader.vue +5 -1
- package/src/components/Tables/common/filters/AutocompleteFilter.vue +160 -0
- package/src/components/Tables/common/filters/NumberFilter.vue +1 -1
- package/src/components/Tables/common/filters/SelectFilter.vue +10 -11
- package/src/components/Tables/common/filters/TextFilter.vue +1 -1
- package/src/components/Tables/common/filters/getFilterComponent.ts +8 -1
- package/src/components/Tables/common/filters/locales.ts +0 -1
- package/src/components/Tables/common/filters/tests/AutocompleteFilter.a11y.spec.ts +110 -0
- package/src/components/Tables/common/filters/tests/AutocompleteFilter.spec.ts +203 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.a11y.spec.ts +104 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +152 -16
- package/src/components/Tables/common/tableFilterUtils.ts +3 -0
- package/src/components/Tables/common/tableStyles.scss +48 -4
- package/src/components/Tables/common/tests/filterByRange.spec.ts +2 -1
- package/src/components/Tables/common/types.ts +13 -4
- package/src/components/Tables/common/useClickableTableRow.ts +103 -0
- package/src/components/Tables/common/usePagination.ts +13 -0
- package/src/components/Tables/common/usePinnedColumns.ts +237 -0
- package/src/components/Tables/common/useTableHeaders.ts +3 -3
- package/src/components/Tables/common/useTableRowCheckboxAccessibility.ts +41 -0
- package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +2 -6
- package/src/composables/date/useDatePickerAccessibility.ts +42 -207
- package/src/composables/rules/tests/useFieldValidation.spec.ts +120 -120
- package/src/composables/rules/useFieldValidation.ts +34 -17
- package/src/composables/unifyValidation/tests/useCustomValidation.spec.ts +601 -0
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +2048 -0
- package/src/composables/unifyValidation/tests/useVuetifyValidation.spec.ts +184 -0
- package/src/composables/unifyValidation/useCustomValidation.ts +95 -0
- package/src/composables/unifyValidation/useValidation.ts +190 -0
- package/src/composables/unifyValidation/useVuetifyValidation.ts +54 -0
- package/src/composables/useFormFieldErrorHandling.ts +4 -7
- package/src/composables/validation/tests/useFormValidation.spec.ts +14 -0
- package/src/composables/validation/tests/useValidation.spec.ts +116 -21
- package/src/composables/validation/useFormValidation.ts +20 -13
- package/src/composables/validation/useValidatable.ts +8 -1
- package/src/composables/validation/useValidation.ts +135 -99
- package/src/composantsVuetify/Introduction.mdx +48 -0
- package/src/composantsVuetify/VBtn/VBtn.mdx +72 -0
- package/src/composantsVuetify/VBtn/v-btn.stories.ts +121 -0
- package/src/composantsVuetify/VTooltip/VTooltip.mdx +32 -0
- package/src/composantsVuetify/VTooltip/v-tooltip.stories.ts +95 -0
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +2 -2
- package/src/main.ts +0 -2
- package/src/stories/Components/Components.stories.ts +74 -9
- package/src/stories/Demarrer/Accueil.stories.ts +3 -3
- package/src/stories/GuideDuDev/Amelipro.mdx +15 -0
- package/src/stories/GuideDuDev/Amelipro.stories.ts +209 -0
- package/src/stories/GuideDuDev/vuetifyOptions.mdx +3 -3
- package/dist/SelectFilter-BioGT6Nn.js +0 -136
- package/dist/style.css +0 -1
- package/src/components/DatePicker/Accessibilite.mdx +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
1
|
+
<script lang="ts" setup>
|
|
2
2
|
import {
|
|
3
3
|
ref,
|
|
4
4
|
computed,
|
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
} from '@/composables/date/useDateInitializationDayjs'
|
|
17
17
|
import {
|
|
18
18
|
useAsteriskDisplay,
|
|
19
|
-
|
|
19
|
+
useDatePickerFocusTrap,
|
|
20
20
|
useDatePickerState,
|
|
21
|
+
useDateFormatValidation,
|
|
22
|
+
useDateValidation,
|
|
21
23
|
useDatePickerViewMode,
|
|
22
24
|
useDatePickerVisibility,
|
|
23
25
|
useDateRangeValidation,
|
|
24
26
|
useDateSelection,
|
|
25
|
-
useDateValidation,
|
|
26
27
|
useDisplayedDateString,
|
|
27
28
|
useInputBlurHandler,
|
|
28
29
|
useManualDateValidation,
|
|
@@ -125,92 +126,88 @@
|
|
|
125
126
|
})
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
/**
|
|
129
|
-
* Props / Emits
|
|
130
|
-
*/
|
|
131
129
|
const props = withDefaults(
|
|
132
130
|
defineProps<{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
placeholder?: string
|
|
136
|
-
format?: string
|
|
137
|
-
dateFormatReturn?: string
|
|
138
|
-
isBirthDate?: boolean
|
|
131
|
+
autoClamp?: boolean
|
|
132
|
+
bgColor?: string
|
|
139
133
|
birthDate?: boolean
|
|
140
|
-
showWeekNumber?: boolean
|
|
141
|
-
required?: boolean
|
|
142
|
-
displayRange?: boolean
|
|
143
|
-
displayIcon?: boolean
|
|
144
|
-
displayAppendIcon?: boolean
|
|
145
|
-
displayPrependIcon?: boolean
|
|
146
134
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- sorry
|
|
147
135
|
customRules?: { type: string, options: any }[]
|
|
148
136
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- sorry
|
|
149
137
|
customWarningRules?: { type: string, options: any }[]
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
noCalendar?: boolean
|
|
153
|
-
isOutlined?: boolean
|
|
154
|
-
readonly?: boolean
|
|
155
|
-
title?: string | false
|
|
156
|
-
width?: string
|
|
138
|
+
dateFormatReturn?: string
|
|
139
|
+
density?: 'default' | 'comfortable' | 'compact'
|
|
157
140
|
disableErrorHandling?: boolean
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
141
|
+
disabled?: boolean
|
|
142
|
+
displayAppendIcon?: boolean
|
|
143
|
+
displayAsterisk?: boolean
|
|
144
|
+
displayHolidayDays?: boolean
|
|
145
|
+
displayIcon?: boolean
|
|
146
|
+
displayPrependIcon?: boolean
|
|
147
|
+
displayRange?: boolean
|
|
161
148
|
displayTodayButton?: boolean
|
|
162
149
|
displayWeekendDays?: boolean
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
format?: string
|
|
151
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
|
|
152
|
+
hint?: string
|
|
153
|
+
isBirthDate?: boolean
|
|
154
|
+
isOutlined?: boolean
|
|
155
|
+
isValidateOnBlur?: boolean
|
|
156
|
+
label: string
|
|
157
|
+
modelValue?: DateInput
|
|
158
|
+
noCalendar?: boolean
|
|
159
|
+
noIcon?: boolean
|
|
165
160
|
period?: {
|
|
166
|
-
min?: string
|
|
167
161
|
max?: string
|
|
162
|
+
min?: string
|
|
168
163
|
}
|
|
169
|
-
autoClamp?: boolean
|
|
170
|
-
isValidateOnBlur?: boolean
|
|
171
|
-
density?: 'default' | 'comfortable' | 'compact'
|
|
172
|
-
hint?: string
|
|
173
164
|
persistentHint?: boolean
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
placeholder?: string
|
|
166
|
+
readonly?: boolean
|
|
167
|
+
required?: boolean
|
|
168
|
+
showSuccessMessages?: boolean
|
|
169
|
+
showWeekNumber?: boolean
|
|
170
|
+
textFieldActivator?: boolean
|
|
171
|
+
title?: string | false
|
|
172
|
+
width?: string
|
|
176
173
|
}>(),
|
|
177
174
|
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
|
|
181
|
-
dateFormatReturn: '',
|
|
182
|
-
isBirthDate: false,
|
|
175
|
+
autoClamp: false,
|
|
176
|
+
bgColor: 'white',
|
|
183
177
|
birthDate: false,
|
|
184
|
-
showWeekNumber: false,
|
|
185
|
-
required: false,
|
|
186
|
-
displayRange: false,
|
|
187
|
-
displayIcon: true,
|
|
188
|
-
displayAppendIcon: false,
|
|
189
|
-
displayPrependIcon: true,
|
|
190
178
|
customRules: () => [],
|
|
191
179
|
customWarningRules: () => [],
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
noCalendar: false,
|
|
195
|
-
isOutlined: true,
|
|
196
|
-
readonly: false,
|
|
197
|
-
title: false,
|
|
198
|
-
width: '100%',
|
|
180
|
+
dateFormatReturn: '',
|
|
181
|
+
density: 'default',
|
|
199
182
|
disableErrorHandling: false,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
183
|
+
disabled: false,
|
|
184
|
+
displayAppendIcon: false,
|
|
185
|
+
displayAsterisk: false,
|
|
186
|
+
displayHolidayDays: true,
|
|
187
|
+
displayIcon: true,
|
|
188
|
+
displayPrependIcon: true,
|
|
189
|
+
displayRange: false,
|
|
203
190
|
displayTodayButton: true,
|
|
204
191
|
displayWeekendDays: true,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
period: () => ({ min: '', max: '' }),
|
|
208
|
-
autoClamp: false,
|
|
209
|
-
isValidateOnBlur: true,
|
|
210
|
-
density: 'default',
|
|
192
|
+
format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
|
|
193
|
+
headingLevel: 3,
|
|
211
194
|
hint: undefined,
|
|
195
|
+
isBirthDate: false,
|
|
196
|
+
isOutlined: true,
|
|
197
|
+
isValidateOnBlur: true,
|
|
198
|
+
modelValue: undefined,
|
|
199
|
+
noCalendar: false,
|
|
200
|
+
noIcon: false,
|
|
201
|
+
period: () => ({ min: '', max: '' }),
|
|
212
202
|
persistentHint: false,
|
|
213
|
-
|
|
203
|
+
placeholder: undefined,
|
|
204
|
+
readonly: false,
|
|
205
|
+
required: false,
|
|
206
|
+
showSuccessMessages: true,
|
|
207
|
+
showWeekNumber: false,
|
|
208
|
+
textFieldActivator: false,
|
|
209
|
+
title: false,
|
|
210
|
+
width: '100%',
|
|
214
211
|
},
|
|
215
212
|
)
|
|
216
213
|
|
|
@@ -237,8 +234,6 @@
|
|
|
237
234
|
const validation = useValidation({
|
|
238
235
|
showSuccessMessages: props.showSuccessMessages,
|
|
239
236
|
fieldIdentifier: 'Date',
|
|
240
|
-
customRules: props.customRules,
|
|
241
|
-
warningRules: props.customWarningRules,
|
|
242
237
|
disableErrorHandling: props.disableErrorHandling,
|
|
243
238
|
})
|
|
244
239
|
const { errors, warnings, successes, validateField, clearValidation } = validation
|
|
@@ -353,16 +348,16 @@
|
|
|
353
348
|
watch(() => props.customRules, () => {
|
|
354
349
|
if (selectedDates.value !== null) {
|
|
355
350
|
// Retarder légèrement pour s'assurer que les computed sont mis à jour
|
|
356
|
-
setTimeout(() => {
|
|
351
|
+
setTimeout(async () => {
|
|
357
352
|
clearValidation()
|
|
358
353
|
const datesToValidate = Array.isArray(selectedDates.value) ? selectedDates.value : [selectedDates.value]
|
|
359
|
-
|
|
360
|
-
validateField(
|
|
354
|
+
for (const date of datesToValidate) {
|
|
355
|
+
await Promise.resolve(validateField(
|
|
361
356
|
date,
|
|
362
357
|
props.customRules,
|
|
363
358
|
props.customWarningRules,
|
|
364
|
-
)
|
|
365
|
-
}
|
|
359
|
+
))
|
|
360
|
+
}
|
|
366
361
|
}, 5)
|
|
367
362
|
}
|
|
368
363
|
}, { deep: true })
|
|
@@ -404,9 +399,9 @@
|
|
|
404
399
|
if (!props.noCalendar && newValue) displayFormattedDate.value = newValue
|
|
405
400
|
})
|
|
406
401
|
|
|
407
|
-
const updateSelectedDates = (date: Date | null) => {
|
|
402
|
+
const updateSelectedDates = async (date: Date | null) => {
|
|
408
403
|
if (date !== null) {
|
|
409
|
-
const validationResult = validateField(date, props.customRules, props.customWarningRules)
|
|
404
|
+
const validationResult = await Promise.resolve(validateField(date, props.customRules, props.customWarningRules))
|
|
410
405
|
if (validationResult.hasError) {
|
|
411
406
|
errors.value = validationResult.state.errors
|
|
412
407
|
return
|
|
@@ -599,6 +594,25 @@
|
|
|
599
594
|
const datePickerRef = ref<null | ComponentPublicInstance<typeof VDatePicker>>()
|
|
600
595
|
const datePickerContentId = `date-picker-${Math.random().toString(36).slice(2)}`
|
|
601
596
|
|
|
597
|
+
// Aria props for activator: only declare aria-controls when panel exists
|
|
598
|
+
const menuActivatorProps = computed(() => ({
|
|
599
|
+
'aria-controls': isDatePickerVisible.value ? datePickerContentId : undefined,
|
|
600
|
+
'aria-expanded': isDatePickerVisible.value,
|
|
601
|
+
'aria-haspopup': 'dialog' as const,
|
|
602
|
+
'aria-disabled': props.disabled || undefined,
|
|
603
|
+
'aria-readonly': props.readonly || undefined,
|
|
604
|
+
'aria-label': labelWithAsterisk.value || props.placeholder || props.title || undefined,
|
|
605
|
+
'tabindex': props.disabled ? -1 : 0,
|
|
606
|
+
'aria-owns': undefined,
|
|
607
|
+
}))
|
|
608
|
+
|
|
609
|
+
const { handleMenuKeydown } = useDatePickerFocusTrap({
|
|
610
|
+
isDatePickerVisible,
|
|
611
|
+
datePickerRef: datePickerRef as unknown as Ref<ComponentPublicInstance | null>,
|
|
612
|
+
onClose: () => emit('closed'),
|
|
613
|
+
restoreFocus: () => queueMicrotask(() => menuActivatorRef.value?.querySelector?.('input')?.focus({ preventScroll: true })),
|
|
614
|
+
})
|
|
615
|
+
|
|
602
616
|
/**
|
|
603
617
|
* Holiday marking (partagé via useHolidayHighlighting)
|
|
604
618
|
*/
|
|
@@ -647,20 +661,24 @@
|
|
|
647
661
|
setCurrentDate: (date: Date) => {
|
|
648
662
|
preventCloseOnInternalUpdate.value = true
|
|
649
663
|
updateSelectedDates(date)
|
|
664
|
+
|
|
665
|
+
// S'assurer que le VDatePicker affiche le bon mois après navigation clavier
|
|
666
|
+
nextTick(() => {
|
|
667
|
+
if (datePickerRef.value) {
|
|
668
|
+
const newMonth = String(date.getMonth())
|
|
669
|
+
const newYear = String(date.getFullYear())
|
|
670
|
+
if (currentMonth.value !== newMonth || currentYear.value !== newYear) {
|
|
671
|
+
currentMonth.value = newMonth
|
|
672
|
+
currentYear.value = newYear
|
|
673
|
+
currentMonthName.value = dayjs(date).format('MMMM')
|
|
674
|
+
currentYearName.value = newYear
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
})
|
|
678
|
+
|
|
650
679
|
queueMicrotask(() => {
|
|
651
680
|
preventCloseOnInternalUpdate.value = false
|
|
652
681
|
})
|
|
653
|
-
// Synchroniser le mois et l'année visibles lorsque l'on franchit une limite de mois
|
|
654
|
-
const newMonth = String(date.getMonth())
|
|
655
|
-
const newYear = String(date.getFullYear())
|
|
656
|
-
if (currentMonth.value !== newMonth) {
|
|
657
|
-
currentMonth.value = newMonth
|
|
658
|
-
currentMonthName.value = dayjs().month(date.getMonth()).format('MMMM')
|
|
659
|
-
}
|
|
660
|
-
if (currentYear.value !== newYear) {
|
|
661
|
-
currentYear.value = newYear
|
|
662
|
-
currentYearName.value = newYear
|
|
663
|
-
}
|
|
664
682
|
},
|
|
665
683
|
})
|
|
666
684
|
|
|
@@ -943,12 +961,12 @@
|
|
|
943
961
|
/**
|
|
944
962
|
* Public API
|
|
945
963
|
*/
|
|
946
|
-
const validateOnSubmit = (): boolean => {
|
|
964
|
+
const validateOnSubmit = async (): Promise<boolean> => {
|
|
947
965
|
if (props.noCalendar) {
|
|
948
|
-
return dateTextInputRef.value?.validateOnSubmit() || false
|
|
966
|
+
return await Promise.resolve(dateTextInputRef.value?.validateOnSubmit() || false)
|
|
949
967
|
}
|
|
950
|
-
const textInputValid = dateCalendarTextInputRef.value?.validateOnSubmit() || false
|
|
951
|
-
validateDates(true)
|
|
968
|
+
const textInputValid = await Promise.resolve(dateCalendarTextInputRef.value?.validateOnSubmit() || false)
|
|
969
|
+
await Promise.resolve(validateDates(true))
|
|
952
970
|
return textInputValid && errors.value.length === 0
|
|
953
971
|
}
|
|
954
972
|
|
|
@@ -1057,6 +1075,7 @@
|
|
|
1057
1075
|
<VMenu
|
|
1058
1076
|
v-model="isDatePickerVisible"
|
|
1059
1077
|
:activator="menuActivatorRef"
|
|
1078
|
+
:activator-props="menuActivatorProps"
|
|
1060
1079
|
:min-width="0"
|
|
1061
1080
|
location="bottom"
|
|
1062
1081
|
:close-on-content-click="false"
|
|
@@ -1064,15 +1083,17 @@
|
|
|
1064
1083
|
scroll-strategy="none"
|
|
1065
1084
|
transition="fade-transition"
|
|
1066
1085
|
:offset="[0, 10]"
|
|
1086
|
+
content-class="date-picker-overlay-content"
|
|
1067
1087
|
>
|
|
1068
1088
|
<template #activator>
|
|
1069
1089
|
<div
|
|
1070
1090
|
ref="menuActivatorRef"
|
|
1071
1091
|
class="date-text-input-activator"
|
|
1072
1092
|
role="combobox"
|
|
1073
|
-
|
|
1093
|
+
v-bind="menuActivatorProps"
|
|
1094
|
+
:aria-controls="isDatePickerVisible ? datePickerContentId : undefined"
|
|
1074
1095
|
:aria-expanded="isDatePickerVisible"
|
|
1075
|
-
:
|
|
1096
|
+
:title="props.placeholder || DATE_PICKER_MESSAGES.LABEL_DEFAULT"
|
|
1076
1097
|
>
|
|
1077
1098
|
<DateTextInput
|
|
1078
1099
|
ref="dateCalendarTextInputRef"
|
|
@@ -1118,77 +1139,83 @@
|
|
|
1118
1139
|
</div>
|
|
1119
1140
|
</template>
|
|
1120
1141
|
|
|
1121
|
-
<
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
v-model="selectedDates"
|
|
1126
|
-
control-variant="modal"
|
|
1127
|
-
color="primary"
|
|
1128
|
-
:class="props.displayWeekendDays ? 'weekend' : ''"
|
|
1129
|
-
:first-day-of-week="1"
|
|
1130
|
-
:multiple="props.displayRange ? 'range' : false"
|
|
1131
|
-
:show-adjacent-months="true"
|
|
1132
|
-
:show-week="props.showWeekNumber"
|
|
1133
|
-
:view-mode="currentViewMode"
|
|
1134
|
-
:month="currentMonth !== null ? Number(currentMonth) : undefined"
|
|
1135
|
-
:year="currentYear !== null ? Number(currentYear) : undefined"
|
|
1136
|
-
:max="maxDate"
|
|
1137
|
-
:min="minDate"
|
|
1138
|
-
:custom-rules="props.customRules"
|
|
1139
|
-
:custom-warning-rules="props.customWarningRules"
|
|
1140
|
-
:display-holiday-days="props.displayHolidayDays"
|
|
1141
|
-
:display-asterisk="props.displayAsterisk"
|
|
1142
|
-
:is-validate-on-blur="props.isValidateOnBlur"
|
|
1143
|
-
:error-messages="errorMessages"
|
|
1144
|
-
:density="props.density"
|
|
1145
|
-
:hint="props.hint"
|
|
1146
|
-
:persistent-hint="props.persistentHint"
|
|
1147
|
-
@update:model-value="updateDisplayFormattedDate"
|
|
1148
|
-
@update:view-mode="handleViewModeUpdate"
|
|
1149
|
-
@update:month="onUpdateMonth"
|
|
1150
|
-
@update:year="onUpdateYear"
|
|
1151
|
-
@click:date="updateSelectedDates"
|
|
1152
|
-
@focus="props.displayHolidayDays ? markHolidayDays : undefined"
|
|
1153
|
-
@update:month-year="props.displayHolidayDays ? markHolidayDays : undefined"
|
|
1142
|
+
<div
|
|
1143
|
+
tabindex="-1"
|
|
1144
|
+
role="presentation"
|
|
1145
|
+
@keydown.capture="handleMenuKeydown"
|
|
1154
1146
|
>
|
|
1155
|
-
<
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1147
|
+
<VDatePicker
|
|
1148
|
+
v-if="isDatePickerVisible"
|
|
1149
|
+
:id="datePickerContentId"
|
|
1150
|
+
ref="datePickerRef"
|
|
1151
|
+
v-model="selectedDates"
|
|
1152
|
+
control-variant="modal"
|
|
1153
|
+
color="primary"
|
|
1154
|
+
:class="props.displayWeekendDays ? 'weekend' : ''"
|
|
1155
|
+
:first-day-of-week="1"
|
|
1156
|
+
:multiple="props.displayRange ? 'range' : false"
|
|
1157
|
+
:show-adjacent-months="true"
|
|
1158
|
+
:show-week="props.showWeekNumber"
|
|
1159
|
+
:view-mode="currentViewMode"
|
|
1160
|
+
:month="currentMonth !== null ? Number(currentMonth) : undefined"
|
|
1161
|
+
:year="currentYear !== null ? Number(currentYear) : undefined"
|
|
1162
|
+
:max="maxDate"
|
|
1163
|
+
:min="minDate"
|
|
1164
|
+
:custom-rules="props.customRules"
|
|
1165
|
+
:custom-warning-rules="props.customWarningRules"
|
|
1166
|
+
:display-holiday-days="props.displayHolidayDays"
|
|
1167
|
+
:display-asterisk="props.displayAsterisk"
|
|
1168
|
+
:is-validate-on-blur="props.isValidateOnBlur"
|
|
1169
|
+
:error-messages="errorMessages"
|
|
1170
|
+
:density="props.density"
|
|
1171
|
+
:hint="props.hint"
|
|
1172
|
+
:persistent-hint="props.persistentHint"
|
|
1173
|
+
@update:model-value="updateDisplayFormattedDate"
|
|
1174
|
+
@update:view-mode="handleViewModeUpdate"
|
|
1175
|
+
@update:month="onUpdateMonth"
|
|
1176
|
+
@update:year="onUpdateYear"
|
|
1177
|
+
@click:date="updateSelectedDates"
|
|
1178
|
+
@focus="props.displayHolidayDays ? markHolidayDays : undefined"
|
|
1179
|
+
@update:month-year="props.displayHolidayDays ? markHolidayDays : undefined"
|
|
1171
1180
|
>
|
|
1172
|
-
<
|
|
1173
|
-
<
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
+
<template #title>
|
|
1182
|
+
<span class="date-picker-title">
|
|
1183
|
+
Sélectionnez une date
|
|
1184
|
+
</span>
|
|
1185
|
+
</template>
|
|
1186
|
+
<template #header>
|
|
1187
|
+
<SyHeading
|
|
1188
|
+
class="mx-auto my-auto ml-5 mb-4"
|
|
1189
|
+
:level="headingLevel"
|
|
1181
1190
|
>
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1191
|
+
{{ selectedDates ? displayedDateString : headerDate }}
|
|
1192
|
+
</SyHeading>
|
|
1193
|
+
</template>
|
|
1194
|
+
<template
|
|
1195
|
+
v-if="props.displayTodayButton"
|
|
1196
|
+
#actions
|
|
1197
|
+
>
|
|
1198
|
+
<div class="d-flex justify-center align-center w-100">
|
|
1199
|
+
<v-btn
|
|
1200
|
+
v-if="props.displayTodayButton"
|
|
1201
|
+
size="x-small"
|
|
1202
|
+
color="primary"
|
|
1203
|
+
:title="DATE_PICKER_MESSAGES.BUTTON_TODAY"
|
|
1204
|
+
class="date-picker__today-button my-2 pa-2 mt-2"
|
|
1205
|
+
:ripple="false"
|
|
1206
|
+
@click="handleSelectToday"
|
|
1207
|
+
>
|
|
1208
|
+
<SyIcon
|
|
1209
|
+
size="16px"
|
|
1210
|
+
decorative
|
|
1211
|
+
:icon="mdiCalendarMonthOutline"
|
|
1212
|
+
/>
|
|
1213
|
+
{{ DATE_PICKER_MESSAGES.BUTTON_TODAY }}
|
|
1214
|
+
</v-btn>
|
|
1215
|
+
</div>
|
|
1216
|
+
</template>
|
|
1217
|
+
</VDatePicker>
|
|
1218
|
+
</div>
|
|
1192
1219
|
</VMenu>
|
|
1193
1220
|
</template>
|
|
1194
1221
|
</div>
|
|
@@ -1407,3 +1434,12 @@
|
|
|
1407
1434
|
opacity: 0;
|
|
1408
1435
|
}
|
|
1409
1436
|
</style>
|
|
1437
|
+
|
|
1438
|
+
<style lang="scss">
|
|
1439
|
+
.date-picker-overlay-content .v-date-picker {
|
|
1440
|
+
box-shadow:
|
|
1441
|
+
0 5px 5px -3px rgb(0 0 0 / 20%),
|
|
1442
|
+
0 8px 10px 1px rgb(0 0 0 / 14%),
|
|
1443
|
+
0 3px 14px 2px rgb(0 0 0 / 12%) !important;
|
|
1444
|
+
}
|
|
1445
|
+
</style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/addon-docs'
|
|
2
|
+
import * as Stories from '../ComplexDatePicker.stories.ts'
|
|
3
|
+
import AccessibilityIcon from '@/common/imgs/accessibility-svgrepo-com.svg'
|
|
4
|
+
import '@/stories/styles/shared.css'
|
|
5
|
+
import {
|
|
6
|
+
AccessibilityGuideLayout,
|
|
7
|
+
CriteriaSection,
|
|
8
|
+
CriteriaCard,
|
|
9
|
+
DemoSection,
|
|
10
|
+
BestPracticesSection,
|
|
11
|
+
ResourcesSection,
|
|
12
|
+
} from '@/stories/accessibility/AccessibilityGuideLayout.mdx'
|
|
13
|
+
|
|
14
|
+
<Meta of={Stories} />
|
|
15
|
+
|
|
16
|
+
<AccessibilityGuideLayout
|
|
17
|
+
componentName="ComplexDatePicker (mode combiné)"
|
|
18
|
+
iconSrc={AccessibilityIcon}
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
<CriteriaSection>
|
|
22
|
+
<CriteriaCard title="Structure sémantique" icon="🔍">
|
|
23
|
+
<ul>
|
|
24
|
+
<li><strong>Champ</strong> : conteneur <code>role="combobox"</code> qui expose <code>aria-controls</code> et <code>aria-expanded</code>; champ de saisie interne en <code>textbox</code> avec libellé dynamique. À la différence du mode calendrier simple, ce mode permet la saisie libre, justifiant l'utilisation du pattern combobox.</li>
|
|
25
|
+
<li><strong>Panneau</strong> : calendrier dans un menu <code>role="presentation"</code>, grille de boutons natifs pour les jours.</li>
|
|
26
|
+
<li><strong>Relations</strong> : l’activateur référence le panneau via <code>aria-controls</code> quand ouvert; <code>aria-labelledby</code> et <code>aria-label</code> portés par l’input.</li>
|
|
27
|
+
<li><strong>États</strong> : <code>aria-expanded</code> synchronisé, <code>aria-disabled</code> / <code>aria-readonly</code> propagés aux champs et messages.</li>
|
|
28
|
+
</ul>
|
|
29
|
+
</CriteriaCard>
|
|
30
|
+
|
|
31
|
+
<CriteriaCard title="Ouverture et focus" icon="🧭">
|
|
32
|
+
<ul>
|
|
33
|
+
<li><strong>Ouverture</strong> : clic sur le champ ou l’icône; <kbd>Entrée</kbd> sur le champ ouvre; option <code>textFieldActivator</code> active toute la zone.</li>
|
|
34
|
+
<li><strong>Fermeture</strong> : <kbd>Échap</kbd> via le piège de focus; fermeture valide et émet <code>closed</code>.</li>
|
|
35
|
+
<li><strong>Piège de focus</strong> : <kbd>Tab</kbd>/<kbd>Shift+Tab</kbd> circulent dans l’en-tête, la grille et le bouton « Aujourd’hui » tant que le panneau est ouvert.</li>
|
|
36
|
+
<li><strong>Lecture seule</strong> : aucun clear ni validation interactive, champs non éditables.</li>
|
|
37
|
+
</ul>
|
|
38
|
+
</CriteriaCard>
|
|
39
|
+
|
|
40
|
+
<CriteriaCard title="Navigation clavier dans le calendrier" icon="⌨️">
|
|
41
|
+
<ul>
|
|
42
|
+
<li><strong>Jours</strong> : flèches déplacent le focus; <code>PageUp/PageDown</code> changent de mois (<kbd>Shift</kbd> + touche change d’année).</li>
|
|
43
|
+
<li><strong>Home/End</strong> : premier/dernier jour du mois affiché.</li>
|
|
44
|
+
<li><strong>Activation</strong> : <kbd>Espace</kbd>/<kbd>Entrée</kbd> déclenchent les boutons de jour et de l’en-tête (mois/année/flèches).</li>
|
|
45
|
+
<li><strong>Dialogue mois/années</strong> : flèches et <kbd>Home</kbd>/<kbd>End</kbd>, <kbd>Espace</kbd>/<kbd>Entrée</kbd> sélectionnent l’option et conservent le focus.</li>
|
|
46
|
+
</ul>
|
|
47
|
+
</CriteriaCard>
|
|
48
|
+
|
|
49
|
+
<CriteriaCard title="Messages et annonces" icon="📣">
|
|
50
|
+
<ul>
|
|
51
|
+
<li><strong>Statuts</strong> : erreurs/avertissements/succès affichés sous le champ; bouton « Aujourd’hui » avec <code>title</code>.</li>
|
|
52
|
+
<li><strong>Formats attendus</strong> : placeholder + hint décrivent la saisie; autoClamp optionnel sur la saisie interne.</li>
|
|
53
|
+
<li><strong>Lecture/voix</strong> : libellé/placeholder alimentent <code>aria-label</code>; les messages sont reliés via <code>aria-describedby</code>.</li>
|
|
54
|
+
</ul>
|
|
55
|
+
</CriteriaCard>
|
|
56
|
+
</CriteriaSection>
|
|
57
|
+
|
|
58
|
+
<DemoSection title="Saisie + calendrier (mode combiné)">
|
|
59
|
+
<Story of={Stories.Default} />
|
|
60
|
+
</DemoSection>
|
|
61
|
+
|
|
62
|
+
<BestPracticesSection>
|
|
63
|
+
- Fournir un libellé ou <code>aria-label</code> explicite, surtout si le label visuel est masqué ou tronqué.
|
|
64
|
+
- Si <code>readonly</code>, laisser le calendrier fermé et désactiver l’effacement; ne pas surcharger les raccourcis.
|
|
65
|
+
- En plage de dates, conserver la séparatrice <code>" - "</code> et préciser l’ordre début/fin dans le hint.
|
|
66
|
+
- Ajuster <code>period</code> pour ne pas masquer des dates attendues; vérifier <code>min/max</code> cohérents avec la plage.
|
|
67
|
+
- Avec <code>textFieldActivator</code>, s’assurer que le label reste lisible et que l’icône n’est pas le seul point d’entrée.
|
|
68
|
+
</BestPracticesSection>
|
|
69
|
+
|
|
70
|
+
<ResourcesSection>
|
|
71
|
+
- Stories : <code>Default</code>, <code>DateRange</code>, <code>DisablePickerInteraction</code>, <code>AutoFormattingInput</code>, <code>WithTextFieldActivator</code>, <code>ReadonlyMode</code>.
|
|
72
|
+
- Tests : <code>ComplexDatePicker.a11y.spec.ts</code> (axe) et <code>ComplexDatePicker.spec.ts</code> couvrent ouverture, focus et validation combinée.
|
|
73
|
+
- Références : WAI-ARIA combobox + grid pour les schémas combobox + calendrier.
|
|
74
|
+
</ResourcesSection>
|
|
75
|
+
|
|
76
|
+
</AccessibilityGuideLayout>
|
|
@@ -247,7 +247,7 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
247
247
|
expect(wrapper.vm.currentYearName).toBe('2030')
|
|
248
248
|
})
|
|
249
249
|
|
|
250
|
-
it('validateOnSubmit returns false when required and empty in text-only mode', () => {
|
|
250
|
+
it('validateOnSubmit returns false when required and empty in text-only mode', async () => {
|
|
251
251
|
const wrapper = mountComponent({
|
|
252
252
|
label: 'Date Field',
|
|
253
253
|
noCalendar: true,
|
|
@@ -255,7 +255,7 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
255
255
|
format: 'DD/MM/YYYY',
|
|
256
256
|
})
|
|
257
257
|
|
|
258
|
-
const result = wrapper.vm.validateOnSubmit()
|
|
258
|
+
const result = await wrapper.vm.validateOnSubmit()
|
|
259
259
|
expect(result).toBe(false)
|
|
260
260
|
})
|
|
261
261
|
|
|
@@ -269,7 +269,7 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
269
269
|
})
|
|
270
270
|
|
|
271
271
|
await nextTick()
|
|
272
|
-
const result = wrapper.vm.validateOnSubmit()
|
|
272
|
+
const result = await wrapper.vm.validateOnSubmit()
|
|
273
273
|
expect(result).toBe(true)
|
|
274
274
|
})
|
|
275
275
|
|
|
@@ -283,20 +283,20 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
283
283
|
expect(wrapper.exists()).toBe(true)
|
|
284
284
|
})
|
|
285
285
|
|
|
286
|
-
it('validateOnSubmit returns false when required and empty in calendar mode', () => {
|
|
286
|
+
it('validateOnSubmit returns false when required and empty in calendar mode', async () => {
|
|
287
287
|
const wrapper = mountComponent({
|
|
288
288
|
label: 'Date Field',
|
|
289
289
|
required: true,
|
|
290
290
|
format: 'DD/MM/YYYY',
|
|
291
291
|
})
|
|
292
292
|
|
|
293
|
-
const result = wrapper.vm.validateOnSubmit()
|
|
293
|
+
const result = await wrapper.vm.validateOnSubmit()
|
|
294
294
|
expect(result).toBe(false)
|
|
295
295
|
// Should surface at least one error message
|
|
296
296
|
expect(wrapper.vm.errorMessages.length).toBeGreaterThan(0)
|
|
297
297
|
})
|
|
298
298
|
|
|
299
|
-
it('validateDates flags an error when end date is before start date in range mode', () => {
|
|
299
|
+
it('validateDates flags an error when end date is before start date in range mode', async () => {
|
|
300
300
|
const wrapper = mountComponent({
|
|
301
301
|
label: 'Date Field',
|
|
302
302
|
format: 'DD/MM/YYYY',
|
|
@@ -309,12 +309,12 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
309
309
|
new Date(2025, 0, 1),
|
|
310
310
|
]
|
|
311
311
|
|
|
312
|
-
const result = wrapper.vm.validateDates(true)
|
|
312
|
+
const result = await wrapper.vm.validateDates(true)
|
|
313
313
|
expect(result.hasError).toBe(true)
|
|
314
|
-
expect(
|
|
314
|
+
expect(result.state.errors.length).toBeGreaterThan(0)
|
|
315
315
|
})
|
|
316
316
|
|
|
317
|
-
it('validateDates does not flag an error for an incomplete range when not forced', () => {
|
|
317
|
+
it('validateDates does not flag an error for an incomplete range when not forced', async () => {
|
|
318
318
|
const wrapper = mountComponent({
|
|
319
319
|
label: 'Date Field',
|
|
320
320
|
format: 'DD/MM/YYYY',
|
|
@@ -341,7 +341,7 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
341
341
|
|
|
342
342
|
// Simuler une erreur required
|
|
343
343
|
wrapper.vm.selectedDates = null
|
|
344
|
-
wrapper.vm.validateDates(true)
|
|
344
|
+
await wrapper.vm.validateDates(true)
|
|
345
345
|
expect(wrapper.vm.errorMessages.length).toBeGreaterThan(0)
|
|
346
346
|
|
|
347
347
|
// Ouvrir le calendrier puis réinitialiser
|
|
@@ -51,8 +51,8 @@ export const Required: StoryObj = {
|
|
|
51
51
|
const datePicker1 = ref()
|
|
52
52
|
const date1 = ref('')
|
|
53
53
|
|
|
54
|
-
const handleSubmit = () => {
|
|
55
|
-
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
54
|
+
const handleSubmit = async () => {
|
|
55
|
+
const isValid1 = await datePicker1.value?.validateOnSubmit()
|
|
56
56
|
|
|
57
57
|
if (!isValid1) {
|
|
58
58
|
alert('Corrigez les erreurs avant de soumettre !')
|
|
@@ -71,8 +71,8 @@ export const Required: StoryObj = {
|
|
|
71
71
|
const datePicker1 = ref()
|
|
72
72
|
const date1 = ref('')
|
|
73
73
|
|
|
74
|
-
const handleSubmit = () => {
|
|
75
|
-
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
74
|
+
const handleSubmit = async () => {
|
|
75
|
+
const isValid1 = await datePicker1.value?.validateOnSubmit()
|
|
76
76
|
|
|
77
77
|
if (!isValid1) {
|
|
78
78
|
alert('Corrigez les erreurs avant de soumettre !')
|
|
@@ -151,8 +151,8 @@ export const WithCustomRulesAndRequired: StoryObj = {
|
|
|
151
151
|
const datePicker1 = ref()
|
|
152
152
|
const date1 = ref('01/01/2100')
|
|
153
153
|
|
|
154
|
-
const handleSubmit = () => {
|
|
155
|
-
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
154
|
+
const handleSubmit = async () => {
|
|
155
|
+
const isValid1 = await datePicker1.value?.validateOnSubmit()
|
|
156
156
|
|
|
157
157
|
if (!isValid1) {
|
|
158
158
|
alert('Corrigez les erreurs avant de soumettre !')
|
|
@@ -171,8 +171,8 @@ export const WithCustomRulesAndRequired: StoryObj = {
|
|
|
171
171
|
const datePicker1 = ref()
|
|
172
172
|
const date1 = ref('01/01/2100')
|
|
173
173
|
|
|
174
|
-
const handleSubmit = () => {
|
|
175
|
-
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
174
|
+
const handleSubmit = async () => {
|
|
175
|
+
const isValid1 = await datePicker1.value?.validateOnSubmit()
|
|
176
176
|
|
|
177
177
|
if (!isValid1) {
|
|
178
178
|
alert('Corrigez les erreurs avant de soumettre !')
|