@cnamts/synapse 1.0.25 → 1.0.27
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-D7qBuCAP.js → AutocompleteFilter-C9eLKyW8.js} +3 -3
- package/dist/{DateFilter-BitMWrMU.js → DateFilter-y-GLkAkn.js} +9 -9
- package/dist/{NumberFilter-BTLUxw0a.js → NumberFilter-DN6hIBS7.js} +1 -1
- package/dist/{PeriodFilter-B5rUIPAC.js → PeriodFilter-MoUUp9qS.js} +1 -1
- package/dist/{SelectFilter-l4QnRcuk.js → SelectFilter-bCbrdLmu.js} +1 -1
- package/dist/{TextFilter-C9hj6Qrp.js → TextFilter-CvjgEaoM.js} +4 -4
- package/dist/apLightTheme2026-ug4Y23ns.js +611 -0
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +2369 -351
- package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +18 -0
- package/dist/components/Customs/Selects/SyAutocomplete/utils/ariaManager.d.ts +1 -1
- package/dist/components/Customs/Selects/SyAutocomplete/utils/useKeyboardHandler.d.ts +3 -1
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +58 -288
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.d.ts +1 -0
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +15 -0
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +4 -3
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +4 -3
- package/dist/components/Customs/SyIconButton/SyIconButton.d.ts +18 -0
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +20 -37
- package/dist/components/Customs/SyRadioGroup/composables/useSyRadioGroupValidation.d.ts +50 -0
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +8 -10
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +197 -185
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +91 -82
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +35 -32
- package/dist/components/DatePicker/composables/index.d.ts +1 -0
- package/dist/components/DatePicker/composables/useDatePickerState.d.ts +3 -3
- package/dist/components/DatePicker/composables/useDatePickerValidationBridge.d.ts +51 -0
- 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/LunarCalendar/useLunarCalendarValidation.d.ts +1 -0
- package/dist/components/MonthPicker/MonthPicker.d.ts +24 -24
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +24 -24
- package/dist/components/NirField/NirField.d.ts +64 -60
- package/dist/components/NirField/useNirValidation.d.ts +6 -2
- package/dist/components/PasswordField/PasswordField.d.ts +3 -3
- package/dist/components/PeriodField/PeriodField.d.ts +338 -314
- package/dist/components/PhoneField/PhoneField.d.ts +34 -24
- 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/useRatingFocus.d.ts +18 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +25 -15
- package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +20 -0
- package/dist/components/SyTextArea/locales.d.ts +1 -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 +152 -364
- package/dist/components/Tables/common/TableHeader.d.ts +1 -1
- package/dist/components/Tables/common/filters/DateFilter.d.ts +4 -4
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/composables/date/useDateInitializationDayjs.d.ts +3 -1
- package/dist/composables/unifyValidation/documentationValidationProps.d.ts +160 -160
- package/dist/composables/unifyValidation/useCustomValidation.d.ts +3 -1
- package/dist/composables/unifyValidation/useValidation.d.ts +27 -19
- package/dist/composables/unifyValidation/useVuetifyValidation.d.ts +1 -1
- package/dist/composables/validation/useValidation.d.ts +1 -0
- package/dist/design-system-v3.js +81 -80
- package/dist/designTokens/tokens/amelipro/apContextual.d.ts +6 -6
- package/dist/designTokens/tokens/amelipro/apDarkTheme.d.ts +3 -1
- package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +53 -98
- package/dist/designTokens/tokens/baseContextualTokens.d.ts +0 -6
- package/dist/designTokens/tokens/baseTokens.d.ts +232 -0
- package/dist/designTokens/tokens/cnam/cnamContextual.d.ts +6 -6
- package/dist/designTokens/tokens/cnam/cnamDarkTheme.d.ts +1 -1
- package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +57 -99
- package/dist/designTokens/tokens/pa/paContextual.d.ts +0 -6
- package/dist/designTokens/tokens/pa/paDarkTheme.d.ts +1 -1
- package/dist/designTokens/tokens/pa/paLightTheme.d.ts +53 -97
- package/dist/designTokens/tokens/pa/paSemantic.d.ts +1 -0
- package/dist/designTokens/tokens/semanticTokens.d.ts +112 -0
- package/dist/{main-Cpx8Co6H.js → main-CI6Q9nmO.js} +13843 -13478
- package/dist/synapse.css +1 -1
- package/dist/vuetifyConfig.js +208 -72
- package/package.json +10 -7
- package/src/assets/overrides/_icons.scss +5 -17
- package/src/assets/overrides/_otp.scss +4 -5
- package/src/assets/overrides/_typography.scss +2 -1
- package/src/assets/overrides/_utilities.scss +1 -42
- package/src/components/Accordion/Accordion.vue +2 -0
- package/src/components/ChipList/ChipList.vue +30 -18
- package/src/components/ChipList/tests/chipList.spec.ts +4 -4
- package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -1
- package/src/components/CookiesSelection/CookiesSelection.vue +2 -1
- package/src/components/CopyBtn/CopyBtn.vue +9 -0
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +4 -0
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +7 -6
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +223 -0
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.stories.ts +283 -351
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +183 -219
- package/src/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.ts +101 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +761 -1
- package/src/components/Customs/Selects/SyAutocomplete/utils/ariaManager.ts +3 -1
- package/src/components/Customs/Selects/SyAutocomplete/utils/useKeyboardHandler.ts +79 -5
- package/src/components/Customs/Selects/SyAutocomplete/validation/Validation.stories.ts +1029 -0
- package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +52 -217
- package/src/components/Customs/Selects/SySelect/SySelect.vue +248 -236
- package/src/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.ts +3 -0
- package/src/components/Customs/Selects/SySelect/composables/useSySelectValidation.ts +64 -0
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +440 -5
- package/src/components/Customs/Selects/SySelect/validation/Validation.stories.ts +1026 -0
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +18 -7
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +5 -5
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +8 -8
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +27 -6
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +1 -1
- package/src/components/Customs/SyIcon/accessibilite/Accessibility.mdx +0 -6
- package/src/components/Customs/SyIcon/utils/tests/iconUtils.spec.ts +107 -0
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.mdx +2 -2
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.stories.ts +395 -200
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +100 -127
- package/src/components/Customs/SyRadioGroup/composables/useSyRadioGroupValidation.ts +127 -0
- package/src/components/Customs/SyRadioGroup/tests/SyRadioGroup.a11y.spec.ts +93 -1
- package/src/components/Customs/SyRadioGroup/tests/SyRadioGroup.spec.ts +146 -9
- package/src/components/Customs/SyRadioGroup/tests/SyRadioGroup.visual.cy.ts +165 -0
- package/src/components/Customs/SyRadioGroup/validation/Validation.stories.ts +773 -0
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +5 -5
- package/src/components/Customs/SyTabs/config.ts +3 -3
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +265 -0
- package/src/components/Customs/SyTabs/tests/useTabTransition.spec.ts +188 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +10 -29
- package/src/components/Customs/SyTextField/SyTextField.vue +52 -17
- package/src/components/DataList/DataList.stories.ts +1 -1
- package/src/components/DataListItem/tests/DataListItem.spec.ts +3 -1
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +1 -1
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +52 -154
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.coverage.spec.ts +156 -0
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.spec.ts +495 -4
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1 -1
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +55 -73
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +207 -1
- package/src/components/DatePicker/ComplexDatePicker/tests/bridge-integration.regression.spec.ts +210 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/calendar-navigation.regression.spec.ts +214 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/validation-cross.regression.spec.ts +194 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/validation-success-messages.regression.spec.ts +83 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +1 -1
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +169 -60
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +1 -1
- package/src/components/DatePicker/DateTextInput/tests/DateTextInput.spec.ts +320 -0
- package/src/components/DatePicker/composables/index.ts +1 -0
- package/src/components/DatePicker/composables/tests/useCalendarKeyboardNavigation.spec.ts +360 -0
- package/src/components/DatePicker/composables/tests/useDatePickerValidationBridge.spec.ts +129 -0
- package/src/components/DatePicker/composables/useDatePickerState.ts +33 -14
- package/src/components/DatePicker/composables/useDatePickerValidationBridge.ts +205 -0
- 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 -2
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +2 -2
- package/src/components/DatePicker/docExamples/BidirectionalComplexValidation.vue +1 -1
- package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +1 -1
- package/src/components/DatePicker/tests/exposed-methods.coverage.spec.ts +75 -0
- package/src/components/DatePicker/types.ts +1 -2
- package/src/components/DialogBox/DialogBox.stories.ts +8 -8
- package/src/components/DialogBox/DialogBox.vue +1 -1
- package/src/components/DialogBox/accessibilite/Accessibility.mdx +86 -22
- package/src/components/FileList/UploadItem/UploadItem.vue +4 -4
- package/src/components/FileUpload/FileUpload.vue +2 -2
- package/src/components/FileUpload/FileUploadContent.vue +1 -1
- package/src/components/FilterInline/FilterInline.mdx +2 -2
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +1 -1
- package/src/components/FilterSideBar/FilterSideBar.vue +4 -3
- package/src/components/FooterBar/FooterBar.vue +7 -7
- package/src/components/FranceConnectBtn/FranceConnectBtn.vue +1 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.vue +2 -2
- package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.vue +7 -7
- package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +2 -2
- package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +87 -8
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +3 -3
- package/src/components/HeaderNavigationBar/HorizontalNavbar/tests/HorizontalNavbar.spec.ts +589 -0
- package/src/components/HeaderToolbar/tests/HeaderToolBar.spec.ts +153 -1
- package/src/components/HeaderToolbar/tests/useMobileRightMenu.spec.ts +258 -0
- package/src/components/LangBtn/LangBtn.vue +2 -1
- package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +2 -2
- package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +1 -1
- package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +184 -0
- package/src/components/MonthPicker/MonthPickerVisual/MonthSelector.vue +3 -3
- package/src/components/MonthPicker/MonthPickerVisual/VisualPickerFooter.vue +1 -1
- package/src/components/MonthPicker/MonthPickerVisual/VisualPickerHeader.vue +2 -2
- package/src/components/MonthPicker/MonthPickerVisual/YearSelector.vue +1 -1
- package/src/components/NirField/NirField.vue +3 -3
- package/src/components/NotificationBar/Notification/Notification.vue +12 -12
- package/src/components/NotificationBar/NotificationBar.stories.ts +8 -8
- package/src/components/PaginatedTable/PaginatedTable.vue +1 -1
- package/src/components/PaginatedTable/Pagination.vue +3 -3
- package/src/components/PasswordField/PasswordField.vue +15 -11
- package/src/components/PasswordField/tests/PasswordField.spec.ts +3 -3
- package/src/components/PhoneField/PhoneField.vue +4 -2
- package/src/components/RangeField/RangeSlider/RangeSlider.vue +11 -18
- package/src/components/RangeField/RangeSlider/Tooltip/Tooltip.vue +1 -1
- package/src/components/RatingPicker/EmotionPicker/EmotionPicker.vue +32 -48
- 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 +28 -37
- 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.spec.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/StatusPage/tests/StatusPage.spec.ts +149 -0
- package/src/components/SubHeader/SubHeader.vue +1 -1
- package/src/components/SyAlert/SyAlert.vue +23 -23
- package/src/components/SyTextArea/SyTextArea.stories.ts +177 -131
- package/src/components/SyTextArea/SyTextArea.vue +257 -74
- package/src/components/SyTextArea/composables/useSyTextAreaValidation.ts +81 -0
- package/src/components/SyTextArea/locales.ts +1 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +449 -1
- package/src/components/SyTextArea/useDefaultValidationRules.ts +2 -7
- package/src/components/SyTextArea/validation/Validation.stories.ts +856 -0
- package/src/components/TableToolbar/TableToolbar.vue +6 -6
- package/src/components/TableToolbar/accessibilite/Accessibility.mdx +81 -7
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +163 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +3 -2
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +67 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +94 -0
- package/src/components/Tables/SyTable/SyTable.vue +3 -2
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +64 -0
- package/src/components/Tables/common/SyTableFilter.vue +4 -4
- package/src/components/Tables/common/SyTablePagination.vue +1 -0
- package/src/components/Tables/common/TableHeader.vue +3 -3
- package/src/components/Tables/common/filters/DateFilter.vue +2 -2
- package/src/components/Tables/common/filters/logics/tests/NumberFilterLogic.spec.ts +176 -0
- package/src/components/Tables/common/filters/logics/tests/SelectFilterLogic.spec.ts +111 -0
- package/src/components/Tables/common/tableStyles.scss +6 -6
- package/src/components/Tables/common/types.ts +2 -0
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/composables/date/tests/useDateFormatDayjs.spec.ts +112 -0
- package/src/composables/date/tests/{useDateInitialization.spec.ts → useDateInitializationDayjs.spec.ts} +39 -3
- package/src/composables/date/tests/useHolidayDay.spec.ts +109 -0
- package/src/composables/date/useDateInitializationDayjs.ts +4 -1
- package/src/composables/rules/tests/useFieldValidation.spec.ts +374 -0
- package/src/composables/tests/useError.spec.ts +30 -0
- package/src/composables/tests/useFormFieldErrorHandling.spec.ts +234 -0
- package/src/composables/unifyValidation/documentationValidationProps.ts +12 -12
- package/src/composables/unifyValidation/tests/documentationValidationProps.spec.ts +177 -0
- package/src/composables/unifyValidation/tests/useCustomValidation.spec.ts +32 -1
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +28 -2
- package/src/composables/unifyValidation/useCustomValidation.ts +34 -12
- package/src/composables/unifyValidation/useValidation.ts +55 -27
- package/src/composables/unifyValidation/useVuetifyValidation.ts +2 -2
- package/src/composables/useFilterable/useFilterable.spec.ts +42 -0
- package/src/composables/useFilterable/useFilterable.ts +11 -7
- package/src/composables/useFormFieldErrorHandling.ts +6 -3
- package/src/composables/validation/tests/useValidation.spec.ts +2 -2
- package/src/composables/validation/useValidation.ts +15 -3
- package/src/composantsVuetify/VBtn/VBtn.mdx +9 -39
- package/src/composantsVuetify/VBtn/v-btn.stories.ts +26 -86
- package/src/composantsVuetify/VCard/VCard.mdx +59 -0
- package/src/composantsVuetify/VCard/v-card.stories.ts +279 -0
- package/src/designTokens/tokens/amelipro/apColors2026.ts +1 -1
- package/src/designTokens/tokens/amelipro/apContextual.ts +6 -0
- package/src/designTokens/tokens/amelipro/apDarkTheme.ts +2 -2
- package/src/designTokens/tokens/amelipro/apLightTheme.ts +72 -100
- package/src/designTokens/tokens/amelipro/apSemantic.ts +1 -1
- package/src/designTokens/tokens/baseContextualTokens.ts +1 -6
- package/src/designTokens/tokens/baseTokens.ts +232 -0
- package/src/designTokens/tokens/cnam/cnamContextual.ts +6 -0
- package/src/designTokens/tokens/cnam/cnamDarkTheme.ts +2 -2
- package/src/designTokens/tokens/cnam/cnamLightTheme.ts +76 -101
- package/src/designTokens/tokens/pa/paDarkTheme.ts +2 -2
- package/src/designTokens/tokens/pa/paLightTheme.ts +73 -99
- package/src/designTokens/tokens/pa/paSemantic.ts +2 -0
- package/src/designTokens/tokens/semanticTokens.ts +114 -0
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +61 -91
- package/src/stories/Accessibilite/AuditDesignSystem.mdx +5 -8
- 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/Introduction.mdx +30 -30
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +168 -78
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +13 -6
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +66 -45
- 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 +18 -20
- package/src/stories/Components/Components.stories.ts +59 -6
- package/src/stories/DesignTokens/ColorIntegrationExample.vue +2 -3
- package/src/stories/DesignTokens/Colors.mdx +6 -8
- package/src/stories/DesignTokens/colors.stories.ts +244 -1081
- package/src/utils/amelipro/toKebabCase/tests/toKebabCase.spec.ts +52 -0
- package/src/utils/formatNir/tests/formatNir.spec.ts +34 -0
- package/src/utils/tests/insertAt.spec.ts +44 -0
- package/dist/AutocompleteFilter-Df9i5mAl.cjs +0 -1
- package/dist/DateFilter-BJD6FMev.cjs +0 -1
- package/dist/NumberFilter-DGCzCXzI.cjs +0 -1
- package/dist/PeriodFilter-DO_ecTZW.cjs +0 -1
- package/dist/SelectFilter-CGwcKWLm.cjs +0 -1
- package/dist/TextFilter-B8nf7xoK.cjs +0 -1
- package/dist/apLightTheme-CEK4iY3f.cjs +0 -1
- package/dist/apLightTheme-DnIM24Lv.js +0 -950
- 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/main-ByDPHpae.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/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/DatePicker/CalendarMode/tests/DatePicker.events.spec.ts +0 -178
- 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/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/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/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/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/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/composables/date/tests/useDateFormat.spec.ts +0 -67
- package/src/composables/date/useDateFormat.ts +0 -110
- package/src/composables/date/useDateInitialization.ts +0 -92
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useValidation, type ValidationRule } from '@/composables/validation/useValidation'
|
|
2
2
|
import { useValidatable } from '@/composables/validation/useValidatable'
|
|
3
|
-
import { watch } from 'vue'
|
|
3
|
+
import { reactive, ref, watch } from 'vue'
|
|
4
4
|
import type { Ref } from 'vue'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -15,29 +15,41 @@ export function useCustomValidation(
|
|
|
15
15
|
warnings: Ref<string[]>,
|
|
16
16
|
successes: Ref<string[]>,
|
|
17
17
|
showSuccessMessages: Ref<boolean>,
|
|
18
|
-
label: Ref<string>,
|
|
18
|
+
label: Ref<string | undefined>,
|
|
19
19
|
focused: Ref<boolean>,
|
|
20
20
|
isValidateOnBlur: Ref<boolean>,
|
|
21
21
|
disableErrorHandling: Ref<boolean>,
|
|
22
22
|
readonly?: Ref<boolean>,
|
|
23
23
|
disabled?: Ref<boolean>,
|
|
24
24
|
) {
|
|
25
|
-
|
|
25
|
+
const hasSuccess = ref(false)
|
|
26
|
+
|
|
27
|
+
const validatorOptions = reactive({
|
|
26
28
|
showSuccessMessages: showSuccessMessages.value,
|
|
27
29
|
fieldIdentifier: label.value,
|
|
28
30
|
disableErrorHandling: disableErrorHandling.value,
|
|
29
31
|
})
|
|
30
32
|
|
|
33
|
+
const validator = useValidation(validatorOptions)
|
|
34
|
+
|
|
31
35
|
watch(
|
|
32
|
-
() => [showSuccessMessages.value, label.value,
|
|
36
|
+
() => [showSuccessMessages.value, label.value, disableErrorHandling.value],
|
|
33
37
|
() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
validatorOptions.showSuccessMessages = showSuccessMessages.value
|
|
39
|
+
validatorOptions.fieldIdentifier = label.value
|
|
40
|
+
validatorOptions.disableErrorHandling = disableErrorHandling.value
|
|
41
|
+
|
|
42
|
+
const isDirty = errors.value.length > 0 || warnings.value.length > 0 || successes.value.length > 0 || hasSuccess.value
|
|
43
|
+
if (isDirty) {
|
|
44
|
+
validate()
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
)
|
|
39
48
|
|
|
40
|
-
|
|
49
|
+
watch(
|
|
50
|
+
() => [customRules?.value, customWarningRules?.value, customSuccessRules?.value],
|
|
51
|
+
() => {
|
|
52
|
+
const isDirty = errors.value.length > 0 || warnings.value.length > 0 || successes.value.length > 0 || hasSuccess.value
|
|
41
53
|
if (isDirty) {
|
|
42
54
|
validate()
|
|
43
55
|
}
|
|
@@ -50,6 +62,7 @@ export function useCustomValidation(
|
|
|
50
62
|
errors.value = []
|
|
51
63
|
warnings.value = []
|
|
52
64
|
successes.value = []
|
|
65
|
+
hasSuccess.value = false
|
|
53
66
|
return { hasError: false, hasWarning: false, hasSuccess: false, state: { errors: [] as string[], warnings: [] as string[], successes: [] as string[] } }
|
|
54
67
|
}
|
|
55
68
|
|
|
@@ -63,6 +76,7 @@ export function useCustomValidation(
|
|
|
63
76
|
errors.value = result.state.errors
|
|
64
77
|
warnings.value = result.state.warnings
|
|
65
78
|
successes.value = result.state.successes
|
|
79
|
+
hasSuccess.value = result.hasSuccess
|
|
66
80
|
|
|
67
81
|
return result
|
|
68
82
|
}
|
|
@@ -75,12 +89,13 @@ export function useCustomValidation(
|
|
|
75
89
|
errors.value = []
|
|
76
90
|
warnings.value = []
|
|
77
91
|
successes.value = []
|
|
92
|
+
hasSuccess.value = false
|
|
78
93
|
},
|
|
79
94
|
() => modelValue.value = undefined,
|
|
80
95
|
)
|
|
81
96
|
|
|
82
97
|
watch(focused, (newVal) => {
|
|
83
|
-
if (!newVal && !disableErrorHandling.value) {
|
|
98
|
+
if (isValidateOnBlur.value && !newVal && !disableErrorHandling.value) {
|
|
84
99
|
validate()
|
|
85
100
|
}
|
|
86
101
|
})
|
|
@@ -91,5 +106,12 @@ export function useCustomValidation(
|
|
|
91
106
|
}
|
|
92
107
|
})
|
|
93
108
|
|
|
94
|
-
|
|
109
|
+
function clearValidation() {
|
|
110
|
+
errors.value = []
|
|
111
|
+
warnings.value = []
|
|
112
|
+
successes.value = []
|
|
113
|
+
hasSuccess.value = false
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return { validate, hasSuccess, clearValidation }
|
|
95
117
|
}
|
|
@@ -4,34 +4,41 @@ import type { ValidationRule as VuetifyValidationRule } from 'vuetify'
|
|
|
4
4
|
import { useCustomValidation } from './useCustomValidation'
|
|
5
5
|
import { useVuetifyValidation as useVuetifyValidationComposable } from './useVuetifyValidation'
|
|
6
6
|
|
|
7
|
+
export type { VuetifyValidationRule }
|
|
8
|
+
export type { SyValidationRule as ValidationRule }
|
|
9
|
+
|
|
7
10
|
export interface FieldValidationProps {
|
|
11
|
+
customRules?: SyValidationRule[]
|
|
12
|
+
customSuccessRules?: SyValidationRule[]
|
|
13
|
+
customWarningRules?: SyValidationRule[]
|
|
14
|
+
disableErrorHandling?: boolean
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
errorMessages?: string[] | null
|
|
17
|
+
hasError?: boolean
|
|
18
|
+
hasSuccess?: boolean
|
|
19
|
+
hasWarning?: boolean
|
|
20
|
+
isValidateOnBlur?: boolean
|
|
21
|
+
label?: string
|
|
22
|
+
maxErrors?: number
|
|
8
23
|
modelValue?: unknown
|
|
9
24
|
readonly?: boolean
|
|
10
|
-
disabled?: boolean
|
|
11
25
|
required?: boolean
|
|
12
|
-
|
|
26
|
+
rules?: VuetifyValidationRule[]
|
|
13
27
|
showSuccessMessages?: boolean
|
|
14
|
-
|
|
28
|
+
successMessages?: string[] | null
|
|
15
29
|
// When true (Vuetify native mode), the controller should not handle errors/successes
|
|
16
30
|
useVuetifyValidation?: boolean
|
|
17
|
-
label: string
|
|
18
|
-
rules?: VuetifyValidationRule[]
|
|
19
|
-
customRules?: SyValidationRule[]
|
|
20
|
-
customWarningRules?: SyValidationRule[]
|
|
21
|
-
customSuccessRules?: SyValidationRule[]
|
|
22
|
-
errorMessages?: string[] | null
|
|
23
31
|
warningMessages?: string[] | null
|
|
24
|
-
successMessages?: string[] | null
|
|
25
|
-
hasError?: boolean
|
|
26
|
-
hasWarning?: boolean
|
|
27
|
-
hasSuccess?: boolean
|
|
28
|
-
maxErrors?: number
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
+
* Point d'entrée de la validation pour les composants de champ.
|
|
36
|
+
* Gère à la fois la validation native Vuetify (si useVuetifyValidation vaut true)
|
|
37
|
+
* et la validation custom Synapse (si customRules/customWarningRules/customSuccessRules sont fournis).
|
|
38
|
+
* customRules correspond aux règles d'erreur bloquantes.
|
|
39
|
+
* errorMessages/warningMessages/successMessages sont des messages externes injectés par le parent
|
|
40
|
+
* et ne déclenchent aucun calcul de validation.
|
|
41
|
+
* Expose aussi une interface unifiée pour les erreurs, avertissements, succès et la validation à la demande.
|
|
35
42
|
*/
|
|
36
43
|
export const validationPropsDefaults = {
|
|
37
44
|
readonly: false,
|
|
@@ -61,7 +68,7 @@ export function useValidation(params: {
|
|
|
61
68
|
isValidateOnBlur: Ref<boolean>
|
|
62
69
|
showSuccessMessages: Ref<boolean>
|
|
63
70
|
disableErrorHandling: Ref<boolean>
|
|
64
|
-
label: Ref<string>
|
|
71
|
+
label: Ref<string | undefined>
|
|
65
72
|
focused: Ref<boolean>
|
|
66
73
|
errorMessages?: Ref<string[] | null | undefined>
|
|
67
74
|
warningMessages?: Ref<string[] | null | undefined>
|
|
@@ -95,13 +102,15 @@ export function useValidation(params: {
|
|
|
95
102
|
errors: ref<string[]>([]),
|
|
96
103
|
warnings: ref<string[]>([]),
|
|
97
104
|
successes: ref<string[]>([]),
|
|
98
|
-
hasError: computed(() => false),
|
|
99
|
-
hasWarning: computed(() => false),
|
|
100
|
-
hasSuccess: computed(() => false),
|
|
105
|
+
hasError: computed(() => params.hasErrorProp?.value ?? false),
|
|
106
|
+
hasWarning: computed(() => params.hasWarningProp?.value ?? false),
|
|
107
|
+
hasSuccess: computed(() => params.hasSuccessProp?.value ?? false),
|
|
101
108
|
validate: async () => true,
|
|
109
|
+
clearValidation: () => {},
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
|
-
const
|
|
112
|
+
const vuetifyErrors = ref<string[]>([])
|
|
113
|
+
const customErrors = ref<string[]>([])
|
|
105
114
|
const innerWarnings = ref<string[]>([])
|
|
106
115
|
const innerSuccesses = ref<string[]>([])
|
|
107
116
|
|
|
@@ -112,7 +121,7 @@ export function useValidation(params: {
|
|
|
112
121
|
params.modelValue,
|
|
113
122
|
params.rules,
|
|
114
123
|
params.disabled,
|
|
115
|
-
|
|
124
|
+
vuetifyErrors,
|
|
116
125
|
params.hasErrorProp || ref(false),
|
|
117
126
|
computed(() => params.errorMessages?.value || []),
|
|
118
127
|
params.focused,
|
|
@@ -129,7 +138,7 @@ export function useValidation(params: {
|
|
|
129
138
|
params.customRules,
|
|
130
139
|
params.customWarningRules,
|
|
131
140
|
params.customSuccessRules,
|
|
132
|
-
|
|
141
|
+
customErrors,
|
|
133
142
|
innerWarnings,
|
|
134
143
|
innerSuccesses,
|
|
135
144
|
params.showSuccessMessages,
|
|
@@ -143,7 +152,8 @@ export function useValidation(params: {
|
|
|
143
152
|
|
|
144
153
|
async function validate(): Promise<boolean> {
|
|
145
154
|
if (params.readonly.value || params.disabled.value || params.disableErrorHandling.value) {
|
|
146
|
-
|
|
155
|
+
vuetifyErrors.value = []
|
|
156
|
+
customErrors.value = []
|
|
147
157
|
innerWarnings.value = []
|
|
148
158
|
innerSuccesses.value = []
|
|
149
159
|
|
|
@@ -162,7 +172,8 @@ export function useValidation(params: {
|
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
const errors = computed(() => [...new Set([
|
|
165
|
-
...
|
|
175
|
+
...vuetifyErrors.value,
|
|
176
|
+
...customErrors.value,
|
|
166
177
|
...(params.errorMessages?.value || []),
|
|
167
178
|
])])
|
|
168
179
|
const warnings = computed(() => [...new Set([
|
|
@@ -173,10 +184,26 @@ export function useValidation(params: {
|
|
|
173
184
|
...(params.showSuccessMessages.value ? innerSuccesses.value : []),
|
|
174
185
|
...(params.successMessages?.value || []),
|
|
175
186
|
])])
|
|
187
|
+
const internalHasSuccess = computed(() => customValidator.hasSuccess.value)
|
|
176
188
|
|
|
177
189
|
const hasError = computed(() => errors.value.length > 0 || params.hasErrorProp?.value)
|
|
178
190
|
const hasWarning = computed(() => warnings.value.length > 0 || params.hasWarningProp?.value)
|
|
179
|
-
|
|
191
|
+
// TODO: vérifier si c'est la meilleure approche pour supprimer le succès en mode Vuetify
|
|
192
|
+
const hasSuccess = computed(() => {
|
|
193
|
+
if (toValue(params.useVuetifyValidation)) {
|
|
194
|
+
return params.hasSuccessProp?.value ?? false
|
|
195
|
+
}
|
|
196
|
+
return (
|
|
197
|
+
(internalHasSuccess.value || (params.successMessages?.value?.length ?? 0) > 0)
|
|
198
|
+
&& !hasError.value
|
|
199
|
+
&& !hasWarning.value
|
|
200
|
+
) || (params.hasSuccessProp?.value ?? false)
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
function clearValidation() {
|
|
204
|
+
vuetifyErrors.value = []
|
|
205
|
+
customValidator.clearValidation()
|
|
206
|
+
}
|
|
180
207
|
|
|
181
208
|
return {
|
|
182
209
|
errors,
|
|
@@ -186,5 +213,6 @@ export function useValidation(params: {
|
|
|
186
213
|
hasWarning,
|
|
187
214
|
hasSuccess,
|
|
188
215
|
validate,
|
|
216
|
+
clearValidation,
|
|
189
217
|
}
|
|
190
218
|
}
|
|
@@ -12,8 +12,8 @@ export function useVuetifyValidation(
|
|
|
12
12
|
errorMessages: Ref<string[]>,
|
|
13
13
|
focused: Ref<boolean>,
|
|
14
14
|
maxErrors: Ref<number> | undefined,
|
|
15
|
-
name: Ref<string>,
|
|
16
|
-
label: Ref<string>,
|
|
15
|
+
name: Ref<string | undefined>,
|
|
16
|
+
label: Ref<string | undefined>,
|
|
17
17
|
readonly: Ref<boolean>,
|
|
18
18
|
validateOn: Ref<'input' | 'blur' | 'submit'>,
|
|
19
19
|
) {
|
|
@@ -213,6 +213,48 @@ describe('Filterable', () => {
|
|
|
213
213
|
expect(filterCount).toBe(0)
|
|
214
214
|
})
|
|
215
215
|
|
|
216
|
+
it('returns a chip when only from is set', () => {
|
|
217
|
+
const { getChips, getFilterCount } = useFilterable(
|
|
218
|
+
ref([]),
|
|
219
|
+
() => {},
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
const filter = {
|
|
223
|
+
name: 'Test',
|
|
224
|
+
value: {
|
|
225
|
+
from: '2024-01-01',
|
|
226
|
+
to: null,
|
|
227
|
+
},
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const chips = getChips(filter)
|
|
231
|
+
const filterCount = getFilterCount(filter)
|
|
232
|
+
|
|
233
|
+
expect(chips).toEqual([{ text: '2024-01-01 –', value: { from: '2024-01-01', to: null } }])
|
|
234
|
+
expect(filterCount).toBe(1)
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
it('returns a chip when only to is set', () => {
|
|
238
|
+
const { getChips, getFilterCount } = useFilterable(
|
|
239
|
+
ref([]),
|
|
240
|
+
() => {},
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
const filter = {
|
|
244
|
+
name: 'Test',
|
|
245
|
+
value: {
|
|
246
|
+
from: null,
|
|
247
|
+
to: '2024-12-31',
|
|
248
|
+
},
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const chips = getChips(filter)
|
|
252
|
+
const filterCount = getFilterCount(filter)
|
|
253
|
+
|
|
254
|
+
expect(chips).toEqual([{ text: '– 2024-12-31', value: { from: null, to: '2024-12-31' } }])
|
|
255
|
+
expect(filterCount).toBe(1)
|
|
256
|
+
})
|
|
257
|
+
|
|
216
258
|
it('returns the correct text when the value is an object', () => {
|
|
217
259
|
const { getChips, getFilterCount } = useFilterable(
|
|
218
260
|
ref([]),
|
|
@@ -98,16 +98,20 @@ export default function useFilterable(model: Ref<FilterProp>, emits) {
|
|
|
98
98
|
= typedValue.from !== undefined && typedValue.to !== undefined
|
|
99
99
|
|
|
100
100
|
if (isPeriodField) {
|
|
101
|
-
|
|
101
|
+
const hasFrom = typedValue.from !== null
|
|
102
|
+
const hasTo = typedValue.to !== null
|
|
103
|
+
|
|
104
|
+
if (!hasFrom && !hasTo) {
|
|
102
105
|
return []
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const text = hasFrom && hasTo
|
|
109
|
+
? `${typedValue.from} – ${typedValue.to}`
|
|
110
|
+
: hasFrom
|
|
111
|
+
? `${typedValue.from} –`
|
|
112
|
+
: `– ${typedValue.to}`
|
|
113
|
+
|
|
114
|
+
return [{ text, value: typedValue }]
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
// Handle single select objects (VSelect with return-object but without multiple)
|
|
@@ -84,8 +84,8 @@ export const useFormFieldErrorHandling = (
|
|
|
84
84
|
|
|
85
85
|
const result = await validation.validateField(
|
|
86
86
|
value,
|
|
87
|
-
[...defaultRules.value, ...props.customRules
|
|
88
|
-
props.customWarningRules
|
|
87
|
+
[...defaultRules.value, ...(props.customRules ?? [])],
|
|
88
|
+
props.customWarningRules ?? [],
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
return !result.hasError
|
|
@@ -123,7 +123,10 @@ export const useFormFieldErrorHandling = (
|
|
|
123
123
|
|
|
124
124
|
const hasError = computed(() => validation.hasError.value || (props.hasError ?? false))
|
|
125
125
|
const hasWarning = computed(() => validation.hasWarning.value || (props.hasWarning ?? false))
|
|
126
|
-
const hasSuccess = computed(() =>
|
|
126
|
+
const hasSuccess = computed(() =>
|
|
127
|
+
(validation.hasSuccess.value && !hasError.value && !hasWarning.value)
|
|
128
|
+
|| (props.hasSuccess ?? false),
|
|
129
|
+
)
|
|
127
130
|
|
|
128
131
|
const errors = computed(() => [...validation.errors.value, ...(props.errorMessages || [])])
|
|
129
132
|
const warnings = computed(() => validation.warnings.value)
|
|
@@ -90,7 +90,7 @@ describe('useValidation', () => {
|
|
|
90
90
|
expect(validResult.hasSuccess).toBe(true)
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
it('
|
|
93
|
+
it('keeps the success state when showSuccessMessages is false while hiding messages', async () => {
|
|
94
94
|
const validation = useValidation({ showSuccessMessages: false })
|
|
95
95
|
const rules = [{
|
|
96
96
|
type: 'required',
|
|
@@ -101,7 +101,7 @@ describe('useValidation', () => {
|
|
|
101
101
|
}]
|
|
102
102
|
|
|
103
103
|
const result = await validation.validateField('test', rules)
|
|
104
|
-
expect(result.hasSuccess).toBe(
|
|
104
|
+
expect(result.hasSuccess).toBe(true)
|
|
105
105
|
expect(result.state.successes).toEqual([])
|
|
106
106
|
})
|
|
107
107
|
|
|
@@ -59,6 +59,7 @@ export function useValidation(options: ValidationOptions = { showSuccessMessages
|
|
|
59
59
|
const errors = ref<string[]>([])
|
|
60
60
|
const warnings = ref<string[]>([])
|
|
61
61
|
const successes = ref<string[]>([])
|
|
62
|
+
const successState = ref(false)
|
|
62
63
|
|
|
63
64
|
let currentValidationToken = 0
|
|
64
65
|
|
|
@@ -67,13 +68,17 @@ export function useValidation(options: ValidationOptions = { showSuccessMessages
|
|
|
67
68
|
const hasError = computed(() => errors.value.length > 0)
|
|
68
69
|
const hasWarning = computed(() => warnings.value.length > 0)
|
|
69
70
|
const hasSuccess = computed(() =>
|
|
70
|
-
|
|
71
|
+
successState.value && !hasError.value && !hasWarning.value,
|
|
72
|
+
)
|
|
73
|
+
const displaySuccesses = computed(() =>
|
|
74
|
+
options.showSuccessMessages !== false ? successes.value : [],
|
|
71
75
|
)
|
|
72
76
|
|
|
73
77
|
const clearValidation = () => {
|
|
74
78
|
errors.value = []
|
|
75
79
|
warnings.value = []
|
|
76
80
|
successes.value = []
|
|
81
|
+
successState.value = false
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
/**
|
|
@@ -176,8 +181,12 @@ export function useValidation(options: ValidationOptions = { showSuccessMessages
|
|
|
176
181
|
}
|
|
177
182
|
}
|
|
178
183
|
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
const isValueFilled = Array.isArray(value) ? value.length > 0 : !!value
|
|
185
|
+
if (!hasValidationError && isValueFilled && successRules.length === 0) {
|
|
186
|
+
successState.value = true
|
|
187
|
+
if (options.showSuccessMessages !== false) {
|
|
188
|
+
addDefaultSuccessMessage(rules)
|
|
189
|
+
}
|
|
181
190
|
}
|
|
182
191
|
|
|
183
192
|
if (!hasValidationError && warningRules.length > 0) {
|
|
@@ -206,6 +215,8 @@ export function useValidation(options: ValidationOptions = { showSuccessMessages
|
|
|
206
215
|
const successResolved = executeRules(successRules, value, { isSuccess: true })
|
|
207
216
|
|
|
208
217
|
return thenOrSync(successResolved, token, (successResults) => {
|
|
218
|
+
successState.value = successResults.some(result => Boolean(result.success))
|
|
219
|
+
|
|
209
220
|
for (const r of successResults) {
|
|
210
221
|
if (r.success && options.showSuccessMessages !== false) {
|
|
211
222
|
successes.value.push(r.success)
|
|
@@ -223,6 +234,7 @@ export function useValidation(options: ValidationOptions = { showSuccessMessages
|
|
|
223
234
|
errors,
|
|
224
235
|
warnings,
|
|
225
236
|
successes,
|
|
237
|
+
displaySuccesses,
|
|
226
238
|
hasError,
|
|
227
239
|
hasWarning,
|
|
228
240
|
hasSuccess,
|
|
@@ -12,55 +12,25 @@ Pour l'API complète du composant, consulter la [documentation Vuetify](https://
|
|
|
12
12
|
## Primary
|
|
13
13
|
|
|
14
14
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', padding: '24px' }}>
|
|
15
|
-
<Canvas of={VBtnStories.
|
|
16
|
-
<Canvas of={VBtnStories.
|
|
17
|
-
<Canvas of={VBtnStories.
|
|
18
|
-
<Canvas of={VBtnStories.PrimaryText} />
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
## Primary – Désactivé
|
|
22
|
-
|
|
23
|
-
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', padding: '24px' }}>
|
|
24
|
-
<Canvas of={VBtnStories.PrimaryElevatedDisabled} />
|
|
25
|
-
<Canvas of={VBtnStories.PrimaryOutlinedDisabled} />
|
|
26
|
-
<Canvas of={VBtnStories.PrimaryTonalDisabled} />
|
|
27
|
-
<Canvas of={VBtnStories.PrimaryTextDisabled} />
|
|
15
|
+
<Canvas of={VBtnStories.Primary} />
|
|
16
|
+
<Canvas of={VBtnStories.PrimaryLoading} />
|
|
17
|
+
<Canvas of={VBtnStories.PrimaryDisabled} />
|
|
28
18
|
</div>
|
|
29
19
|
|
|
30
20
|
## Secondary
|
|
31
21
|
|
|
32
22
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', padding: '24px' }}>
|
|
33
|
-
<Canvas of={VBtnStories.
|
|
34
|
-
<Canvas of={VBtnStories.
|
|
35
|
-
<Canvas of={VBtnStories.
|
|
36
|
-
<Canvas of={VBtnStories.SecondaryText} />
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
## Secondary – Désactivé
|
|
40
|
-
|
|
41
|
-
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', padding: '24px' }}>
|
|
42
|
-
<Canvas of={VBtnStories.SecondaryElevatedDisabled} />
|
|
43
|
-
<Canvas of={VBtnStories.SecondaryOutlinedDisabled} />
|
|
44
|
-
<Canvas of={VBtnStories.SecondaryTonalDisabled} />
|
|
45
|
-
<Canvas of={VBtnStories.SecondaryTextDisabled} />
|
|
23
|
+
<Canvas of={VBtnStories.Secondary} />
|
|
24
|
+
<Canvas of={VBtnStories.SecondaryLoading} />
|
|
25
|
+
<Canvas of={VBtnStories.SecondaryDisabled} />
|
|
46
26
|
</div>
|
|
47
27
|
|
|
48
28
|
## Tertiary
|
|
49
29
|
|
|
50
30
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', padding: '24px' }}>
|
|
51
|
-
<Canvas of={VBtnStories.
|
|
52
|
-
<Canvas of={VBtnStories.
|
|
53
|
-
<Canvas of={VBtnStories.
|
|
54
|
-
<Canvas of={VBtnStories.TertiaryText} />
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
## Tertiary – Désactivé
|
|
58
|
-
|
|
59
|
-
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '12px', alignItems: 'center', padding: '24px' }}>
|
|
60
|
-
<Canvas of={VBtnStories.TertiaryElevatedDisabled} />
|
|
61
|
-
<Canvas of={VBtnStories.TertiaryOutlinedDisabled} />
|
|
62
|
-
<Canvas of={VBtnStories.TertiaryTonalDisabled} />
|
|
63
|
-
<Canvas of={VBtnStories.TertiaryTextDisabled} />
|
|
31
|
+
<Canvas of={VBtnStories.Tertiary} />
|
|
32
|
+
<Canvas of={VBtnStories.TertiaryLoading} />
|
|
33
|
+
<Canvas of={VBtnStories.TertiaryDisabled} />
|
|
64
34
|
</div>
|
|
65
35
|
|
|
66
36
|
## Variants disponibles
|
|
@@ -8,7 +8,7 @@ const meta: Meta = {
|
|
|
8
8
|
return { args }
|
|
9
9
|
},
|
|
10
10
|
template: `
|
|
11
|
-
<v-btn :color="args.color" :variant="args.variant" :disabled="args.disabled">
|
|
11
|
+
<v-btn :color="args.color" :variant="args.variant" :disabled="args.disabled" :loading="args.loading">
|
|
12
12
|
{{ args.label }}
|
|
13
13
|
</v-btn>
|
|
14
14
|
`,
|
|
@@ -19,103 +19,43 @@ export default meta
|
|
|
19
19
|
type Story = StoryObj<typeof meta>
|
|
20
20
|
|
|
21
21
|
// --- Primary ---
|
|
22
|
-
export const
|
|
23
|
-
args: { label: 'Button primary
|
|
22
|
+
export const Primary: Story = {
|
|
23
|
+
args: { label: 'Button primary', color: 'primary', variant: 'elevated', disabled: false },
|
|
24
24
|
parameters: { docs: { source: { code: `<v-btn color="primary" variant="elevated">Button</v-btn>` } } },
|
|
25
25
|
}
|
|
26
|
-
export const
|
|
27
|
-
args: { label: 'Button primary
|
|
28
|
-
parameters: { docs: { source: { code: `<v-btn color="primary" variant="
|
|
29
|
-
}
|
|
30
|
-
export const PrimaryTonal: Story = {
|
|
31
|
-
args: { label: 'Button primary tonal', color: 'primary', variant: 'tonal', disabled: false },
|
|
32
|
-
parameters: { docs: { source: { code: `<v-btn color="primary" variant="tonal">Button</v-btn>` } } },
|
|
33
|
-
}
|
|
34
|
-
export const PrimaryText: Story = {
|
|
35
|
-
args: { label: 'Button primary text', color: 'primary', variant: 'text', disabled: false },
|
|
36
|
-
parameters: { docs: { source: { code: `<v-btn color="primary" variant="text">Button</v-btn>` } } },
|
|
26
|
+
export const PrimaryLoading: Story = {
|
|
27
|
+
args: { label: 'Button primary loading', color: 'primary', variant: 'elevated', disabled: false, loading: true },
|
|
28
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="elevated" loading>Button</v-btn>` } } },
|
|
37
29
|
}
|
|
38
|
-
export const
|
|
39
|
-
args: { label: 'Button primary
|
|
30
|
+
export const PrimaryDisabled: Story = {
|
|
31
|
+
args: { label: 'Button primary disabled', color: 'primary', variant: 'elevated', disabled: true },
|
|
40
32
|
parameters: { docs: { source: { code: `<v-btn color="primary" variant="elevated" disabled>Button</v-btn>` } } },
|
|
41
33
|
}
|
|
42
|
-
export const PrimaryOutlinedDisabled: Story = {
|
|
43
|
-
args: { label: 'Button primary outlined disabled', color: 'primary', variant: 'outlined', disabled: true },
|
|
44
|
-
parameters: { docs: { source: { code: `<v-btn color="primary" variant="outlined" disabled>Button</v-btn>` } } },
|
|
45
|
-
}
|
|
46
|
-
export const PrimaryTonalDisabled: Story = {
|
|
47
|
-
args: { label: 'Button primary tonal disabled', color: 'primary', variant: 'tonal', disabled: true },
|
|
48
|
-
parameters: { docs: { source: { code: `<v-btn color="primary" variant="tonal" disabled>Button</v-btn>` } } },
|
|
49
|
-
}
|
|
50
|
-
export const PrimaryTextDisabled: Story = {
|
|
51
|
-
args: { label: 'Button primary text disabled', color: 'primary', variant: 'text', disabled: true },
|
|
52
|
-
parameters: { docs: { source: { code: `<v-btn color="primary" variant="text" disabled>Button</v-btn>` } } },
|
|
53
|
-
}
|
|
54
34
|
|
|
55
35
|
// --- Secondary ---
|
|
56
|
-
export const
|
|
57
|
-
args: { label: 'Button secondary
|
|
58
|
-
parameters: { docs: { source: { code: `<v-btn color="
|
|
59
|
-
}
|
|
60
|
-
export const SecondaryOutlined: Story = {
|
|
61
|
-
args: { label: 'Button secondary outlined', color: 'secondary', variant: 'outlined', disabled: false },
|
|
62
|
-
parameters: { docs: { source: { code: `<v-btn color="secondary" variant="outlined">Button</v-btn>` } } },
|
|
63
|
-
}
|
|
64
|
-
export const SecondaryTonal: Story = {
|
|
65
|
-
args: { label: 'Button secondary tonal', color: 'secondary', variant: 'tonal', disabled: false },
|
|
66
|
-
parameters: { docs: { source: { code: `<v-btn color="secondary" variant="tonal">Button</v-btn>` } } },
|
|
67
|
-
}
|
|
68
|
-
export const SecondaryText: Story = {
|
|
69
|
-
args: { label: 'Button secondary text', color: 'secondary', variant: 'text', disabled: false },
|
|
70
|
-
parameters: { docs: { source: { code: `<v-btn color="secondary" variant="text">Button</v-btn>` } } },
|
|
71
|
-
}
|
|
72
|
-
export const SecondaryElevatedDisabled: Story = {
|
|
73
|
-
args: { label: 'Button secondary elevated disabled', color: 'secondary', variant: 'elevated', disabled: true },
|
|
74
|
-
parameters: { docs: { source: { code: `<v-btn color="secondary" variant="elevated" disabled>Button</v-btn>` } } },
|
|
75
|
-
}
|
|
76
|
-
export const SecondaryOutlinedDisabled: Story = {
|
|
77
|
-
args: { label: 'Button secondary outlined disabled', color: 'secondary', variant: 'outlined', disabled: true },
|
|
78
|
-
parameters: { docs: { source: { code: `<v-btn color="secondary" variant="outlined" disabled>Button</v-btn>` } } },
|
|
36
|
+
export const Secondary: Story = {
|
|
37
|
+
args: { label: 'Button secondary ', color: 'primary', variant: 'outlined', disabled: false },
|
|
38
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="outlined">Button</v-btn>` } } },
|
|
79
39
|
}
|
|
80
|
-
export const
|
|
81
|
-
args: { label: 'Button secondary
|
|
82
|
-
parameters: { docs: { source: { code: `<v-btn color="
|
|
40
|
+
export const SecondaryLoading: Story = {
|
|
41
|
+
args: { label: 'Button secondary loading', color: 'primary', variant: 'outlined', disabled: false, loading: true },
|
|
42
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="outlined" loading>Button</v-btn>` } } },
|
|
83
43
|
}
|
|
84
|
-
export const
|
|
85
|
-
args: { label: 'Button secondary
|
|
86
|
-
parameters: { docs: { source: { code: `<v-btn color="
|
|
44
|
+
export const SecondaryDisabled: Story = {
|
|
45
|
+
args: { label: 'Button secondary disabled', color: 'primary', variant: 'outlined', disabled: true },
|
|
46
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="outlined" disabled>Button</v-btn>` } } },
|
|
87
47
|
}
|
|
88
48
|
|
|
89
49
|
// --- Tertiary ---
|
|
90
|
-
export const
|
|
91
|
-
args: { label: 'Button tertiary
|
|
92
|
-
parameters: { docs: { source: { code: `<v-btn color="
|
|
93
|
-
}
|
|
94
|
-
export const TertiaryOutlined: Story = {
|
|
95
|
-
args: { label: 'Button tertiary outlined', color: 'tertiary', variant: 'outlined', disabled: false },
|
|
96
|
-
parameters: { docs: { source: { code: `<v-btn color="tertiary" variant="outlined">Button</v-btn>` } } },
|
|
97
|
-
}
|
|
98
|
-
export const TertiaryTonal: Story = {
|
|
99
|
-
args: { label: 'Button tertiary tonal', color: 'tertiary', variant: 'tonal', disabled: false },
|
|
100
|
-
parameters: { docs: { source: { code: `<v-btn color="tertiary" variant="tonal">Button</v-btn>` } } },
|
|
101
|
-
}
|
|
102
|
-
export const TertiaryText: Story = {
|
|
103
|
-
args: { label: 'Button tertiary text', color: 'tertiary', variant: 'text', disabled: false },
|
|
104
|
-
parameters: { docs: { source: { code: `<v-btn color="tertiary" variant="text">Button</v-btn>` } } },
|
|
105
|
-
}
|
|
106
|
-
export const TertiaryElevatedDisabled: Story = {
|
|
107
|
-
args: { label: 'Button tertiary elevated disabled', color: 'tertiary', variant: 'elevated', disabled: true },
|
|
108
|
-
parameters: { docs: { source: { code: `<v-btn color="tertiary" variant="elevated" disabled>Button</v-btn>` } } },
|
|
109
|
-
}
|
|
110
|
-
export const TertiaryOutlinedDisabled: Story = {
|
|
111
|
-
args: { label: 'Button tertiary outlined disabled', color: 'tertiary', variant: 'outlined', disabled: true },
|
|
112
|
-
parameters: { docs: { source: { code: `<v-btn color="tertiary" variant="outlined" disabled>Button</v-btn>` } } },
|
|
50
|
+
export const Tertiary: Story = {
|
|
51
|
+
args: { label: 'Button tertiary', color: 'primary', variant: 'text', disabled: false },
|
|
52
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="text">Button</v-btn>` } } },
|
|
113
53
|
}
|
|
114
|
-
export const
|
|
115
|
-
args: { label: 'Button tertiary
|
|
116
|
-
parameters: { docs: { source: { code: `<v-btn color="
|
|
54
|
+
export const TertiaryLoading: Story = {
|
|
55
|
+
args: { label: 'Button tertiary loading', color: 'primary', variant: 'text', disabled: false, loading: true },
|
|
56
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="text" loading>Button</v-btn>` } } },
|
|
117
57
|
}
|
|
118
|
-
export const
|
|
119
|
-
args: { label: 'Button tertiary
|
|
120
|
-
parameters: { docs: { source: { code: `<v-btn color="
|
|
58
|
+
export const TertiaryDisabled: Story = {
|
|
59
|
+
args: { label: 'Button tertiary disabled', color: 'primary', variant: 'text', disabled: true },
|
|
60
|
+
parameters: { docs: { source: { code: `<v-btn color="primary" variant="text" disabled>Button</v-btn>` } } },
|
|
121
61
|
}
|