@cnamts/synapse 1.0.24 → 1.0.26
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/README.md +27 -5
- package/dist/{AutocompleteFilter-BWLR3U7W.js → AutocompleteFilter-BPR-a55G.js} +1 -1
- package/dist/{DateFilter-BpwFexzi.js → DateFilter-CknrJWs2.js} +2 -2
- package/dist/{NumberFilter-Bz_NTdX9.js → NumberFilter-DJ-yNlzv.js} +1 -1
- package/dist/{PeriodFilter-DX_wy9g-.js → PeriodFilter-CiB5Oa9Z.js} +1 -1
- package/dist/{SelectFilter-xqiPtPgX.js → SelectFilter-EiafX97M.js} +2 -2
- package/dist/{TextFilter-BBl3JFqK.js → TextFilter-BzOmpdxj.js} +1 -1
- package/dist/{apLightTheme-D1P4jcD0.js → apLightTheme-DS0Uy44H.js} +446 -723
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +14 -8
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +60 -289
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +1 -0
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +4 -0
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +1 -0
- package/dist/components/Customs/SyTabs/SyTabs.d.ts +13 -11
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +0 -2
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +54 -73
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +31 -40
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +9 -14
- package/dist/components/DatePicker/composables/useDatePickerState.d.ts +4 -3
- package/dist/components/DatePicker/composables/useDateTextField.d.ts +2 -2
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +2 -2
- package/dist/components/DatePicker/types.d.ts +1 -2
- package/dist/components/FileList/FileList.d.ts +6 -0
- package/dist/components/FilterSideBar/FilterSideBar.d.ts +2 -0
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +13 -13
- package/dist/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.d.ts +3 -3
- package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +1 -0
- package/dist/components/MonthPicker/MonthPicker.d.ts +2 -7
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +2 -7
- package/dist/components/NirField/NirField.d.ts +12 -20
- package/dist/components/NirField/useNirValidation.d.ts +6 -2
- package/dist/components/PeriodField/PeriodField.d.ts +110 -150
- package/dist/components/PhoneField/PhoneField.d.ts +12 -7
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +0 -3
- package/dist/components/RatingPicker/EmotionPicker/EmotionPicker.d.ts +3 -1
- package/dist/components/RatingPicker/NumberPicker/NumberPicker.d.ts +4 -3
- package/dist/components/RatingPicker/RatingPicker.d.ts +18 -5
- package/dist/components/RatingPicker/StarsPicker/StarsPicker.d.ts +3 -1
- package/dist/components/RatingPicker/tests/RatingPicker.a11y.spect.d.ts +1 -0
- package/dist/components/RatingPicker/useRatingFocus.d.ts +18 -0
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +5 -4
- package/dist/components/Tables/SyTable/SyTable.d.ts +5 -4
- package/dist/components/Tables/common/SyTablePagination.d.ts +154 -364
- package/dist/components/Tables/common/TableHeader.d.ts +6 -1
- package/dist/components/Tables/common/filters/DateFilter.d.ts +4 -4
- package/dist/components/Tables/common/locales.d.ts +3 -0
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +1 -0
- package/dist/composables/date/useDateInitializationDayjs.d.ts +3 -1
- package/dist/composables/unifyValidation/documentationValidationProps.d.ts +230 -0
- package/dist/composables/unifyValidation/useCustomValidation.d.ts +3 -1
- package/dist/composables/unifyValidation/useValidation.d.ts +12 -6
- package/dist/composables/unifyValidation/useVuetifyValidation.d.ts +1 -1
- package/dist/composables/validation/useValidation.d.ts +6 -1
- package/dist/design-system-v3.js +2 -2
- package/dist/designTokens/tokens/amelipro/apColors.d.ts +10 -10
- package/dist/designTokens/tokens/amelipro/apColors2026.d.ts +1 -2
- package/dist/designTokens/tokens/amelipro/apContextual.d.ts +44 -0
- package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +2 -0
- package/dist/designTokens/tokens/amelipro/apSemantic.d.ts +1 -1
- package/dist/designTokens/tokens/baseColors.d.ts +127 -0
- package/dist/designTokens/tokens/baseContextualTokens.d.ts +50 -0
- package/dist/designTokens/tokens/cnam/cnamColors.d.ts +10 -10
- package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +2 -0
- package/dist/designTokens/tokens/cnam/cnamSemantic.d.ts +1 -1
- package/dist/designTokens/tokens/pa/paColors.d.ts +1 -166
- package/dist/designTokens/tokens/pa/paSemantic.d.ts +1 -1
- package/dist/designTokens/utils/buildColorClassMap.d.ts +12 -0
- package/dist/designTokens/utils/createFlattenTheme.d.ts +1 -3
- package/dist/designTokens/utils/index.d.ts +2 -2
- package/dist/{main-BtTqyn4z.js → main-BsJ9ec3i.js} +16021 -15715
- package/dist/synapse.css +1 -1
- package/dist/utils/functions/classToHex.d.ts +1 -1
- package/dist/utils/functions/createHexResolver.d.ts +16 -0
- package/dist/vuetifyConfig.js +113 -152
- package/package.json +35 -23
- package/src/assets/amelipro/apTokens2026.scss +5 -5
- package/src/assets/overrides/_breakpoints.scss +25 -0
- package/src/assets/overrides/_btns.scss +0 -2
- package/src/assets/overrides/_forms.scss +1 -3
- package/src/assets/overrides/_icons.scss +5 -22
- package/src/assets/overrides/_otp.scss +40 -0
- package/src/assets/overrides/_tables.scss +11 -20
- package/src/assets/overrides/_tooltips.scss +17 -7
- package/src/assets/overrides/_typography.scss +35 -37
- package/src/assets/overrides/_utilities.scss +43 -47
- package/src/assets/themes.scss +1 -0
- package/src/components/Accordion/Accordion.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/AmeliproAccordionTemplate.vue +20 -20
- package/src/components/Amelipro/AmeliproAccordionFrieze/AmeliproAccordionFrieze.vue +12 -14
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +4 -6
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.vue +5 -5
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +4 -6
- package/src/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.vue +4 -6
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.vue +4 -6
- package/src/components/Amelipro/AmeliproBreadcrumb/AmeliproBreadcrumb.vue +1 -3
- package/src/components/Amelipro/AmeliproBtn/AmeliproBtn.vue +4 -6
- package/src/components/Amelipro/AmeliproCallback/AmeliproCallback.vue +2 -2
- package/src/components/Amelipro/AmeliproCard/AmeliproCard.vue +31 -31
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.vue +5 -7
- package/src/components/Amelipro/AmeliproCheckbox/AmeliproCheckbox.vue +13 -15
- package/src/components/Amelipro/AmeliproCheckboxGroup/AmeliproCheckboxGroup.vue +23 -23
- package/src/components/Amelipro/AmeliproChips/AmeliproChips.vue +1 -3
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.vue +17 -12
- package/src/components/Amelipro/AmeliproClickableTile/tests/__snapshots__/AmeliproClickableTile.spec.ts.snap +2 -2
- package/src/components/Amelipro/AmeliproCopyBtn/AmeliproCopyBtn.vue +4 -6
- package/src/components/Amelipro/AmeliproCustomSelector/AmeliproCustomSelector.vue +13 -13
- package/src/components/Amelipro/AmeliproDentalChart/AmeliproDentalChart.vue +4 -2
- package/src/components/Amelipro/AmeliproDentalChart/AmeliproTooth/AmeliproTooth.vue +4 -4
- package/src/components/Amelipro/AmeliproDialog/AmeliproDialog.vue +5 -7
- package/src/components/Amelipro/AmeliproDisclosure/AmeliproDisclosure.vue +1 -3
- package/src/components/Amelipro/AmeliproErrorTemplate/AmeliproErrorTemplate.vue +2 -4
- package/src/components/Amelipro/AmeliproFilePreview/AmeliproFilePreview.vue +4 -6
- package/src/components/Amelipro/AmeliproFilters/AmeliproFilters.vue +13 -13
- package/src/components/Amelipro/AmeliproFirstLogin/AmeliproFirstLogin.vue +3 -5
- package/src/components/Amelipro/AmeliproFooter/AmeliproFooter.vue +1 -3
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +2 -4
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBar.vue +1 -3
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/AmeliproHeaderBrandSection.vue +20 -16
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/__tests__/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +1 -1
- package/src/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.vue +2 -4
- package/src/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.vue +5 -7
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/AmeliproIllustratedRadioGroup.vue +6 -8
- package/src/components/Amelipro/AmeliproMailTile/AmeliproMailTile.vue +14 -14
- package/src/components/Amelipro/AmeliproMenu/AmeliproMenu.vue +11 -13
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproDropdownMenu/AmeliproDropdownMenu.vue +2 -4
- package/src/components/Amelipro/AmeliproMessagingLayout/AmeliproMessagingLayout.vue +8 -8
- package/src/components/Amelipro/AmeliproMultipleFoldingCard/AmeliproMultipleFoldingCard.vue +40 -40
- package/src/components/Amelipro/AmeliproNumberedCard/AmeliproNumberedCard.vue +27 -27
- package/src/components/Amelipro/AmeliproOnboarding/AmeliproOnboarding.vue +3 -5
- package/src/components/Amelipro/AmeliproPageLayout/AmeliproPageLayout.vue +2 -4
- package/src/components/Amelipro/AmeliproPagination/AmeliproPagination.vue +2 -4
- package/src/components/Amelipro/AmeliproPagination/AmeliproPaginationBtn/AmeliproPaginationBtn.vue +3 -5
- package/src/components/Amelipro/AmeliproPatientBanner/AmeliproPatientBanner.vue +1 -3
- package/src/components/Amelipro/AmeliproPatientLogged/AmeliproPatientLogged.vue +2 -4
- package/src/components/Amelipro/AmeliproPatientLogin/AmeliproPatientLogin.vue +4 -4
- package/src/components/Amelipro/AmeliproPatientLogin/AmeliproPatientLoginForm/AmeliproPatientLoginForm.vue +1 -3
- package/src/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.vue +3 -5
- package/src/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.vue +3 -5
- package/src/components/Amelipro/AmeliproRadioGroup/AmeliproRadioGroup.vue +23 -23
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +4 -6
- package/src/components/Amelipro/AmeliproSelect/AmeliproSelect.vue +12 -22
- package/src/components/Amelipro/AmeliproStateTile/AmeliproStateTile.vue +10 -12
- package/src/components/Amelipro/AmeliproStepper/AmeliproStepper.vue +17 -17
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +8 -10
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabBtn/AmeliproTabBtn.vue +6 -8
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabs.vue +4 -4
- package/src/components/Amelipro/AmeliproTextArea/AmeliproTextArea.vue +4 -6
- package/src/components/Amelipro/AmeliproTextField/AmeliproTextField.vue +7 -9
- package/src/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.vue +3 -5
- package/src/components/Amelipro/AmeliproTooltips/AmeliproTooltips.vue +0 -2
- package/src/components/Amelipro/AmeliproUpload/AmeliproUpload.vue +6 -6
- package/src/components/Amelipro/ServiceMenu/ServiceMenu.vue +2 -2
- package/src/components/Amelipro/StructureMenu/StructureBtn/StructureBtn.vue +4 -4
- package/src/components/Amelipro/StructureMenu/StructureItem/StructureItem.vue +4 -6
- package/src/components/Amelipro/StructureMenu/StructureMenu.vue +2 -2
- package/src/components/Amelipro/StructureMenu/StructureTabs/StructureTabs.vue +2 -2
- package/src/components/Amelipro/UserMenu/UserMenu.vue +1 -3
- package/src/components/BackBtn/tests/BackBtn.visual.cy.ts +43 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-custom-bg.snap.png +0 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-dark-mode.snap.png +0 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-default.snap.png +0 -0
- package/src/components/BackBtn/tests/__snapshots__/back-btn-no-icon.snap.png +0 -0
- package/src/components/Captcha/Captcha.vue +1 -3
- package/src/components/ChipList/ChipList.vue +14 -16
- package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -3
- package/src/components/CookiesSelection/CookiesSelection.vue +2 -1
- package/src/components/CopyBtn/CopyBtn.vue +10 -3
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +17 -17
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +31 -0
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.stories.ts +66 -0
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +8 -4
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.a11y.spec.ts +18 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +66 -0
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.vue +4 -6
- package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +414 -135
- package/src/components/Customs/Selects/SySelect/SySelect.vue +502 -257
- package/src/components/Customs/Selects/SySelect/accessibilite/Accessibility.mdx +199 -269
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +278 -4
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +3 -3
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +5 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +52 -2
- package/src/components/Customs/SyCheckbox/accessibilite/Accessibility.mdx +18 -3
- package/src/components/Customs/SyPagination/SyPagination.vue +0 -2
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +23 -5
- package/src/components/Customs/SyTabs/SyTabs.mdx +0 -58
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +34 -35
- package/src/components/Customs/SyTabs/SyTabs.vue +87 -67
- package/src/components/Customs/SyTabs/accessibilite/Accessibility.mdx +83 -23
- package/src/components/Customs/SyTabs/config.ts +3 -3
- package/src/components/Customs/SyTabs/tests/SyTabs.a11y.spec.ts +88 -0
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +46 -1
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +21 -41
- package/src/components/Customs/SyTextField/SyTextField.vue +34 -9
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +1 -1
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +29 -28
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1 -1
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +28 -23
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +24 -1
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +1 -1
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +65 -33
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +1 -1
- package/src/components/DatePicker/composables/tests/useDatePickerState.spec.ts +53 -0
- package/src/components/DatePicker/composables/useDatePickerState.ts +56 -13
- package/src/components/DatePicker/composables/useDateRangeInput.ts +2 -1
- package/src/components/DatePicker/composables/useDateSelection.ts +2 -1
- package/src/components/DatePicker/composables/useDateTextField.ts +2 -3
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +2 -2
- package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +9 -8
- package/src/components/DatePicker/playground/DatePickerHolidayRule.vue +1 -1
- package/src/components/DatePicker/types.ts +1 -2
- package/src/components/DialogBox/DialogBox.stories.ts +8 -8
- package/src/components/DialogBox/DialogBox.vue +3 -5
- package/src/components/DialogBox/accessibilite/Accessibility.mdx +86 -22
- package/src/components/DialogBox/tests/DialogBox.visual.cy.ts +76 -0
- package/src/components/DialogBox/tests/__snapshots__/dialog-box-custom-texts.snap.png +0 -0
- package/src/components/DialogBox/tests/__snapshots__/dialog-box-default.snap.png +0 -0
- package/src/components/DialogBox/tests/__snapshots__/dialog-box-no-actions.snap.png +0 -0
- package/src/components/FileList/FileList.vue +9 -2
- package/src/components/FileList/UploadItem/UploadItem.vue +11 -13
- package/src/components/FileList/tests/FileList.spec.ts +47 -0
- package/src/components/FileUpload/FileUpload.vue +3 -5
- package/src/components/FileUpload/FileUploadContent.vue +3 -5
- package/src/components/FilterInline/FilterInline.vue +1 -3
- package/src/components/FilterSideBar/FilterSideBar.mdx +44 -1
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +105 -1
- package/src/components/FilterSideBar/FilterSideBar.vue +9 -1
- package/src/components/FilterSideBar/tests/FilterSideBar.a11y.spec.ts +54 -1
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +42 -0
- package/src/components/FooterBar/FooterBar.vue +9 -13
- package/src/components/FranceConnectBtn/FranceConnectBtn.vue +1 -1
- package/src/components/HeaderBar/HeaderBar.vue +2 -3
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.vue +2 -3
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.vue +2 -3
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.vue +0 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.vue +8 -9
- package/src/components/HeaderBar/HeaderBurgerMenu/menu.scss +0 -8
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.visual.cy.ts +196 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/header-burger-menu-generated-submenu-open.snap.png +0 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/header-burger-menu-generated.snap.png +0 -0
- package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +0 -1
- package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +6 -7
- package/src/components/HeaderBar/tests/HeaderBar.visual.cy.ts +81 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-custom-width.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-default.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-no-sticky.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-prepend.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-side.snap.png +0 -0
- package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-subtitle.snap.png +0 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +12 -3
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +15 -8
- package/src/components/HeaderToolbar/HeaderToolbar.vue +6 -7
- package/src/components/LangBtn/LangBtn.vue +4 -5
- package/src/components/Logo/tests/Logo.visual.cy.ts +57 -0
- package/src/components/Logo/tests/__snapshots__/logo-avatar.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-dark.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-default.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-no-organism.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-no-signature.snap.png +0 -0
- package/src/components/Logo/tests/__snapshots__/logo-risque-pro.snap.png +0 -0
- package/src/components/LogoBrandSection/LogoBrandSection.vue +2 -2
- package/src/components/MonthPicker/MonthPickerVisual/VisualPickerHeader.vue +1 -1
- package/src/components/NirField/NirField.stories.ts +2 -2
- package/src/components/NirField/NirField.vue +3 -5
- package/src/components/NirField/accessibilite/Accessibility.mdx +100 -5
- package/src/components/NirField/tests/NirField.spec.ts +118 -0
- package/src/components/NirField/tests/useNirValidation.spec.ts +449 -0
- package/src/components/NirField/useNirValidation.ts +38 -32
- package/src/components/NotificationBar/Notification/Notification.vue +7 -9
- package/src/components/NotificationBar/NotificationBar.vue +1 -3
- package/src/components/PaginatedTable/PaginatedTable.vue +3 -4
- package/src/components/PaginatedTable/Pagination.vue +4 -6
- package/src/components/PasswordField/PasswordField.vue +15 -13
- package/src/components/PhoneField/PhoneField.vue +7 -5
- package/src/components/RangeField/RangeSlider/RangeSlider.vue +11 -20
- package/src/components/RangeField/RangeSlider/Tooltip/Tooltip.vue +1 -1
- package/src/components/RangeField/tests/RangeField.visual.cy.ts +65 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-custom-bg.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-custom-range.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-default.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-step.snap.png +0 -0
- package/src/components/RangeField/tests/__snapshots__/range-field-with-label.snap.png +0 -0
- package/src/components/RatingPicker/EmotionPicker/EmotionPicker.vue +38 -56
- package/src/components/RatingPicker/EmotionPicker/tests/__snapshots__/EmotionPicker.spec.ts.snap +5 -0
- package/src/components/RatingPicker/NumberPicker/NumberPicker.vue +48 -53
- package/src/components/RatingPicker/NumberPicker/tests/NumberPicker.spec.ts +2 -1
- package/src/components/RatingPicker/NumberPicker/tests/__snapshots__/NumberPicker.spec.ts.snap +40 -13
- package/src/components/RatingPicker/RatingPicker.stories.ts +65 -88
- package/src/components/RatingPicker/RatingPicker.vue +71 -15
- package/src/components/RatingPicker/StarsPicker/StarsPicker.vue +31 -42
- package/src/components/RatingPicker/StarsPicker/tests/StarsPicker.spec.ts +1 -1
- package/src/components/RatingPicker/StarsPicker/tests/__snapshots__/StarsPicker.spec.ts.snap +5 -0
- package/src/components/RatingPicker/accessibilite/Accessibility.mdx +137 -9
- package/src/components/RatingPicker/tests/RatingPicker.a11y.spect.ts +123 -0
- package/src/components/RatingPicker/tests/RatingPicker.spec.ts +3 -2
- package/src/components/RatingPicker/tests/__snapshots__/RatingPicker.spec.ts.snap +40 -11
- package/src/components/RatingPicker/useRatingFocus.ts +97 -0
- package/src/components/SearchListField/SearchListField.vue +0 -2
- package/src/components/SkipLink/SkipLink.vue +2 -4
- package/src/components/SocialMediaLinks/SocialMediaLinks.vue +6 -6
- package/src/components/SubHeader/SubHeader.vue +1 -1
- package/src/components/SyAlert/SyAlert.vue +7 -9
- package/src/components/SyAlert/tests/SyAlert.visual.cy.ts +46 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-closable.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-error.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-info.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-success.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-variant-outlined.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-variant-tonal.snap.png +0 -0
- package/src/components/SyAlert/tests/__snapshots__/sy-alert-warning.snap.png +0 -0
- package/src/components/SyBtnMenu/SyBtnMenu.vue +2 -4
- package/src/components/SyTextArea/SyTextArea.vue +32 -1
- package/src/components/TableToolbar/TableToolbar.vue +6 -8
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +166 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +10 -8
- package/src/components/Tables/SyServerTable/tests/SyServerTable.a11y.spec.ts +23 -0
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +268 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +104 -0
- package/src/components/Tables/SyTable/SyTable.vue +10 -8
- package/src/components/Tables/SyTable/tests/SyTable.a11y.spec.ts +22 -0
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +274 -0
- package/src/components/Tables/common/SyTableFilter.vue +31 -6
- package/src/components/Tables/common/SyTablePagination.vue +143 -19
- package/src/components/Tables/common/TableHeader.vue +41 -4
- package/src/components/Tables/common/filters/DateFilter.vue +2 -2
- package/src/components/Tables/common/filters/SelectFilter.vue +1 -1
- package/src/components/Tables/common/locales.ts +3 -0
- package/src/components/Tables/common/tableStyles.scss +16 -19
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +18 -0
- package/src/components/Tables/common/tests/TableHeader.spec.ts +39 -0
- package/src/components/Tables/common/types.ts +2 -0
- package/src/components/Tables/common/useTableHeaders.ts +49 -27
- package/src/components/UploadWorkflow/UploadWorkflow.vue +1 -0
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +23 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/UploadWorkflow.spec.ts.snap +66 -0
- package/src/components/UploadWorkflow/useFileList.ts +3 -0
- package/src/components/UserMenuBtn/UserMenuBtn.vue +1 -3
- package/src/composables/date/tests/useDateFormatDayjs.spec.ts +81 -0
- package/src/composables/date/tests/{useDateInitialization.spec.ts → useDateInitializationDayjs.spec.ts} +39 -3
- package/src/composables/date/useDateInitializationDayjs.ts +4 -1
- package/src/composables/unifyValidation/documentationValidationProps.ts +235 -0
- package/src/composables/unifyValidation/tests/useCustomValidation.spec.ts +2 -1
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +22 -0
- package/src/composables/unifyValidation/useCustomValidation.ts +16 -4
- package/src/composables/unifyValidation/useValidation.ts +46 -15
- package/src/composables/unifyValidation/useVuetifyValidation.ts +2 -2
- package/src/composables/useFormFieldErrorHandling.ts +4 -1
- package/src/composables/validation/tests/useValidation.spec.ts +2 -2
- package/src/composables/validation/useValidation.ts +32 -4
- package/src/composantsVuetify/VBreadcrumbs/VBreadcrumbs.mdx +28 -0
- package/src/composantsVuetify/VBreadcrumbs/v-breadcrumbs.stories.ts +108 -0
- package/src/composantsVuetify/VCard/VCard.mdx +59 -0
- package/src/composantsVuetify/VCard/v-card.stories.ts +279 -0
- package/src/composantsVuetify/VOtpInput/VOtpInput.mdx +39 -0
- package/src/composantsVuetify/VOtpInput/v-otp-input.stories.ts +56 -0
- package/src/composantsVuetify/VSkeletonLoader/VSkeletonLoader.mdx +42 -0
- package/src/composantsVuetify/VSkeletonLoader/v-skeleton-loader.stories.ts +77 -0
- package/src/composantsVuetify/VSwitch/VSwitch.mdx +47 -0
- package/src/composantsVuetify/VSwitch/v-switch.stories.ts +166 -0
- package/src/designTokens/tests/buildColorClassMap.spec.ts +31 -0
- package/src/designTokens/tests/generateScssTokens.spec.ts +12 -0
- package/src/designTokens/tests/themeUtils.spec.ts +53 -0
- package/src/designTokens/tokens/amelipro/apColors.ts +8 -130
- package/src/designTokens/tokens/amelipro/apColors2026.ts +3 -15
- package/src/designTokens/tokens/amelipro/apContextual.ts +55 -47
- package/src/designTokens/tokens/amelipro/apLightTheme.ts +4 -1
- package/src/designTokens/tokens/amelipro/apSemantic.ts +1 -1
- package/src/designTokens/tokens/baseColors.ts +129 -0
- package/src/designTokens/tokens/baseContextualTokens.ts +52 -0
- package/src/designTokens/tokens/cnam/cnamColors.ts +3 -125
- package/src/designTokens/tokens/cnam/cnamContextual.ts +4 -48
- package/src/designTokens/tokens/cnam/cnamLightTheme.ts +4 -1
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +1 -1
- package/src/designTokens/tokens/pa/paColors.ts +2 -166
- package/src/designTokens/tokens/pa/paContextual.ts +3 -48
- package/src/designTokens/tokens/pa/paLightTheme.ts +1 -1
- package/src/designTokens/tokens/pa/paSemantic.ts +2 -2
- package/src/designTokens/utils/buildColorClassMap.ts +34 -0
- package/src/designTokens/utils/convertSemanticsToken.ts +8 -11
- package/src/designTokens/utils/createFlattenTheme.ts +15 -7
- package/src/designTokens/utils/index.ts +2 -2
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +61 -91
- package/src/stories/Accessibilite/AuditDesignSystem.mdx +5 -19
- package/src/stories/Accessibilite/AuditEtContreAudit/Exemptions-derogations.mdx +1 -1
- package/src/stories/Accessibilite/AuditEtContreAudit/Introduction.mdx +11 -8
- package/src/stories/Accessibilite/AuditEtContreAudit/RGAA.mdx +6 -7
- package/src/stories/Accessibilite/DesignSystem/Avancement.mdx +433 -0
- package/src/stories/Accessibilite/DesignSystem/a11y-status.json +692 -0
- package/src/stories/Accessibilite/Introduction.mdx +30 -30
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +176 -79
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +67 -19
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +78 -50
- package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +23 -49
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru/FauxPositifs.stories.ts +6 -0
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru/Utilisation.mdx +7 -19
- package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +55 -67
- package/src/stories/Components/Components.stories.ts +92 -4
- package/src/stories/Demarrer/EnrichirLeDesignSystem.mdx +4 -9
- package/src/stories/Demarrer/EnrichirLeDesignSystem.stories.ts +28 -0
- package/src/stories/Demarrer/Releases.stories.ts +48 -5
- package/src/stories/DesignTokens/ColorDisplay.vue +6 -5
- package/src/stories/DesignTokens/ColorIntegrationExample.vue +2 -4
- package/src/stories/DesignTokens/colors.stories.ts +5 -6
- package/src/stories/GuideDuDev/CreateVuetifyInstance.mdx +95 -0
- package/src/stories/GuideDuDev/Theme.mdx +36 -26
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +3 -2
- package/src/stories/styles/accessibility-guide.css +3 -3
- package/src/utils/functions/classToHex.ts +6 -34
- package/src/utils/functions/createHexResolver.ts +45 -0
- package/src/utils/functions/tests/classToHex.spec.ts +36 -0
- package/src/utils/functions/tests/convertToHex.spec.ts +31 -0
- package/src/utils/functions/tests/createHexResolver.spec.ts +66 -0
- package/src/utils/functions/tests/isCssColor.spec.ts +48 -0
- package/dist/AutocompleteFilter-D9jzRzAL.cjs +0 -1
- package/dist/DateFilter-DTUl8hb1.cjs +0 -1
- package/dist/NumberFilter-MAEojdk0.cjs +0 -1
- package/dist/PeriodFilter-CC4WgIhl.cjs +0 -1
- package/dist/SelectFilter-BR3fvl-a.cjs +0 -1
- package/dist/TextFilter-CCfYFl5F.cjs +0 -1
- package/dist/apLightTheme-CFSRrjv2.cjs +0 -1
- package/dist/composables/date/useDateFormat.d.ts +0 -26
- package/dist/composables/date/useDateInitialization.d.ts +0 -18
- package/dist/design-system-v3.umd.cjs +0 -1
- package/dist/designTokens/utils/convertGaps.d.ts +0 -5
- package/dist/main-C1e3eoxd.cjs +0 -1067
- package/dist/tooth-11-D3sLWv2n.cjs +0 -1
- package/dist/tooth-12-CXrLuH03.cjs +0 -1
- package/dist/tooth-13-BSfo5fpT.cjs +0 -1
- package/dist/tooth-14-DMzulx0h.cjs +0 -1
- package/dist/tooth-15-BKRFVi-9.cjs +0 -1
- package/dist/tooth-16-CpuxAbuM.cjs +0 -1
- package/dist/tooth-17-BPoahUdg.cjs +0 -1
- package/dist/tooth-18-DhHJz8sy.cjs +0 -1
- package/dist/tooth-21-Dgd5hn_X.cjs +0 -1
- package/dist/tooth-22-C2Tn19sB.cjs +0 -1
- package/dist/tooth-23-C9uaaSGb.cjs +0 -1
- package/dist/tooth-24-BrK9UGpf.cjs +0 -1
- package/dist/tooth-25-CE_EfGNp.cjs +0 -1
- package/dist/tooth-26-Ctv4i9Fy.cjs +0 -1
- package/dist/tooth-27-C5J7JkWM.cjs +0 -1
- package/dist/tooth-28-Z9oWqjo0.cjs +0 -1
- package/dist/tooth-31-BrYqmkTi.cjs +0 -1
- package/dist/tooth-32-BNNR0oCZ.cjs +0 -1
- package/dist/tooth-33-DuxvqO2J.cjs +0 -1
- package/dist/tooth-34-BCSCXMB6.cjs +0 -1
- package/dist/tooth-35-BLUXkX88.cjs +0 -1
- package/dist/tooth-36-IrKHYqlA.cjs +0 -1
- package/dist/tooth-37-BYqpdMwo.cjs +0 -1
- package/dist/tooth-38-B_eNXXdu.cjs +0 -1
- package/dist/tooth-41-Ddva4Ot8.cjs +0 -1
- package/dist/tooth-42-szcDqlM0.cjs +0 -1
- package/dist/tooth-43-B3ka6rQm.cjs +0 -1
- package/dist/tooth-44-CazyQucj.cjs +0 -1
- package/dist/tooth-45-B4HQtc8n.cjs +0 -1
- package/dist/tooth-46-BPM40gbG.cjs +0 -1
- package/dist/tooth-47-Dvr20dlh.cjs +0 -1
- package/dist/tooth-48-Bd8ljGsF.cjs +0 -1
- package/dist/tooth-51-OBpwCOF3.cjs +0 -1
- package/dist/tooth-52-aKxyHcmq.cjs +0 -1
- package/dist/tooth-53-vCwJjTOc.cjs +0 -1
- package/dist/tooth-54-DsWu2iFy.cjs +0 -1
- package/dist/tooth-55-BxC1X2Dn.cjs +0 -1
- package/dist/tooth-61-BbLvxMQi.cjs +0 -1
- package/dist/tooth-62-CmTkWczP.cjs +0 -1
- package/dist/tooth-63-DI7l_2qI.cjs +0 -1
- package/dist/tooth-64-B21sOsJh.cjs +0 -1
- package/dist/tooth-65-D2ZC2VEr.cjs +0 -1
- package/dist/tooth-71-D473PPO5.cjs +0 -1
- package/dist/tooth-72-Drh1wnNu.cjs +0 -1
- package/dist/tooth-73-DzlwYI23.cjs +0 -1
- package/dist/tooth-74-8aGvcZPg.cjs +0 -1
- package/dist/tooth-75-BFK7At_r.cjs +0 -1
- package/dist/tooth-81-BZmR-I0M.cjs +0 -1
- package/dist/tooth-82-euVfUUZV.cjs +0 -1
- package/dist/tooth-83-KV010j64.cjs +0 -1
- package/dist/tooth-84-BBg1RjhZ.cjs +0 -1
- package/dist/tooth-85-Cr-kc1wM.cjs +0 -1
- package/dist/vuetifyConfig.umd.cjs +0 -1
- package/src/assets/apTokens.scss +0 -343
- package/src/assets/overrides/_container.scss +0 -36
- package/src/assets/tokens.scss +0 -388
- package/src/composables/date/tests/useDateFormat.spec.ts +0 -67
- package/src/composables/date/useDateFormat.ts +0 -110
- package/src/composables/date/useDateInitialization.ts +0 -92
- package/src/designTokens/apColors.md +0 -66
- package/src/designTokens/cnamColors.md +0 -193
- package/src/designTokens/paColors.md +0 -66
- package/src/designTokens/tokens/json/contextual-tokens.json +0 -156
- package/src/designTokens/tokens/json/primitives.json +0 -209
- package/src/designTokens/tokens/json/semantic.json +0 -120
- package/src/designTokens/utils/convertGaps.ts +0 -11
- package/src/stories/Accessibilite/Avancement/Avancement.mdx +0 -533
- package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +0 -306
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import {
|
|
13
13
|
useDateInitialization,
|
|
14
14
|
type DateInput,
|
|
15
|
-
type
|
|
15
|
+
type DateModelValue,
|
|
16
16
|
} from '@/composables/date/useDateInitializationDayjs'
|
|
17
17
|
import {
|
|
18
18
|
useAsteriskDisplay,
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
defineProps<{
|
|
131
131
|
autoClamp?: boolean
|
|
132
132
|
bgColor?: string
|
|
133
|
+
/** @deprecated Utilisez isBirthDate à la place */
|
|
133
134
|
birthDate?: boolean
|
|
134
135
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- sorry
|
|
135
136
|
customRules?: { type: string, options: any }[]
|
|
@@ -212,12 +213,12 @@
|
|
|
212
213
|
)
|
|
213
214
|
|
|
214
215
|
const emit = defineEmits<{
|
|
215
|
-
(e: 'update:modelValue', value:
|
|
216
|
+
(e: 'update:modelValue', value: DateModelValue): void
|
|
216
217
|
(e: 'closed'): void
|
|
217
218
|
(e: 'focus'): void
|
|
218
219
|
(e: 'blur'): void
|
|
219
220
|
(e: 'input', value: string): void
|
|
220
|
-
(e: 'date-selected', value:
|
|
221
|
+
(e: 'date-selected', value: DateModelValue): void
|
|
221
222
|
}>()
|
|
222
223
|
|
|
223
224
|
/**
|
|
@@ -313,14 +314,14 @@
|
|
|
313
314
|
emitFocus: () => emit('focus'),
|
|
314
315
|
})
|
|
315
316
|
|
|
316
|
-
const updateModel = (value:
|
|
317
|
+
const updateModel = (value: DateModelValue) => {
|
|
317
318
|
// Prevent redundant emits
|
|
318
319
|
if (JSON.stringify(value) === JSON.stringify(props.modelValue)) return
|
|
319
320
|
withInternalUpdate(() => emit('update:modelValue', value))
|
|
320
321
|
}
|
|
321
322
|
|
|
322
323
|
// Keep and expose this so consumers can listen to `date-selected`
|
|
323
|
-
const handleDateSelected = (value:
|
|
324
|
+
const handleDateSelected = (value: DateModelValue) => {
|
|
324
325
|
if (props.readonly) return
|
|
325
326
|
|
|
326
327
|
// 1) Update v-model
|
|
@@ -334,7 +335,12 @@
|
|
|
334
335
|
const dateObjects = value
|
|
335
336
|
.map(dateStr => parseDate(dateStr, returnFormat.value))
|
|
336
337
|
.filter(Boolean) as Date[]
|
|
337
|
-
|
|
338
|
+
if (props.displayRange && dateObjects.length >= 2) {
|
|
339
|
+
selectedDates.value = dateSelectionResult.generateDateRange(dateObjects[0]!, dateObjects[dateObjects.length - 1]!)
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
selectedDates.value = dateObjects
|
|
343
|
+
}
|
|
338
344
|
}
|
|
339
345
|
else {
|
|
340
346
|
const dateObject = parseDate(value, returnFormat.value)
|
|
@@ -390,6 +396,7 @@
|
|
|
390
396
|
initializeSelectedDates,
|
|
391
397
|
validateDates,
|
|
392
398
|
updateModel,
|
|
399
|
+
generateDateRange: dateSelectionResult.generateDateRange,
|
|
393
400
|
})
|
|
394
401
|
|
|
395
402
|
// Display helpers (centralised in useDatePickerState)
|
|
@@ -703,7 +710,7 @@
|
|
|
703
710
|
validateField: (value, rules, warningRules) =>
|
|
704
711
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- sorry
|
|
705
712
|
validateField(value, rules as any[], warningRules as any[]),
|
|
706
|
-
updateModel: value => updateModel(value as
|
|
713
|
+
updateModel: value => updateModel(value as DateModelValue),
|
|
707
714
|
emitInput: value => emit('input', value),
|
|
708
715
|
inputRef: dateCalendarTextInputRef as Ref<ComponentPublicInstance | null>,
|
|
709
716
|
})
|
|
@@ -772,7 +779,7 @@
|
|
|
772
779
|
const startDate = parseDate(startDateStr, props.format)
|
|
773
780
|
const endDate = parseDate(endDateStr, props.format)
|
|
774
781
|
if (startDate && endDate) {
|
|
775
|
-
selectedDates.value =
|
|
782
|
+
selectedDates.value = dateSelectionResult.generateDateRange(startDate, endDate)
|
|
776
783
|
validateDates()
|
|
777
784
|
}
|
|
778
785
|
}
|
|
@@ -842,7 +849,7 @@
|
|
|
842
849
|
/**
|
|
843
850
|
* Gère les mises à jour de DateTextInput avec contrôle
|
|
844
851
|
*/
|
|
845
|
-
const handleDateTextInputUpdate = (value:
|
|
852
|
+
const handleDateTextInputUpdate = (value: DateModelValue) => {
|
|
846
853
|
// Ne pas traiter les mises à jour internes pour éviter les boucles
|
|
847
854
|
if (isUpdatingFromInternal.value) return
|
|
848
855
|
|
|
@@ -866,7 +873,7 @@
|
|
|
866
873
|
const endDate = endStr ? parseDate(endStr, rf) || parseDate(endStr, props.format) : null
|
|
867
874
|
|
|
868
875
|
if (startDate && endDate) {
|
|
869
|
-
selectedDates.value =
|
|
876
|
+
selectedDates.value = dateSelectionResult.generateDateRange(startDate, endDate)
|
|
870
877
|
displayFormattedDate.value
|
|
871
878
|
= `${formatDate(startDate, props.format)} - ${formatDate(endDate, props.format)}`
|
|
872
879
|
}
|
|
@@ -1222,8 +1229,6 @@
|
|
|
1222
1229
|
</template>
|
|
1223
1230
|
|
|
1224
1231
|
<style lang="scss" scoped>
|
|
1225
|
-
@use '@/assets/tokens';
|
|
1226
|
-
|
|
1227
1232
|
.date-picker-title {
|
|
1228
1233
|
display: block;
|
|
1229
1234
|
text-transform: lowercase;
|
|
@@ -1249,7 +1254,7 @@
|
|
|
1249
1254
|
/* Style pour les jours fériés */
|
|
1250
1255
|
:deep(.holiday-day) {
|
|
1251
1256
|
background-color: rgb(255 193 7 / 10%);
|
|
1252
|
-
border: 2px dotted
|
|
1257
|
+
border: 2px dotted rgb(var(--v-theme-grey-darken60));
|
|
1253
1258
|
border-radius: 50%;
|
|
1254
1259
|
}
|
|
1255
1260
|
|
|
@@ -1268,45 +1273,45 @@
|
|
|
1268
1273
|
.v-messages__message--success {
|
|
1269
1274
|
:deep(.v-input__control),
|
|
1270
1275
|
:deep(.v-messages__message) {
|
|
1271
|
-
color:
|
|
1276
|
+
color: rgb(var(--v-theme-textSuccess)) !important;
|
|
1272
1277
|
|
|
1273
1278
|
--v-medium-emphasis-opacity: 1;
|
|
1274
1279
|
}
|
|
1275
1280
|
|
|
1276
1281
|
.v-field--active & {
|
|
1277
|
-
color:
|
|
1282
|
+
color: rgb(var(--v-theme-borderSuccess)) !important;
|
|
1278
1283
|
}
|
|
1279
1284
|
}
|
|
1280
1285
|
|
|
1281
1286
|
.v-messages__message--error {
|
|
1282
1287
|
:deep(.v-input__control),
|
|
1283
1288
|
:deep(.v-messages__message) {
|
|
1284
|
-
color:
|
|
1289
|
+
color: rgb(var(--v-theme-textError)) !important;
|
|
1285
1290
|
}
|
|
1286
1291
|
|
|
1287
1292
|
.v-field--active & {
|
|
1288
|
-
color:
|
|
1293
|
+
color: rgb(var(--v-theme-borderError)) !important;
|
|
1289
1294
|
}
|
|
1290
1295
|
}
|
|
1291
1296
|
|
|
1292
1297
|
.v-messages__message--warning {
|
|
1293
1298
|
:deep(.v-input__control) {
|
|
1294
|
-
color:
|
|
1299
|
+
color: rgb(var(--v-theme-textWarning)) !important;
|
|
1295
1300
|
|
|
1296
1301
|
--v-medium-emphasis-opacity: 1;
|
|
1297
1302
|
}
|
|
1298
1303
|
|
|
1299
1304
|
:deep(.v-messages__message) {
|
|
1300
|
-
color:
|
|
1305
|
+
color: rgb(var(--v-theme-textWarning)) !important;
|
|
1301
1306
|
}
|
|
1302
1307
|
|
|
1303
1308
|
.v-field--active & {
|
|
1304
|
-
color:
|
|
1309
|
+
color: rgb(var(--v-theme-textWarning)) !important;
|
|
1305
1310
|
}
|
|
1306
1311
|
}
|
|
1307
1312
|
|
|
1308
1313
|
:deep(.v-btn__content) {
|
|
1309
|
-
font-size:
|
|
1314
|
+
font-size: var(--v-fontSize-corpsDeTexte) + 3;
|
|
1310
1315
|
font-weight: bold;
|
|
1311
1316
|
}
|
|
1312
1317
|
|
|
@@ -1337,7 +1342,7 @@
|
|
|
1337
1342
|
}
|
|
1338
1343
|
|
|
1339
1344
|
:deep(.v-date-picker-month__day .v-btn:hover) {
|
|
1340
|
-
background-color:
|
|
1345
|
+
background-color: rgb(var(--v-theme-backgroundMain));
|
|
1341
1346
|
}
|
|
1342
1347
|
|
|
1343
1348
|
:deep(.v-date-picker-month__day--selected, .v-date-picker-month__day--adjacent) {
|
|
@@ -1345,7 +1350,7 @@
|
|
|
1345
1350
|
}
|
|
1346
1351
|
|
|
1347
1352
|
:deep(.v-date-picker-month__day--selected .v-btn:hover) {
|
|
1348
|
-
background-color:
|
|
1353
|
+
background-color: rgb(var(--v-theme-backgroundAccentContrasted)) !important;
|
|
1349
1354
|
}
|
|
1350
1355
|
|
|
1351
1356
|
:deep(.weekend .v-date-picker-month__day--week-end .v-btn) {
|
|
@@ -157,7 +157,30 @@ describe('ComplexDatePicker.clean', () => {
|
|
|
157
157
|
expect(wrapper.vm.selectedDates).not.toBeNull()
|
|
158
158
|
|
|
159
159
|
const input = wrapper.find('input')
|
|
160
|
-
expect((input.element as HTMLInputElement).value).toBe('01/01/2025 - ')
|
|
160
|
+
expect((input.element as HTMLInputElement).value).toBe('01/01/2025 - 10/01/2025')
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
it('generates all intermediate dates when selecting a range in range mode', async () => {
|
|
164
|
+
const wrapper = mountComponent({
|
|
165
|
+
label: 'Date Field',
|
|
166
|
+
format: 'DD/MM/YYYY',
|
|
167
|
+
displayRange: true,
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
await wrapper.vm.handleDateSelected(['01/01/2025', '05/01/2025'])
|
|
171
|
+
await flushPromises()
|
|
172
|
+
|
|
173
|
+
const selection = wrapper.vm.selectedDates as Date[]
|
|
174
|
+
expect(Array.isArray(selection)).toBe(true)
|
|
175
|
+
// Should contain 5 dates: 01/01, 02/01, 03/01, 04/01, 05/01
|
|
176
|
+
expect(selection).toHaveLength(5)
|
|
177
|
+
|
|
178
|
+
// Verify start and end dates are correct (handle timezone differences)
|
|
179
|
+
expect(selection[0]).toBeInstanceOf(Date)
|
|
180
|
+
expect(selection[selection.length - 1]).toBeInstanceOf(Date)
|
|
181
|
+
// Use local date string to avoid timezone issues
|
|
182
|
+
expect(selection[0]?.toLocaleDateString('fr-FR')).toContain('01/01/2025')
|
|
183
|
+
expect(selection[selection.length - 1]?.toLocaleDateString('fr-FR')).toContain('05/01/2025')
|
|
161
184
|
})
|
|
162
185
|
|
|
163
186
|
it('formatDateInput formats raw digits according to the format and computes cursor position', () => {
|
package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts
CHANGED
|
@@ -76,7 +76,7 @@ ValidationExamples.parameters = {
|
|
|
76
76
|
<script setup>
|
|
77
77
|
import { computed, ref, watch } from 'vue';vue'
|
|
78
78
|
import DatePicker from '@/components/DatePicker/CalendarMode/DatePicker.vue'
|
|
79
|
-
import { useDateFormat } from '@/composables/date/
|
|
79
|
+
import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
|
|
80
80
|
|
|
81
81
|
// Exemple 1: Validation de base (required)
|
|
82
82
|
const date1 = ref('')
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { useValidatable } from '@/composables/validation/useValidatable'
|
|
17
17
|
import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
|
|
18
18
|
import { DATE_PICKER_MESSAGES } from '../constants/messages'
|
|
19
|
-
import type {
|
|
19
|
+
import type { DateModelValue } from '@/composables/date/useDateInitializationDayjs'
|
|
20
20
|
import type { DateObjectValue } from '../types'
|
|
21
21
|
|
|
22
22
|
dayjs.extend(customParseFormat)
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
isOutlined?: boolean
|
|
41
41
|
isValidateOnBlur?: boolean
|
|
42
42
|
label: string
|
|
43
|
-
modelValue?:
|
|
43
|
+
modelValue?: DateModelValue
|
|
44
44
|
noIcon?: boolean
|
|
45
45
|
persistentHint?: boolean
|
|
46
46
|
placeholder?: string
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
})
|
|
78
78
|
|
|
79
79
|
const emit = defineEmits<{
|
|
80
|
-
(e: 'update:model-value', value:
|
|
80
|
+
(e: 'update:model-value', value: DateModelValue): void
|
|
81
81
|
(e: 'focus'): void
|
|
82
82
|
(e: 'blur'): void
|
|
83
83
|
(e: 'input', value: string): void
|
|
84
|
-
(e: 'date-selected', value:
|
|
84
|
+
(e: 'date-selected', value: DateModelValue): void
|
|
85
85
|
}>()
|
|
86
86
|
|
|
87
87
|
/**
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
errors: ref<string[]>([]),
|
|
112
112
|
warnings: ref<string[]>([]),
|
|
113
113
|
successes: ref<string[]>([]),
|
|
114
|
+
displaySuccesses: computed(() => []),
|
|
114
115
|
hasError: ref(false),
|
|
115
116
|
clearValidation: () => {},
|
|
116
117
|
validateField: () => ({
|
|
@@ -153,7 +154,8 @@
|
|
|
153
154
|
// Agrégation des erreurs internes et externes
|
|
154
155
|
const errorMessages = computed(() => [...errors.value, ...props.externalErrorMessages])
|
|
155
156
|
const warningMessages = warnings
|
|
156
|
-
const
|
|
157
|
+
const displaySuccesses = computed(() => (validationApi.value as typeof baseValidation).displaySuccesses?.value ?? [])
|
|
158
|
+
const successMessages = displaySuccesses
|
|
157
159
|
|
|
158
160
|
/**
|
|
159
161
|
* Safe validate utility
|
|
@@ -576,7 +578,7 @@
|
|
|
576
578
|
return formatDate(date, returnFormat.value)
|
|
577
579
|
}
|
|
578
580
|
|
|
579
|
-
function emitModel(val:
|
|
581
|
+
function emitModel(val: DateModelValue) {
|
|
580
582
|
emit('update:model-value', val)
|
|
581
583
|
}
|
|
582
584
|
|
|
@@ -688,12 +690,31 @@
|
|
|
688
690
|
|
|
689
691
|
if (formatValidationResult.isValid && !customRulesValidationResult.hasError && !isRange.value) {
|
|
690
692
|
const parsedDate = dayjs(inputValue.value, displayFormat.value, true).toDate()
|
|
693
|
+
// Guard isFormatting to prevent the modelValue watcher from
|
|
694
|
+
// rewriting inputValue in reaction to our own emit.
|
|
695
|
+
isFormatting.value = true
|
|
691
696
|
emitModel(returnFormat.value !== displayFormat.value ? dayjs(parsedDate).format(returnFormat.value) : inputValue.value)
|
|
692
697
|
}
|
|
693
698
|
else if (formatValidationResult.isValid && !customRulesValidationResult.hasError && isRange.value) {
|
|
694
699
|
if (typeof inputValue.value === 'string' && inputValue.value.includes(' - ')) {
|
|
695
700
|
const dateRangeParts = inputValue.value.split(' - ')
|
|
696
|
-
if (dateRangeParts.length === 2)
|
|
701
|
+
if (dateRangeParts.length === 2) {
|
|
702
|
+
const sd = dayjs(dateRangeParts[0]!, displayFormat.value, true)
|
|
703
|
+
const ed = dayjs(dateRangeParts[1]!, displayFormat.value, true)
|
|
704
|
+
// Guard isFormatting to prevent the modelValue watcher from
|
|
705
|
+
// rewriting inputValue in reaction to our own emit.
|
|
706
|
+
isFormatting.value = true
|
|
707
|
+
if (sd.isValid() && ed.isValid()) {
|
|
708
|
+
const emittedRange: [string, string] = [
|
|
709
|
+
returnFormat.value !== displayFormat.value ? sd.format(returnFormat.value) : dateRangeParts[0]!,
|
|
710
|
+
returnFormat.value !== displayFormat.value ? ed.format(returnFormat.value) : dateRangeParts[1]!,
|
|
711
|
+
]
|
|
712
|
+
emitModel(emittedRange)
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
emitModel([dateRangeParts[0]!, dateRangeParts[1]!])
|
|
716
|
+
}
|
|
717
|
+
}
|
|
697
718
|
else emitModel(inputValue.value)
|
|
698
719
|
}
|
|
699
720
|
else emitModel(inputValue.value)
|
|
@@ -701,29 +722,40 @@
|
|
|
701
722
|
else {
|
|
702
723
|
runRules(inputValue.value)
|
|
703
724
|
if (!props.disableErrorHandling && formatValidationResult.message) errors.value.push(formatValidationResult.message)
|
|
704
|
-
//
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
// For custom rule errors with valid format, keep the current value
|
|
725
|
+
// Keep the invalid input visible so the user can correct it.
|
|
726
|
+
// Do NOT emit null — that would trigger the modelValue watcher
|
|
727
|
+
// which clears inputValue and hides the error message.
|
|
728
|
+
return
|
|
709
729
|
}
|
|
710
730
|
}
|
|
711
731
|
|
|
712
732
|
// autoClamp au blur
|
|
713
|
-
if (props.autoClamp)
|
|
733
|
+
if (props.autoClamp) {
|
|
734
|
+
const clamped = clampIfNeeded(inputValue.value)
|
|
735
|
+
if (clamped !== inputValue.value) {
|
|
736
|
+
inputValue.value = clamped
|
|
714
737
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
738
|
+
// Sync model après clamp uniquement si la valeur a changé
|
|
739
|
+
isFormatting.value = true
|
|
740
|
+
if (isRange.value) {
|
|
741
|
+
const [startDate, endDate] = parseRangeInput(inputValue.value)
|
|
742
|
+
if (startDate && endDate) emitModel([toReturnFormat(startDate), toReturnFormat(endDate)])
|
|
743
|
+
else if (startDate) emit('date-selected', toReturnFormat(startDate))
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
const parsedDate = parseDate(inputValue.value, displayFormat.value)
|
|
747
|
+
if (parsedDate) emitModel(returnFormat.value !== displayFormat.value ? toReturnFormat(parsedDate) : formatDate(parsedDate, displayFormat.value))
|
|
748
|
+
}
|
|
749
|
+
}
|
|
724
750
|
}
|
|
725
751
|
|
|
726
752
|
runRules(inputValue.value)
|
|
753
|
+
|
|
754
|
+
// Release isFormatting after the current microtask so that
|
|
755
|
+
// the modelValue watcher (triggered synchronously by emitModel)
|
|
756
|
+
// stays blocked, but future external changes are allowed.
|
|
757
|
+
await nextTick()
|
|
758
|
+
isFormatting.value = false
|
|
727
759
|
}
|
|
728
760
|
|
|
729
761
|
/**
|
|
@@ -1092,7 +1124,9 @@
|
|
|
1092
1124
|
:readonly="props.readonly"
|
|
1093
1125
|
:variant-style="props.isOutlined ? 'outlined' : 'underlined'"
|
|
1094
1126
|
:warning-messages="warningMessages"
|
|
1095
|
-
:success-messages="
|
|
1127
|
+
:success-messages="successMessages"
|
|
1128
|
+
:has-success="isOnSuccess"
|
|
1129
|
+
:show-success-messages="props.showSuccessMessages"
|
|
1096
1130
|
:bg-color="props.bgColor"
|
|
1097
1131
|
color="primary"
|
|
1098
1132
|
:is-clearable="!props.readonly"
|
|
@@ -1110,8 +1144,6 @@
|
|
|
1110
1144
|
</template>
|
|
1111
1145
|
|
|
1112
1146
|
<style lang="scss" scoped>
|
|
1113
|
-
@use '@/assets/tokens';
|
|
1114
|
-
|
|
1115
1147
|
:deep(.v-icon__svg) { cursor: default; }
|
|
1116
1148
|
|
|
1117
1149
|
.warning-field {
|
|
@@ -1122,10 +1154,10 @@
|
|
|
1122
1154
|
}
|
|
1123
1155
|
|
|
1124
1156
|
:deep(.v-field) {
|
|
1125
|
-
color:
|
|
1157
|
+
color: rgb(var(--v-theme-borderWarning)) !important;
|
|
1126
1158
|
|
|
1127
1159
|
.v-field__outline {
|
|
1128
|
-
color:
|
|
1160
|
+
color: rgb(var(--v-theme-borderWarning)) !important;
|
|
1129
1161
|
}
|
|
1130
1162
|
}
|
|
1131
1163
|
|
|
@@ -1133,7 +1165,7 @@
|
|
|
1133
1165
|
opacity: 1 !important;
|
|
1134
1166
|
|
|
1135
1167
|
.v-messages__message {
|
|
1136
|
-
color:
|
|
1168
|
+
color: rgb(var(--v-theme-borderWarning)) !important;
|
|
1137
1169
|
}
|
|
1138
1170
|
}
|
|
1139
1171
|
}
|
|
@@ -1141,11 +1173,11 @@
|
|
|
1141
1173
|
.error-field {
|
|
1142
1174
|
:deep(.v-input__control),
|
|
1143
1175
|
:deep(.v-messages__message) {
|
|
1144
|
-
color:
|
|
1176
|
+
color: rgb(var(--v-theme-textError)) !important;
|
|
1145
1177
|
}
|
|
1146
1178
|
|
|
1147
1179
|
.v-field--active & {
|
|
1148
|
-
color:
|
|
1180
|
+
color: rgb(var(--v-theme-borderError)) !important;
|
|
1149
1181
|
}
|
|
1150
1182
|
}
|
|
1151
1183
|
|
|
@@ -1157,10 +1189,10 @@
|
|
|
1157
1189
|
}
|
|
1158
1190
|
|
|
1159
1191
|
:deep(.v-field) {
|
|
1160
|
-
color:
|
|
1192
|
+
color: rgb(var(--v-theme-borderSuccess)) !important;
|
|
1161
1193
|
|
|
1162
1194
|
.v-field__outline {
|
|
1163
|
-
color:
|
|
1195
|
+
color: rgb(var(--v-theme-borderSuccess)) !important;
|
|
1164
1196
|
}
|
|
1165
1197
|
}
|
|
1166
1198
|
|
|
@@ -1168,7 +1200,7 @@
|
|
|
1168
1200
|
opacity: 1 !important;
|
|
1169
1201
|
|
|
1170
1202
|
.v-messages__message {
|
|
1171
|
-
color:
|
|
1203
|
+
color: rgb(var(--v-theme-borderSuccess)) !important;
|
|
1172
1204
|
}
|
|
1173
1205
|
}
|
|
1174
1206
|
}
|
|
@@ -196,7 +196,7 @@ const meta = {
|
|
|
196
196
|
},
|
|
197
197
|
'birthDate': {
|
|
198
198
|
control: 'boolean',
|
|
199
|
-
description: '
|
|
199
|
+
description: '⚠️ **DEPRECATED** — Utilisez `isBirthDate` à la place.',
|
|
200
200
|
defaultValue: false,
|
|
201
201
|
},
|
|
202
202
|
'isBirthDate': {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { useDatePickerState } from '../useDatePickerState'
|
|
4
|
+
|
|
5
|
+
describe('useDatePickerState', () => {
|
|
6
|
+
const mockParseDate = vi.fn()
|
|
7
|
+
const mockFormatDate = vi.fn()
|
|
8
|
+
const mockInitializeSelectedDates = vi.fn()
|
|
9
|
+
const mockValidateDates = vi.fn()
|
|
10
|
+
const mockUpdateModel = vi.fn()
|
|
11
|
+
const mockGenerateDateRange = vi.fn()
|
|
12
|
+
|
|
13
|
+
const format = 'DD/MM/YYYY'
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
vi.clearAllMocks()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
describe('syncFromModelValue', () => {
|
|
20
|
+
it('devrait initialiser selectedDates et générer les dates intermédiaires en mode plage', () => {
|
|
21
|
+
const selectedDates = ref<Date | (Date | null)[] | null>(null)
|
|
22
|
+
const startDate = new Date('2023-01-01')
|
|
23
|
+
const endDate = new Date('2023-01-05')
|
|
24
|
+
const intermediateDate = new Date('2023-01-03')
|
|
25
|
+
|
|
26
|
+
mockInitializeSelectedDates.mockReturnValue([startDate, endDate])
|
|
27
|
+
mockFormatDate.mockImplementation((date) => {
|
|
28
|
+
if (date === startDate) return '01/01/2023'
|
|
29
|
+
if (date === endDate) return '05/01/2023'
|
|
30
|
+
return ''
|
|
31
|
+
})
|
|
32
|
+
mockGenerateDateRange.mockReturnValue([startDate, intermediateDate, endDate])
|
|
33
|
+
|
|
34
|
+
const { syncFromModelValue } = useDatePickerState({
|
|
35
|
+
selectedDates,
|
|
36
|
+
format,
|
|
37
|
+
displayRange: true,
|
|
38
|
+
parseDate: mockParseDate,
|
|
39
|
+
formatDate: mockFormatDate,
|
|
40
|
+
initializeSelectedDates: mockInitializeSelectedDates,
|
|
41
|
+
validateDates: mockValidateDates,
|
|
42
|
+
updateModel: mockUpdateModel,
|
|
43
|
+
generateDateRange: mockGenerateDateRange,
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
syncFromModelValue(['01/01/2023', '05/01/2023'])
|
|
47
|
+
|
|
48
|
+
expect(mockInitializeSelectedDates).toHaveBeenCalled()
|
|
49
|
+
expect(mockGenerateDateRange).toHaveBeenCalledWith(startDate, endDate)
|
|
50
|
+
expect(selectedDates.value).toEqual([startDate, intermediateDate, endDate])
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, ref, watch, type Ref, type ComputedRef } from 'vue'
|
|
2
|
-
import type { DateInput,
|
|
2
|
+
import type { DateInput, DateModelValue } from '@/composables/date/useDateInitializationDayjs'
|
|
3
|
+
import { DATE_PICKER_MESSAGES } from '../constants/messages'
|
|
3
4
|
|
|
4
5
|
export interface UseDatePickerStateOptions {
|
|
5
6
|
selectedDates: Ref<Date | (Date | null)[] | null>
|
|
@@ -11,7 +12,8 @@ export interface UseDatePickerStateOptions {
|
|
|
11
12
|
formatDate: (date: Date | null, format: string) => string
|
|
12
13
|
initializeSelectedDates: (value: DateInput | null, format: string, dateFormatReturn?: string) => Date | (Date | null)[] | null
|
|
13
14
|
validateDates: (forceValidation?: boolean) => void
|
|
14
|
-
updateModel: (value:
|
|
15
|
+
updateModel: (value: DateModelValue) => void
|
|
16
|
+
generateDateRange?: (start: Date, end: Date) => Date[]
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface UseDatePickerStateResult {
|
|
@@ -19,7 +21,7 @@ export interface UseDatePickerStateResult {
|
|
|
19
21
|
rangeBoundaryDates?: Ref<[Date | null, Date | null] | null>
|
|
20
22
|
textInputValue: Ref<string>
|
|
21
23
|
displayFormattedDate: Ref<string>
|
|
22
|
-
formattedDate: Ref<
|
|
24
|
+
formattedDate: Ref<DateModelValue>
|
|
23
25
|
displayFormattedFromSelectedDates: ComputedRef<string | null>
|
|
24
26
|
syncFromModelValue: (newValue: DateInput | undefined) => void
|
|
25
27
|
syncTextInputFromSelection: () => void
|
|
@@ -37,12 +39,13 @@ export const useDatePickerState = (options: UseDatePickerStateOptions): UseDateP
|
|
|
37
39
|
initializeSelectedDates,
|
|
38
40
|
validateDates,
|
|
39
41
|
// updateModel,
|
|
42
|
+
generateDateRange,
|
|
40
43
|
} = options
|
|
41
44
|
|
|
42
45
|
const textInputValue = ref('')
|
|
43
46
|
const displayFormattedDate = ref('')
|
|
44
47
|
|
|
45
|
-
const formattedDate = computed<
|
|
48
|
+
const formattedDate = computed<DateModelValue>(() => {
|
|
46
49
|
if (!selectedDates.value) return ''
|
|
47
50
|
const rf = dateFormatReturn || format
|
|
48
51
|
|
|
@@ -71,7 +74,7 @@ export const useDatePickerState = (options: UseDatePickerStateOptions): UseDateP
|
|
|
71
74
|
|
|
72
75
|
if (Array.isArray(selectedDates.value)) {
|
|
73
76
|
if (selectedDates.value.length >= 2) {
|
|
74
|
-
return `${formatDate(selectedDates.value[0]!, format)}
|
|
77
|
+
return `${formatDate(selectedDates.value[0]!, format)}${DATE_PICKER_MESSAGES.RANGE_SEPARATOR}${formatDate(
|
|
75
78
|
selectedDates.value[selectedDates.value.length - 1]!,
|
|
76
79
|
format,
|
|
77
80
|
)}`
|
|
@@ -89,7 +92,17 @@ export const useDatePickerState = (options: UseDatePickerStateOptions): UseDateP
|
|
|
89
92
|
textInputValue.value = ''
|
|
90
93
|
return
|
|
91
94
|
}
|
|
92
|
-
if (
|
|
95
|
+
if (Array.isArray(newValue) && newValue.length === 2) {
|
|
96
|
+
// Mode plage : afficher "startDate - endDate" dans l'input
|
|
97
|
+
const startStr = dateFormatReturn
|
|
98
|
+
? formatDate(parseDate(newValue[0]!, dateFormatReturn), format)
|
|
99
|
+
: newValue[0]!
|
|
100
|
+
const endStr = dateFormatReturn
|
|
101
|
+
? formatDate(parseDate(newValue[1]!, dateFormatReturn), format)
|
|
102
|
+
: newValue[1]!
|
|
103
|
+
textInputValue.value = `${startStr}${DATE_PICKER_MESSAGES.RANGE_SEPARATOR}${endStr}`
|
|
104
|
+
}
|
|
105
|
+
else if (typeof newValue === 'string') {
|
|
93
106
|
if (dateFormatReturn) {
|
|
94
107
|
const date = parseDate(newValue, dateFormatReturn)
|
|
95
108
|
if (date) {
|
|
@@ -115,17 +128,35 @@ export const useDatePickerState = (options: UseDatePickerStateOptions): UseDateP
|
|
|
115
128
|
}
|
|
116
129
|
|
|
117
130
|
selectedDates.value = initializeSelectedDates(newValue ?? null, format, dateFormatReturn)
|
|
131
|
+
|
|
132
|
+
if (displayRange && Array.isArray(selectedDates.value) && selectedDates.value.length === 2) {
|
|
133
|
+
const startDate = selectedDates.value[0]
|
|
134
|
+
const endDate = selectedDates.value[1]
|
|
135
|
+
if (startDate && endDate && generateDateRange) {
|
|
136
|
+
// Regenerate intermediate dates for Vuetify range selection
|
|
137
|
+
selectedDates.value = generateDateRange(startDate, endDate)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
118
141
|
if (selectedDates.value) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
142
|
+
if (displayRange && Array.isArray(selectedDates.value) && selectedDates.value.length >= 2) {
|
|
143
|
+
const startDate = selectedDates.value[0]
|
|
144
|
+
const endDate = selectedDates.value[selectedDates.value.length - 1]
|
|
145
|
+
if (startDate && endDate) {
|
|
146
|
+
textInputValue.value = `${formatDate(startDate, format)}${DATE_PICKER_MESSAGES.RANGE_SEPARATOR}${formatDate(endDate, format)}`
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const firstDate = Array.isArray(selectedDates.value)
|
|
151
|
+
? selectedDates.value[0]
|
|
152
|
+
: selectedDates.value
|
|
153
|
+
if (firstDate) {
|
|
154
|
+
textInputValue.value = formatDate(firstDate, format)
|
|
155
|
+
}
|
|
125
156
|
}
|
|
126
157
|
if (Array.isArray(formattedDate.value)) {
|
|
127
158
|
// Pour les plages, formater avec le séparateur standard " - "
|
|
128
|
-
displayFormattedDate.value = formattedDate.value.join(
|
|
159
|
+
displayFormattedDate.value = formattedDate.value.join(DATE_PICKER_MESSAGES.RANGE_SEPARATOR)
|
|
129
160
|
}
|
|
130
161
|
else {
|
|
131
162
|
displayFormattedDate.value = (formattedDate.value as string) || ''
|
|
@@ -141,6 +172,18 @@ export const useDatePickerState = (options: UseDatePickerStateOptions): UseDateP
|
|
|
141
172
|
return
|
|
142
173
|
}
|
|
143
174
|
|
|
175
|
+
if (displayRange && Array.isArray(value) && value.length >= 2) {
|
|
176
|
+
const startDate = value[0]
|
|
177
|
+
const endDate = value[value.length - 1]
|
|
178
|
+
if (startDate && endDate) {
|
|
179
|
+
const formattedForInput = `${formatDate(startDate, format)}${DATE_PICKER_MESSAGES.RANGE_SEPARATOR}${formatDate(endDate, format)}`
|
|
180
|
+
if (textInputValue.value !== formattedForInput) {
|
|
181
|
+
textInputValue.value = formattedForInput
|
|
182
|
+
}
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
144
187
|
const firstDate = Array.isArray(value) ? (value[0] ?? null) : value
|
|
145
188
|
if (!firstDate) return
|
|
146
189
|
|
|
@@ -2,6 +2,7 @@ import { ref, computed } from 'vue'
|
|
|
2
2
|
import dayjs from 'dayjs'
|
|
3
3
|
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
4
4
|
import { extractRangeParts as extractRangePartsUtil, hasRangeSeparator as hasRangeSeparatorUtil, isValidDateRange } from '../utils/dateFormattingUtils'
|
|
5
|
+
import { DATE_PICKER_MESSAGES } from '../constants/messages'
|
|
5
6
|
|
|
6
7
|
// Initialiser les plugins dayjs
|
|
7
8
|
dayjs.extend(customParseFormat)
|
|
@@ -23,7 +24,7 @@ export function useDateRangeInput(
|
|
|
23
24
|
// Stockage temporaire pour la deuxième date saisie
|
|
24
25
|
const secondDate = ref<Date | null>(null)
|
|
25
26
|
// Séparateur de plage
|
|
26
|
-
const rangeSeparator =
|
|
27
|
+
const rangeSeparator = DATE_PICKER_MESSAGES.RANGE_SEPARATOR
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Vérifie si une chaîne de caractères contient un séparateur de plage
|