@cnamts/synapse 1.0.27 → 1.1.0
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 +1 -1
- package/dist/{AutocompleteFilter-C9eLKyW8.js → AutocompleteFilter-DXd4szWO.js} +3 -3
- package/dist/{DateFilter-y-GLkAkn.js → DateFilter-BD59Kgwf.js} +8 -8
- package/dist/{NumberFilter-DN6hIBS7.js → NumberFilter-BSMZE7uw.js} +1 -1
- package/dist/{PeriodFilter-MoUUp9qS.js → PeriodFilter-keUdSSk0.js} +1 -1
- package/dist/{SelectFilter-bCbrdLmu.js → SelectFilter-Dhvvwazl.js} +1 -1
- package/dist/{TextFilter-CvjgEaoM.js → TextFilter-CU8FpXz0.js} +4 -4
- package/dist/{apLightTheme2026-ug4Y23ns.js → apLightTheme2026-DbS7BPUf.js} +12 -11
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +4 -4
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +4 -4
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +2 -2
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +85 -313
- package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +2 -2
- package/dist/components/Customs/Selects/SyInputSelect/SyInputSelect.d.ts +1 -1
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +9 -11
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +7 -7
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +3 -3
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +5 -5
- package/dist/components/Customs/SyIcon/SyIcon.d.ts +77 -1
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +10 -10
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +19 -79
- package/dist/components/Customs/SyTextField/locales.d.ts +7 -0
- package/dist/components/Customs/SyTextField/types.d.ts +67 -4
- package/dist/components/Customs/SyTextField/useNumberField.d.ts +23 -0
- package/dist/components/Customs/SyTextField/useSyTextFieldValidation.d.ts +38 -0
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +170 -622
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +85 -311
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +39 -152
- package/dist/components/FilterInline/FilterInline.d.ts +3 -3
- package/dist/components/FilterSideBar/FilterSideBar.d.ts +4 -4
- package/dist/components/MonthPicker/MonthPicker.d.ts +37 -150
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +37 -150
- package/dist/components/NirField/NirField.d.ts +90 -321
- package/dist/components/NirField/useNirValidation.d.ts +10 -20
- package/dist/components/PasswordField/PasswordField.d.ts +20 -39
- package/dist/components/PasswordField/locales.d.ts +2 -0
- package/dist/components/PasswordField/types.d.ts +16 -0
- package/dist/components/PasswordField/usePasswordFieldValidation.d.ts +38 -0
- package/dist/components/PeriodField/PeriodField.d.ts +349 -1253
- package/dist/components/PhoneField/PhoneField.d.ts +37 -150
- package/dist/components/SearchListField/SearchListField.d.ts +3 -3
- package/dist/components/SyTextArea/SyTextArea.d.ts +14 -11
- package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +7 -7
- package/dist/components/Tables/common/SyTablePagination.d.ts +19 -20
- package/dist/composables/unifyValidation/documentationValidationProps.d.ts +1 -1
- package/dist/composables/unifyValidation/useValidation.d.ts +1 -9
- package/dist/composables/useFilterable/useFilterable.d.ts +1 -2
- package/dist/design-system-v3.js +19 -19
- package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +1 -0
- package/dist/designTokens/tokens/pa/paLightTheme.d.ts +1 -0
- package/dist/{main-CI6Q9nmO.js → main-D8ryUoS5.js} +13605 -13358
- package/dist/synapse.css +1 -1
- package/dist/vuetifyConfig.js +27 -25
- package/package.json +6 -5
- package/src/components/Accordion/tests/Accordion.visual.cy.ts +44 -0
- package/src/components/Accordion/tests/__snapshots__/accordion-default.snap.png +0 -0
- package/src/components/Accordion/tests/__snapshots__/accordion-disabled-item.snap.png +0 -0
- package/src/components/Accordion/tests/__snapshots__/accordion-open-first.snap.png +0 -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/BackToTopBtn/tests/BackToTopBtn.visual.cy.ts +34 -0
- package/src/components/BackToTopBtn/tests/__snapshots__/back-to-top-btn-custom-nudge.snap.png +0 -0
- package/src/components/BackToTopBtn/tests/__snapshots__/back-to-top-btn-default.snap.png +0 -0
- package/src/components/Captcha/tests/Captcha.visual.cy.ts +45 -0
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +4 -0
- package/src/components/Captcha/tests/__snapshots__/captcha-audio-type.snap.png +0 -0
- package/src/components/Captcha/tests/__snapshots__/captcha-image-type.snap.png +0 -0
- package/src/components/Captcha/tests/__snapshots__/captcha-no-helpdesk.snap.png +0 -0
- package/src/components/ChipList/tests/ChipList.visual.cy.ts +46 -0
- package/src/components/ChipList/tests/__snapshots__/chip-list-default.snap.png +0 -0
- package/src/components/ChipList/tests/__snapshots__/chip-list-readonly.snap.png +0 -0
- package/src/components/ChipList/tests/__snapshots__/chip-list-state-icons.snap.png +0 -0
- package/src/components/CollapsibleList/tests/CollapsibleList.visual.cy.ts +33 -0
- package/src/components/CollapsibleList/tests/__snapshots__/collapsible-list-default.snap.png +0 -0
- package/src/components/CollapsibleList/tests/__snapshots__/collapsible-list-no-title.snap.png +0 -0
- package/src/components/ContextualMenu/tests/ContextualMenu.visual.cy.ts +35 -0
- package/src/components/ContextualMenu/tests/__snapshots__/contextual-menu-default.snap.png +0 -0
- package/src/components/ContextualMenu/tests/__snapshots__/contextual-menu-selected.snap.png +0 -0
- package/src/components/CookieBanner/tests/CookieBanner.visual.cy.ts +29 -0
- package/src/components/CookieBanner/tests/__snapshots__/cookie-banner-default.snap.png +0 -0
- package/src/components/CookieBanner/tests/__snapshots__/cookie-banner-with-items.snap.png +0 -0
- package/src/components/CookiesSelection/tests/CookiesSelection.visual.cy.ts +21 -0
- package/src/components/CookiesSelection/tests/__snapshots__/cookies-selection-default.snap.png +0 -0
- package/src/components/CopyBtn/tests/CopyBtn.visual.cy.ts +24 -0
- package/src/components/CopyBtn/tests/__snapshots__/copy-btn-default.snap.png +0 -0
- package/src/components/CopyBtn/tests/__snapshots__/copy-btn-no-tooltip.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.visual.cy.ts +60 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-default.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-inline.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-readonly.snap.png +0 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/select-btn-field-selected.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +1 -1
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +2 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.visual.cy.ts +63 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-default.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-loading.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-multiple.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/tests/__snapshots__/sy-autocomplete-with-value.snap.png +0 -0
- package/src/components/Customs/Selects/SyAutocomplete/validation/Validation.stories.ts +0 -93
- package/src/components/Customs/Selects/SyInputSelect/tests/SyInputSelect.visual.cy.ts +48 -0
- package/src/components/Customs/Selects/SyInputSelect/tests/__snapshots__/sy-input-select-default.snap.png +0 -0
- package/src/components/Customs/Selects/SyInputSelect/tests/__snapshots__/sy-input-select-required.snap.png +0 -0
- package/src/components/Customs/Selects/SyInputSelect/tests/__snapshots__/sy-input-select-with-value.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/SySelect.vue +22 -47
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +3 -3
- package/src/components/Customs/Selects/SySelect/tests/SySelect.visual.cy.ts +77 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-clearable.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-default.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-multiple-chips.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-required.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/tests/__snapshots__/sy-select-with-value.snap.png +0 -0
- package/src/components/Customs/Selects/SySelect/validation/Validation.stories.ts +1 -92
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +1 -1
- package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.visual.cy.ts +55 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-default.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-disabled.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-selected.snap.png +0 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/__snapshots__/sy-checkbox-group-with-label.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +1 -9
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.visual.cy.ts +61 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-checked.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-disabled.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-indeterminate.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-required.snap.png +0 -0
- package/src/components/Customs/SyCheckbox/tests/__snapshots__/sy-checkbox-unchecked.snap.png +0 -0
- package/src/components/Customs/SyIcon/SyIcon.vue +19 -1
- package/src/components/Customs/SyIcon/tests/SyIcon.visual.cy.ts +83 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-color-error.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-decorative.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-informative.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-role-button.snap.png +0 -0
- package/src/components/Customs/SyIcon/tests/__snapshots__/sy-icon-size-large.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/SyIconButton.visual.cy.ts +55 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-default.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-disabled.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-error.snap.png +0 -0
- package/src/components/Customs/SyIconButton/tests/__snapshots__/sy-icon-button-large.snap.png +0 -0
- package/src/components/Customs/SyPagination/tests/SyPagination.visual.cy.ts +40 -0
- package/src/components/Customs/SyPagination/tests/__snapshots__/sy-pagination-first-page.snap.png +0 -0
- package/src/components/Customs/SyPagination/tests/__snapshots__/sy-pagination-middle-page.snap.png +0 -0
- package/src/components/Customs/SyPagination/tests/__snapshots__/sy-pagination-with-label.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.stories.ts +0 -1
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +4 -3
- package/src/components/Customs/SyRadioGroup/composables/useSyRadioGroupValidation.ts +1 -1
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-asterisk.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-comfortable.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-compact.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-default.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-disabled.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-error.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-no-details.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-readonly.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-selected.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-success.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/tests/__snapshots__/sy-radio-group-warning.snap.png +0 -0
- package/src/components/Customs/SyRadioGroup/validation/Validation.stories.ts +63 -27
- package/src/components/Customs/SyTabs/tests/SyTabs.visual.cy.ts +30 -0
- package/src/components/Customs/SyTabs/tests/__snapshots__/sy-tabs-default.snap.png +0 -0
- package/src/components/Customs/SyTabs/tests/__snapshots__/sy-tabs-second-active.snap.png +0 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +160 -778
- package/src/components/Customs/SyTextField/SyTextField.vue +168 -153
- package/src/components/Customs/SyTextField/Validation/Validation.stories.ts +1164 -0
- package/src/components/Customs/SyTextField/locales.ts +12 -0
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +174 -8
- package/src/components/Customs/SyTextField/tests/SyTextField.visual.cy.ts +116 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-clearable.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-default.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-number-disabled.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-number-no-spinner.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-number.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-prepend-icon.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-readonly.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-required.snap.png +0 -0
- package/src/components/Customs/SyTextField/tests/__snapshots__/sy-text-field-with-value.snap.png +0 -0
- package/src/components/Customs/SyTextField/types.ts +70 -0
- package/src/components/Customs/SyTextField/useNumberField.ts +93 -0
- package/src/components/Customs/SyTextField/useSyTextFieldValidation.ts +104 -0
- package/src/components/DataList/tests/DataList.visual.cy.ts +85 -0
- package/src/components/DataList/tests/__snapshots__/data-list-default.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-loading.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-row.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-with-icons.snap.png +0 -0
- package/src/components/DataList/tests/__snapshots__/data-list-with-title.snap.png +0 -0
- package/src/components/DataListGroup/tests/DataListGroup.visual.cy.ts +51 -0
- package/src/components/DataListGroup/tests/__snapshots__/data-list-group-default.snap.png +0 -0
- package/src/components/DataListGroup/tests/__snapshots__/data-list-group-loading.snap.png +0 -0
- package/src/components/DataListItem/tests/DataListItem.visual.cy.ts +53 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-chip.snap.png +0 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-default.snap.png +0 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-placeholder.snap.png +0 -0
- package/src/components/DataListItem/tests/__snapshots__/data-list-item-row.snap.png +0 -0
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +1 -1
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +7 -7
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1 -1
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +7 -8
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +1 -1
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +2 -2
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +1 -1
- package/src/components/DatePicker/composables/tests/useTodayButton.spec.ts +10 -10
- package/src/components/DatePicker/composables/useCalendarKeyboardNavigation.ts +11 -2
- package/src/components/DeclarationAccessibilityPage/tests/DeclarationAccessibilityPage.visual.cy.ts +35 -0
- package/src/components/DeclarationAccessibilityPage/tests/__snapshots__/declaration-a11y-page-default.snap.png +0 -0
- package/src/components/DeclarationAccessibilityPage/tests/__snapshots__/declaration-a11y-page-full.snap.png +0 -0
- package/src/components/DiacriticPicker/tests/DiacriticPicker.visual.cy.ts +24 -0
- package/src/components/DiacriticPicker/tests/__snapshots__/diacritic-picker-custom-title.snap.png +0 -0
- package/src/components/DiacriticPicker/tests/__snapshots__/diacritic-picker-default.snap.png +0 -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/DownloadBtn/tests/DownloadBtn.spec.ts +2 -2
- package/src/components/DownloadBtn/tests/DownloadBtn.visual.cy.ts +38 -0
- package/src/components/DownloadBtn/tests/__snapshots__/download-btn-dark.snap.png +0 -0
- package/src/components/DownloadBtn/tests/__snapshots__/download-btn-idle.snap.png +0 -0
- package/src/components/ErrorPage/tests/ErrorPage.visual.cy.ts +32 -0
- package/src/components/ErrorPage/tests/__snapshots__/error-page-custom.snap.png +0 -0
- package/src/components/ErrorPage/tests/__snapshots__/error-page-default.snap.png +0 -0
- package/src/components/ErrorPage/tests/__snapshots__/error-page-no-btn.snap.png +0 -0
- package/src/components/ExternalLinks/tests/ExternalLinks.visual.cy.ts +30 -0
- package/src/components/ExternalLinks/tests/__snapshots__/external-links-default.snap.png +0 -0
- package/src/components/ExternalLinks/tests/__snapshots__/external-links-fixed.snap.png +0 -0
- package/src/components/FileList/tests/FileList.visual.cy.ts +31 -0
- package/src/components/FileList/tests/__snapshots__/file-list-default.snap.png +0 -0
- package/src/components/FileList/tests/__snapshots__/file-list-with-delete.snap.png +0 -0
- package/src/components/FilePreview/accessibilite/Accessibility.mdx +86 -8
- package/src/components/FileUpload/tests/FileUpload.visual.cy.ts +36 -0
- package/src/components/FileUpload/tests/__snapshots__/file-upload-default.snap.png +0 -0
- package/src/components/FileUpload/tests/__snapshots__/file-upload-disabled.snap.png +0 -0
- package/src/components/FileUpload/tests/__snapshots__/file-upload-multiple.snap.png +0 -0
- package/src/components/FilterInline/FilterInline.stories.ts +2 -0
- package/src/components/FilterInline/FilterInline.vue +10 -5
- package/src/components/FilterInline/tests/FilterInline.visual.cy.ts +25 -0
- package/src/components/FilterInline/tests/__snapshots__/filter-inline-default.snap.png +0 -0
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +4 -1
- package/src/components/FilterSideBar/FilterSideBar.vue +11 -6
- package/src/components/FilterSideBar/tests/FilterSideBar.visual.cy.ts +37 -0
- package/src/components/FilterSideBar/tests/__snapshots__/filter-sidebar-default.snap.png +0 -0
- package/src/components/FilterSideBar/tests/__snapshots__/filter-sidebar-modale.snap.png +0 -0
- package/src/components/FooterBar/tests/FooterBar.visual.cy.ts +37 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-default.snap.png +0 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-no-logo.snap.png +0 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-no-social.snap.png +0 -0
- package/src/components/FooterBar/tests/__snapshots__/footer-bar-version.snap.png +0 -0
- package/src/components/FranceConnectBtn/tests/FranceConnectBtn.visual.cy.ts +38 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/france-connect-btn-dark.snap.png +0 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/france-connect-btn-default.snap.png +0 -0
- package/src/components/FranceConnectBtn/tests/__snapshots__/france-connect-btn-plus.snap.png +0 -0
- package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +4 -4
- 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/HeaderLoading/tests/HeaderLoading.visual.cy.ts +34 -0
- package/src/components/HeaderLoading/tests/__snapshots__/header-loading-custom-size.snap.png +0 -0
- package/src/components/HeaderLoading/tests/__snapshots__/header-loading-default.snap.png +0 -0
- package/src/components/HeaderLoading/tests/__snapshots__/header-loading-standalone.snap.png +0 -0
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +4 -4
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.visual.cy.ts +34 -0
- package/src/components/HeaderNavigationBar/tests/__snapshots__/header-navigation-bar-default.snap.png +0 -0
- package/src/components/HeaderNavigationBar/tests/__snapshots__/header-navigation-bar-subtitle.snap.png +0 -0
- package/src/components/HeaderToolbar/tests/HeaderToolbar.visual.cy.ts +25 -0
- package/src/components/HeaderToolbar/tests/__snapshots__/header-toolbar-custom.snap.png +0 -0
- package/src/components/HeaderToolbar/tests/__snapshots__/header-toolbar-default.snap.png +0 -0
- package/src/components/LangBtn/tests/LangBtn.visual.cy.ts +33 -0
- package/src/components/LangBtn/tests/__snapshots__/lang-btn-default.snap.png +0 -0
- package/src/components/LangBtn/tests/__snapshots__/lang-btn-english.snap.png +0 -0
- package/src/components/LangBtn/tests/__snapshots__/lang-btn-no-arrow.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/LogoBrandSection/tests/LogoBrandSection.visual.cy.ts +43 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-default.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-mobile.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-reduced.snap.png +0 -0
- package/src/components/LogoBrandSection/tests/__snapshots__/logo-brand-section-with-title.snap.png +0 -0
- package/src/components/LunarCalendar/tests/LunarCalendar.visual.cy.ts +36 -0
- package/src/components/LunarCalendar/tests/__snapshots__/lunar-calendar-default.snap.png +0 -0
- package/src/components/LunarCalendar/tests/__snapshots__/lunar-calendar-required.snap.png +0 -0
- package/src/components/LunarCalendar/tests/__snapshots__/lunar-calendar-with-value.snap.png +0 -0
- package/src/components/MaintenancePage/tests/MaintenancePage.visual.cy.ts +22 -0
- package/src/components/MaintenancePage/tests/__snapshots__/maintenance-page-custom.snap.png +0 -0
- package/src/components/MaintenancePage/tests/__snapshots__/maintenance-page-default.snap.png +0 -0
- package/src/components/MonthPicker/tests/MonthPicker.visual.cy.ts +37 -0
- package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +2 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-default.snap.png +0 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-disabled.snap.png +0 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-readonly.snap.png +0 -0
- package/src/components/MonthPicker/tests/__snapshots__/month-picker-with-value.snap.png +0 -0
- package/src/components/NirField/NirField.stories.ts +40 -682
- package/src/components/NirField/NirField.vue +98 -32
- package/src/components/NirField/tests/NirField.spec.ts +135 -14
- package/src/components/NirField/tests/NirField.visual.cy.ts +28 -0
- package/src/components/NirField/tests/__snapshots__/nir-field-complex.snap.png +0 -0
- package/src/components/NirField/tests/__snapshots__/nir-field-default.snap.png +0 -0
- package/src/components/NirField/tests/__snapshots__/nir-field-with-key.snap.png +0 -0
- package/src/components/NirField/tests/useNirValidation.spec.ts +168 -0
- package/src/components/NirField/useNirValidation.ts +28 -2
- package/src/components/NirField/validation/Validation.stories.ts +866 -0
- package/src/components/NotFoundPage/tests/NotFoundPage.visual.cy.ts +28 -0
- package/src/components/NotFoundPage/tests/__snapshots__/not-found-page-custom-btn.snap.png +0 -0
- package/src/components/NotFoundPage/tests/__snapshots__/not-found-page-default.snap.png +0 -0
- package/src/components/NotFoundPage/tests/__snapshots__/not-found-page-no-btn.snap.png +0 -0
- package/src/components/NotificationBar/tests/NotificationBar.visual.cy.ts +54 -0
- package/src/components/NotificationBar/tests/__snapshots__/notification-bar-bottom.snap.png +0 -0
- package/src/components/NotificationBar/tests/__snapshots__/notification-bar-info.snap.png +0 -0
- package/src/components/NotificationBar/tests/__snapshots__/notification-bar-multiple.snap.png +0 -0
- package/src/components/PageContainer/tests/PageContainer.visual.cy.ts +33 -0
- package/src/components/PageContainer/tests/__snapshots__/page-container-color.snap.png +0 -0
- package/src/components/PageContainer/tests/__snapshots__/page-container-default.snap.png +0 -0
- package/src/components/PageContainer/tests/__snapshots__/page-container-md.snap.png +0 -0
- package/src/components/PaginatedTable/accessibilite/Accessibility.mdx +99 -7
- package/src/components/PaginatedTable/tests/PaginatedTable.visual.cy.ts +41 -0
- package/src/components/PaginatedTable/tests/__snapshots__/paginated-table-default.snap.png +0 -0
- package/src/components/PaginatedTable/tests/__snapshots__/paginated-table-server.snap.png +0 -0
- package/src/components/PasswordField/PasswordField.mdx +5 -52
- package/src/components/PasswordField/PasswordField.stories.ts +74 -931
- package/src/components/PasswordField/PasswordField.vue +120 -191
- package/src/components/PasswordField/Validation/Validation.stories.ts +1295 -0
- package/src/components/PasswordField/locales.ts +2 -0
- package/src/components/PasswordField/tests/PasswordField.spec.ts +144 -106
- package/src/components/PasswordField/tests/PasswordField.visual.cy.ts +49 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-default.snap.png +0 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-disabled.snap.png +0 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-required.snap.png +0 -0
- package/src/components/PasswordField/tests/__snapshots__/password-field-underlined.snap.png +0 -0
- package/src/components/PasswordField/types.ts +17 -0
- package/src/components/PasswordField/usePasswordFieldValidation.ts +100 -0
- package/src/components/PeriodField/PeriodField.stories.ts +3 -1
- package/src/components/PeriodField/PeriodField.vue +1 -1
- package/src/components/PeriodField/tests/PeriodField.visual.cy.ts +39 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-default.snap.png +0 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-no-calendar.snap.png +0 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-required.snap.png +0 -0
- package/src/components/PeriodField/tests/__snapshots__/period-field-with-value.snap.png +0 -0
- package/src/components/PhoneField/PhoneField.vue +2 -2
- package/src/components/PhoneField/tests/PhoneField.spec.ts +1 -0
- package/src/components/PhoneField/tests/PhoneField.visual.cy.ts +28 -0
- package/src/components/PhoneField/tests/__snapshots__/phone-field-default.snap.png +0 -0
- package/src/components/PhoneField/tests/__snapshots__/phone-field-with-country-code.snap.png +0 -0
- package/src/components/PhoneField/tests/__snapshots__/phone-field-with-value.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/RatingPicker/tests/RatingPicker.visual.cy.ts +52 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-emotion.snap.png +0 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-number.snap.png +0 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-readonly.snap.png +0 -0
- package/src/components/RatingPicker/tests/__snapshots__/rating-picker-stars.snap.png +0 -0
- package/src/components/SearchListField/SearchListField.mdx +1 -1
- package/src/components/SearchListField/SearchListField.stories.ts +1 -1
- package/src/components/SearchListField/SearchListField.vue +9 -4
- package/src/components/SearchListField/tests/SearchListField.spec.ts +127 -0
- package/src/components/SearchListField/tests/SearchListField.visual.cy.ts +35 -0
- package/src/components/SearchListField/tests/__snapshots__/search-list-field-default.snap.png +0 -0
- package/src/components/SearchListField/tests/__snapshots__/search-list-field-with-selection.snap.png +0 -0
- package/src/components/SkipLink/tests/SkipLink.visual.cy.ts +16 -0
- package/src/components/SkipLink/tests/__snapshots__/skip-link-focused.snap.png +0 -0
- package/src/components/SocialMediaLinks/tests/SocialMediaLinks.visual.cy.ts +33 -0
- package/src/components/SocialMediaLinks/tests/__snapshots__/social-media-links-default.snap.png +0 -0
- package/src/components/SocialMediaLinks/tests/__snapshots__/social-media-links-no-native-heading.snap.png +0 -0
- package/src/components/StatusPage/tests/StatusPage.visual.cy.ts +47 -0
- package/src/components/StatusPage/tests/__snapshots__/status-page-default.snap.png +0 -0
- package/src/components/StatusPage/tests/__snapshots__/status-page-full.snap.png +0 -0
- package/src/components/StatusPage/tests/__snapshots__/status-page-no-btn.snap.png +0 -0
- package/src/components/SubHeader/tests/SubHeader.visual.cy.ts +48 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-default.snap.png +0 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-loading.snap.png +0 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-no-back-btn.snap.png +0 -0
- package/src/components/SubHeader/tests/__snapshots__/sub-header-with-subtitle.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/components/SyHeading/tests/SyHeading.visual.cy.ts +33 -0
- package/src/components/SyHeading/tests/__snapshots__/sy-heading-level-1.snap.png +0 -0
- package/src/components/SyHeading/tests/__snapshots__/sy-heading-level-2.snap.png +0 -0
- package/src/components/SyHeading/tests/__snapshots__/sy-heading-level-3.snap.png +0 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +25 -0
- package/src/components/SyTextArea/SyTextArea.vue +7 -0
- package/src/components/SyTextArea/composables/useSyTextAreaValidation.ts +1 -1
- package/src/components/SyTextArea/tests/SyTextArea.a11y.spec.ts +18 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +135 -1
- package/src/components/SyTextArea/tests/SyTextArea.visual.cy.ts +48 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-default.snap.png +0 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-filled.snap.png +0 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-required.snap.png +0 -0
- package/src/components/SyTextArea/tests/__snapshots__/sy-textarea-with-value.snap.png +0 -0
- package/src/components/SyTextArea/validation/Validation.stories.ts +6 -86
- package/src/components/TableToolbar/tests/TableToolbar.visual.cy.ts +49 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-default.snap.png +0 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-filtered.snap.png +0 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-loading.snap.png +0 -0
- package/src/components/TableToolbar/tests/__snapshots__/table-toolbar-with-add-btn.snap.png +0 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +3 -3
- package/src/components/Tables/SyServerTable/accessibilite/Accessibility.mdx +114 -7
- package/src/components/Tables/SyServerTable/tests/SyServerTable.visual.cy.ts +58 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/sy-server-table-default.snap.png +0 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/sy-server-table-loading.snap.png +0 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/sy-server-table-with-select.snap.png +0 -0
- package/src/components/Tables/SyTable/accessibilite/Accessibility.mdx +116 -7
- package/src/components/Tables/SyTable/tests/SyTable.visual.cy.ts +70 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-compact.snap.png +0 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-default.snap.png +0 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-striped.snap.png +0 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/sy-table-with-select.snap.png +0 -0
- package/src/components/Tables/common/tableStyles.scss +4 -4
- package/src/components/Tables/common/tests/SyTableFilter.spec.ts +8 -1
- package/src/components/Tables/common/tests/filterByRange.spec.ts +23 -22
- package/src/components/ToolbarContainer/tests/ToolbarContainer.visual.cy.ts +34 -0
- package/src/components/ToolbarContainer/tests/__snapshots__/toolbar-container-default.snap.png +0 -0
- package/src/components/ToolbarContainer/tests/__snapshots__/toolbar-container-links.snap.png +0 -0
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +1 -2
- package/src/components/UploadWorkflow/tests/UploadWorkflow.visual.cy.ts +39 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/upload-workflow-default.snap.png +0 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/upload-workflow-with-title.snap.png +0 -0
- package/src/components/UserMenuBtn/tests/UserMenuBtn.visual.cy.ts +42 -0
- package/src/components/UserMenuBtn/tests/__snapshots__/user-menu-btn-default.snap.png +0 -0
- package/src/components/UserMenuBtn/tests/__snapshots__/user-menu-btn-no-logout.snap.png +0 -0
- package/src/components/UserMenuBtn/tests/__snapshots__/user-menu-btn-with-name.snap.png +0 -0
- package/src/composables/unifyValidation/documentationValidationProps.ts +1 -1
- package/src/composables/unifyValidation/tests/documentationValidationProps.spec.ts +2 -2
- package/src/composables/unifyValidation/useValidation.ts +17 -11
- package/src/composables/useFilterable/useFilterable.spec.ts +105 -142
- package/src/composables/useFilterable/useFilterable.ts +6 -17
- package/src/composables/useFormFieldErrorHandling.ts +1 -1
- package/src/composables/validation/tests/useFormValidation.spec.ts +11 -2
- package/src/composables/validation/tests/useValidatable.spec.ts +16 -6
- package/src/composables/validation/tests/useValidation.spec.ts +2 -2
- package/src/composables/validation/useValidation.ts +1 -1
- package/src/composantsVuetify/VCard/VCard.mdx +8 -0
- package/src/composantsVuetify/VCard/v-card.stories.ts +191 -1
- package/src/composantsVuetify/VStepper/VStepper.mdx +56 -0
- package/src/composantsVuetify/VStepper/v-stepper.stories.ts +563 -0
- package/src/designTokens/tokens/amelipro/apLightTheme.ts +1 -0
- package/src/designTokens/tokens/amelipro/apSemantic.ts +1 -1
- package/src/designTokens/tokens/pa/paLightTheme.ts +1 -0
- package/src/stories/Accessibilite/DesignSystem/a11y-status.json +1 -1
- package/src/stories/Components/Components.stories.ts +61 -10
- package/src/stories/Demarrer/Releases.stories.ts +45 -2
- package/src/stories/DesignTokens/Colors.mdx +2 -0
- package/src/stories/DesignTokens/colors.stories.ts +13 -0
- package/src/stories/EcoConception/EcoBestPracticesDoc.vue +930 -0
- package/src/stories/EcoConception/EcoBestPratices.mdx +38 -0
- package/src/stories/EcoConception/Introduction.mdx +8 -1
- package/src/stories/EcoConception/datas/bonnes_pratiques_essentielles.json +1018 -0
- package/src/stories/EcoConception/ecoconception-best-practices.stories.ts +20 -0
- package/src/stories/GuideDuDev/Amelipro.mdx +9 -1
- package/src/stories/GuideDuDev/Amelipro.stories.ts +955 -168
- package/src/stories/GuideDuDev/PortailAgent.stories.ts +0 -1
- package/src/utils/functions/deepCopy/index.ts +2 -3
- package/dist/components/Customs/SyCheckbox/locales.d.ts +0 -3
- package/dist/components/SyHeading/SyHeading.a11y.test.d.ts +0 -1
- package/dist/components/SyHeading/SyHeading.test.d.ts +0 -1
- package/src/components/Customs/SyCheckbox/locales.ts +0 -3
- package/src/components/Customs/SyTextField/types.d.ts +0 -4
|
@@ -0,0 +1,1295 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { VBtn } from 'vuetify/components'
|
|
4
|
+
import PasswordField from '../PasswordField.vue'
|
|
5
|
+
import type { PasswordFieldProps } from '../types'
|
|
6
|
+
import { fn, userEvent, within } from '@storybook/test'
|
|
7
|
+
import SyForm from '@/components/Customs/SyForm/SyForm.vue'
|
|
8
|
+
import { VForm } from 'vuetify/components/VForm'
|
|
9
|
+
import { getValidationDocumentation } from '@/composables/unifyValidation/documentationValidationProps'
|
|
10
|
+
|
|
11
|
+
type PasswordFieldStoryArgs = PasswordFieldProps & {
|
|
12
|
+
'onUpdate:modelValue': (...args: unknown[]) => unknown
|
|
13
|
+
'onSubmit': (...args: unknown[]) => unknown
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const meta = {
|
|
17
|
+
title: 'Composants/Formulaires/PasswordField/Validation',
|
|
18
|
+
component: PasswordField,
|
|
19
|
+
decorators: [
|
|
20
|
+
() => ({
|
|
21
|
+
template: '<div style="padding: 20px;"><story/></div>',
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'fullscreen',
|
|
26
|
+
controls: { exclude: 'on*' },
|
|
27
|
+
docs: {
|
|
28
|
+
description: {
|
|
29
|
+
component: `PasswordField est un champ de saisie sécurisé pour les mots de passe`,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
argTypes: {
|
|
34
|
+
...getValidationDocumentation('string'),
|
|
35
|
+
'modelValue': {
|
|
36
|
+
control: 'text',
|
|
37
|
+
description: 'Valeur du champ de mot de passe',
|
|
38
|
+
},
|
|
39
|
+
'variantStyle': {
|
|
40
|
+
control: 'select',
|
|
41
|
+
options: ['outlined', 'underlined'],
|
|
42
|
+
description: 'Style du champ (contour ou souligné)',
|
|
43
|
+
},
|
|
44
|
+
'color': {
|
|
45
|
+
control: 'select',
|
|
46
|
+
options: ['primary', 'secondary', 'error', 'warning', 'success', 'info'],
|
|
47
|
+
description: 'Couleur principale du champ',
|
|
48
|
+
},
|
|
49
|
+
'label': {
|
|
50
|
+
control: 'text',
|
|
51
|
+
description: 'Libellé du champ',
|
|
52
|
+
},
|
|
53
|
+
'displayAsterisk': {
|
|
54
|
+
control: 'boolean',
|
|
55
|
+
description: 'Affiche un astérisque à côté du libellé pour indiquer que le champ est obligatoire',
|
|
56
|
+
},
|
|
57
|
+
'bgColor': {
|
|
58
|
+
control: 'color',
|
|
59
|
+
description: 'Couleur de fond du champ',
|
|
60
|
+
},
|
|
61
|
+
'clearable': {
|
|
62
|
+
control: 'boolean',
|
|
63
|
+
description: 'Affiche un bouton pour vider le champ',
|
|
64
|
+
},
|
|
65
|
+
'autocompleteType': {
|
|
66
|
+
control: 'select',
|
|
67
|
+
options: ['current-password', 'new-password'],
|
|
68
|
+
description: 'Type d\'auto-complétion',
|
|
69
|
+
default: 'current-password',
|
|
70
|
+
},
|
|
71
|
+
'helpText': {
|
|
72
|
+
control: 'text',
|
|
73
|
+
description: 'Texte d\'aide affiché sous le champ',
|
|
74
|
+
},
|
|
75
|
+
'hideDetails': {
|
|
76
|
+
control: 'boolean',
|
|
77
|
+
description: 'Masque la zone de détails (messages d\'erreur, d\'aide…) sous le champ',
|
|
78
|
+
},
|
|
79
|
+
'update:modelValue': {
|
|
80
|
+
action: 'update:modelValue',
|
|
81
|
+
description: 'Événement émis lors de la mise à jour de la valeur du champ',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
args: {
|
|
85
|
+
'modelValue': '',
|
|
86
|
+
'variantStyle': 'outlined',
|
|
87
|
+
'color': 'primary',
|
|
88
|
+
'label': 'Mot de passe',
|
|
89
|
+
'required': false,
|
|
90
|
+
'errorMessages': null,
|
|
91
|
+
'warningMessages': null,
|
|
92
|
+
'successMessages': null,
|
|
93
|
+
'readonly': false,
|
|
94
|
+
'disabled': false,
|
|
95
|
+
'placeholder': 'Entrez votre mot de passe',
|
|
96
|
+
'customRules': [],
|
|
97
|
+
'customWarningRules': [],
|
|
98
|
+
'customSuccessRules': [],
|
|
99
|
+
'showSuccessMessages': false,
|
|
100
|
+
'displayAsterisk': false,
|
|
101
|
+
'isValidateOnBlur': true,
|
|
102
|
+
'bgColor': 'white',
|
|
103
|
+
'onUpdate:modelValue': fn(),
|
|
104
|
+
'onSubmit': fn(),
|
|
105
|
+
},
|
|
106
|
+
} as Meta<PasswordFieldStoryArgs>
|
|
107
|
+
|
|
108
|
+
export default meta
|
|
109
|
+
|
|
110
|
+
type Story = StoryObj<PasswordFieldStoryArgs>
|
|
111
|
+
|
|
112
|
+
export const WithError: Story = {
|
|
113
|
+
parameters: {
|
|
114
|
+
a11y: {
|
|
115
|
+
disable: true,
|
|
116
|
+
},
|
|
117
|
+
sourceCode: [
|
|
118
|
+
{
|
|
119
|
+
name: 'Template',
|
|
120
|
+
code: `
|
|
121
|
+
<template>
|
|
122
|
+
<PasswordField
|
|
123
|
+
v-model="password"
|
|
124
|
+
label="Mot de passe"
|
|
125
|
+
:custom-rules="customRules"
|
|
126
|
+
/>
|
|
127
|
+
</template>
|
|
128
|
+
`,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'Script',
|
|
132
|
+
code: `
|
|
133
|
+
<script setup lang="ts">
|
|
134
|
+
import { ref } from 'vue'
|
|
135
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
136
|
+
|
|
137
|
+
const password = ref('Mdp123')
|
|
138
|
+
|
|
139
|
+
const customRules = [
|
|
140
|
+
{
|
|
141
|
+
type: 'custom',
|
|
142
|
+
options: {
|
|
143
|
+
validate: (value: string) => {
|
|
144
|
+
if (!value || value.length < 8) {
|
|
145
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
146
|
+
}
|
|
147
|
+
return true
|
|
148
|
+
},
|
|
149
|
+
fieldIdentifier: 'password',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
]
|
|
153
|
+
</script>
|
|
154
|
+
`,
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
args: {
|
|
159
|
+
modelValue: 'Mdp123',
|
|
160
|
+
customRules: [
|
|
161
|
+
{
|
|
162
|
+
type: 'custom',
|
|
163
|
+
options: {
|
|
164
|
+
validate: (value: string) => {
|
|
165
|
+
if (!value || value.length < 8) {
|
|
166
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
167
|
+
}
|
|
168
|
+
return true
|
|
169
|
+
},
|
|
170
|
+
fieldIdentifier: 'password',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
play: async ({ canvasElement }) => {
|
|
176
|
+
const input = within(canvasElement).getByLabelText('Mot de passe')
|
|
177
|
+
await userEvent.clear(input)
|
|
178
|
+
await userEvent.type(input, 'Mdp123')
|
|
179
|
+
input.blur()
|
|
180
|
+
},
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const WithWarning: Story = {
|
|
184
|
+
parameters: {
|
|
185
|
+
a11y: {
|
|
186
|
+
disable: true,
|
|
187
|
+
},
|
|
188
|
+
sourceCode: [
|
|
189
|
+
{
|
|
190
|
+
name: 'Template',
|
|
191
|
+
code: `
|
|
192
|
+
<template>
|
|
193
|
+
<PasswordField
|
|
194
|
+
v-model="password"
|
|
195
|
+
label="Mot de passe"
|
|
196
|
+
:custom-warning-rules="customWarningRules"
|
|
197
|
+
/>
|
|
198
|
+
</template>
|
|
199
|
+
`,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'Script',
|
|
203
|
+
code: `
|
|
204
|
+
<script setup lang="ts">
|
|
205
|
+
import { ref } from 'vue'
|
|
206
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
207
|
+
|
|
208
|
+
const password = ref('MotDePasse123')
|
|
209
|
+
|
|
210
|
+
const customWarningRules = [
|
|
211
|
+
{
|
|
212
|
+
type: 'custom',
|
|
213
|
+
options: {
|
|
214
|
+
validate: (value: string) => {
|
|
215
|
+
const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(value)
|
|
216
|
+
if (!hasSpecialChar) {
|
|
217
|
+
return 'Le mot de passe pourrait être plus fort avec des caractères spéciaux'
|
|
218
|
+
}
|
|
219
|
+
return true
|
|
220
|
+
},
|
|
221
|
+
fieldIdentifier: 'password',
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
]
|
|
225
|
+
</script>
|
|
226
|
+
`,
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
args: {
|
|
231
|
+
modelValue: 'MotDePasse123',
|
|
232
|
+
customWarningRules: [
|
|
233
|
+
{
|
|
234
|
+
type: 'custom',
|
|
235
|
+
options: {
|
|
236
|
+
validate: (value: string) => {
|
|
237
|
+
const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(value)
|
|
238
|
+
if (!hasSpecialChar) {
|
|
239
|
+
return 'Le mot de passe pourrait être plus fort avec des caractères spéciaux'
|
|
240
|
+
}
|
|
241
|
+
return true
|
|
242
|
+
},
|
|
243
|
+
fieldIdentifier: 'password',
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
play: async ({ canvasElement }) => {
|
|
249
|
+
const input = within(canvasElement).getByLabelText('Mot de passe')
|
|
250
|
+
await userEvent.clear(input)
|
|
251
|
+
await userEvent.type(input, 'MotDePasse123')
|
|
252
|
+
input.blur()
|
|
253
|
+
},
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export const WithSuccess: Story = {
|
|
257
|
+
parameters: {
|
|
258
|
+
a11y: {
|
|
259
|
+
disable: true,
|
|
260
|
+
},
|
|
261
|
+
sourceCode: [
|
|
262
|
+
{
|
|
263
|
+
name: 'Template',
|
|
264
|
+
code: `
|
|
265
|
+
<template>
|
|
266
|
+
<PasswordField
|
|
267
|
+
v-model="password"
|
|
268
|
+
label="Mot de passe"
|
|
269
|
+
:custom-success-rules="customSuccessRules"
|
|
270
|
+
/>
|
|
271
|
+
</template>
|
|
272
|
+
`,
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
name: 'Script',
|
|
276
|
+
code: `
|
|
277
|
+
<script setup lang="ts">
|
|
278
|
+
import { ref } from 'vue'
|
|
279
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
280
|
+
|
|
281
|
+
const password = ref('MotDePasse123!@#')
|
|
282
|
+
|
|
283
|
+
const customSuccessRules = [
|
|
284
|
+
{
|
|
285
|
+
type: 'custom',
|
|
286
|
+
options: {
|
|
287
|
+
validate: (value: string) => {
|
|
288
|
+
const hasUpperCase = /[A-Z]/.test(value)
|
|
289
|
+
const hasLowerCase = /[a-z]/.test(value)
|
|
290
|
+
const hasNumber = /[0-9]/.test(value)
|
|
291
|
+
const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(value)
|
|
292
|
+
const hasMinLength = value.length >= 8
|
|
293
|
+
|
|
294
|
+
if (hasUpperCase && hasLowerCase && hasNumber && hasSpecialChar && hasMinLength) {
|
|
295
|
+
return 'Mot de passe fort'
|
|
296
|
+
}
|
|
297
|
+
return true
|
|
298
|
+
},
|
|
299
|
+
fieldIdentifier: 'password',
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
]
|
|
303
|
+
</script>
|
|
304
|
+
`,
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
},
|
|
308
|
+
args: {
|
|
309
|
+
modelValue: 'MotDePasse123!@#',
|
|
310
|
+
showSuccessMessages: true,
|
|
311
|
+
customSuccessRules: [
|
|
312
|
+
{
|
|
313
|
+
type: 'custom',
|
|
314
|
+
options: {
|
|
315
|
+
validate: (value: string) => {
|
|
316
|
+
const hasUpperCase = /[A-Z]/.test(value)
|
|
317
|
+
const hasLowerCase = /[a-z]/.test(value)
|
|
318
|
+
const hasNumber = /[0-9]/.test(value)
|
|
319
|
+
const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(value)
|
|
320
|
+
const isLongEnough = value.length >= 8
|
|
321
|
+
|
|
322
|
+
if (hasUpperCase && hasLowerCase && hasNumber && hasSpecialChar && isLongEnough) {
|
|
323
|
+
return true
|
|
324
|
+
}
|
|
325
|
+
return false
|
|
326
|
+
},
|
|
327
|
+
successMessage: 'Mot de passe fort',
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
play: async ({ canvasElement }) => {
|
|
333
|
+
const input = within(canvasElement).getByLabelText('Mot de passe')
|
|
334
|
+
await userEvent.clear(input)
|
|
335
|
+
await userEvent.type(input, 'MotDePasse123!@#')
|
|
336
|
+
input.blur()
|
|
337
|
+
},
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export const WithCustomRules: Story = {
|
|
341
|
+
parameters: {
|
|
342
|
+
a11y: {
|
|
343
|
+
disable: true,
|
|
344
|
+
},
|
|
345
|
+
sourceCode: [
|
|
346
|
+
{
|
|
347
|
+
name: 'Template',
|
|
348
|
+
code: `
|
|
349
|
+
<template>
|
|
350
|
+
<PasswordField
|
|
351
|
+
v-model="password"
|
|
352
|
+
label="Mot de passe"
|
|
353
|
+
required
|
|
354
|
+
:custom-rules="customRules"
|
|
355
|
+
/>
|
|
356
|
+
</template>
|
|
357
|
+
`,
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: 'Script',
|
|
361
|
+
code: `
|
|
362
|
+
<script setup lang="ts">
|
|
363
|
+
import { ref } from 'vue'
|
|
364
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
365
|
+
|
|
366
|
+
const password = ref('')
|
|
367
|
+
|
|
368
|
+
// Règles personnalisées pour la validation du mot de passe
|
|
369
|
+
const customRules = [
|
|
370
|
+
{
|
|
371
|
+
type: 'custom',
|
|
372
|
+
options: {
|
|
373
|
+
validate: (value: string) => {
|
|
374
|
+
if (!value || value.length < 8) {
|
|
375
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
376
|
+
}
|
|
377
|
+
return true
|
|
378
|
+
},
|
|
379
|
+
fieldIdentifier: 'password',
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
type: 'custom',
|
|
384
|
+
options: {
|
|
385
|
+
validate: (value) => {
|
|
386
|
+
if (!value || !/[A-Z]/.test(value)) {
|
|
387
|
+
return 'Le mot de passe doit contenir au moins une lettre majuscule'
|
|
388
|
+
}
|
|
389
|
+
return true
|
|
390
|
+
},
|
|
391
|
+
fieldIdentifier: 'password',
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
type: 'custom',
|
|
396
|
+
options: {
|
|
397
|
+
validate: (value) => {
|
|
398
|
+
if (!value || !/[0-9]/.test(value)) {
|
|
399
|
+
return 'Le mot de passe doit contenir au moins un chiffre'
|
|
400
|
+
}
|
|
401
|
+
return true
|
|
402
|
+
},
|
|
403
|
+
fieldIdentifier: 'password',
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
]
|
|
407
|
+
</script>
|
|
408
|
+
`,
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
},
|
|
412
|
+
render: args => ({
|
|
413
|
+
components: { PasswordField },
|
|
414
|
+
setup() {
|
|
415
|
+
const password = ref(args.modelValue ?? '')
|
|
416
|
+
|
|
417
|
+
// Règles personnalisées pour la validation du mot de passe
|
|
418
|
+
const customRules = [
|
|
419
|
+
{
|
|
420
|
+
type: 'custom',
|
|
421
|
+
options: {
|
|
422
|
+
validate: (value: string) => {
|
|
423
|
+
if (!value || value.length < 8) {
|
|
424
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
425
|
+
}
|
|
426
|
+
return true
|
|
427
|
+
},
|
|
428
|
+
fieldIdentifier: 'password',
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
type: 'custom',
|
|
433
|
+
options: {
|
|
434
|
+
validate: (value: string) => {
|
|
435
|
+
if (!value || !/[A-Z]/.test(value)) {
|
|
436
|
+
return 'Le mot de passe doit contenir au moins une lettre majuscule'
|
|
437
|
+
}
|
|
438
|
+
return true
|
|
439
|
+
},
|
|
440
|
+
fieldIdentifier: 'password',
|
|
441
|
+
successMessage: 'Le mot de passe est sécurisé',
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
type: 'custom',
|
|
446
|
+
options: {
|
|
447
|
+
validate: (value: string) => {
|
|
448
|
+
if (!value || !/[0-9]/.test(value)) {
|
|
449
|
+
return 'Le mot de passe doit contenir au moins un chiffre'
|
|
450
|
+
}
|
|
451
|
+
return true
|
|
452
|
+
},
|
|
453
|
+
fieldIdentifier: 'password',
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
]
|
|
457
|
+
|
|
458
|
+
return { args, password, customRules }
|
|
459
|
+
},
|
|
460
|
+
template: `
|
|
461
|
+
<PasswordField
|
|
462
|
+
v-bind="args"
|
|
463
|
+
v-model="password"
|
|
464
|
+
:custom-rules="customRules"
|
|
465
|
+
/>
|
|
466
|
+
`,
|
|
467
|
+
}),
|
|
468
|
+
args: {
|
|
469
|
+
required: true,
|
|
470
|
+
},
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export const WithSuccessMessages: Story = {
|
|
474
|
+
parameters: {
|
|
475
|
+
a11y: {
|
|
476
|
+
disable: true,
|
|
477
|
+
},
|
|
478
|
+
docs: {
|
|
479
|
+
description: {
|
|
480
|
+
story: `
|
|
481
|
+
### Messages de succès
|
|
482
|
+
|
|
483
|
+
Cette story illustre l'utilisation de la propriété \`showSuccessMessages\` qui permet de contrôler
|
|
484
|
+
l'affichage des messages de succès lors de la validation. Par défaut, cette propriété est à \`false\`.
|
|
485
|
+
|
|
486
|
+
Cela peut être utile pour réduire la verbosité de l'interface lorsque les messages de succès
|
|
487
|
+
ne sont pas nécessaires dans certains contextes.
|
|
488
|
+
`,
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
sourceCode: [
|
|
492
|
+
{
|
|
493
|
+
name: 'Template',
|
|
494
|
+
code: `<template>
|
|
495
|
+
<!-- Champ avec messages de succès (par défaut) -->
|
|
496
|
+
<PasswordField
|
|
497
|
+
v-model="value1"
|
|
498
|
+
label="Mot de passe avec messages de succès"
|
|
499
|
+
required
|
|
500
|
+
/>
|
|
501
|
+
|
|
502
|
+
<!-- Champ sans messages de succès -->
|
|
503
|
+
<PasswordField
|
|
504
|
+
v-model="value2"
|
|
505
|
+
label="Mot de passe sans messages de succès"
|
|
506
|
+
required
|
|
507
|
+
:showSuccessMessages="false"
|
|
508
|
+
/>
|
|
509
|
+
</template>`,
|
|
510
|
+
},
|
|
511
|
+
],
|
|
512
|
+
},
|
|
513
|
+
render: () => ({
|
|
514
|
+
components: { PasswordField },
|
|
515
|
+
setup() {
|
|
516
|
+
const value1 = ref('P@ssw0rd123')
|
|
517
|
+
const value2 = ref('P@ssw0rd123')
|
|
518
|
+
|
|
519
|
+
return { value1, value2 }
|
|
520
|
+
},
|
|
521
|
+
template: `
|
|
522
|
+
<div>
|
|
523
|
+
<p class="mb-4">Cette démonstration compare un PasswordField avec <code>showSuccessMessages=true</code> (par défaut) et un avec <code>showSuccessMessages=false</code>.</p>
|
|
524
|
+
|
|
525
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 16px;">
|
|
526
|
+
<div>
|
|
527
|
+
<p class="text-subtitle-2 mb-2">Avec messages de succès</p>
|
|
528
|
+
<PasswordField
|
|
529
|
+
v-model="value1"
|
|
530
|
+
label="Mot de passe avec messages de succès"
|
|
531
|
+
required
|
|
532
|
+
showSuccessMessages
|
|
533
|
+
/>
|
|
534
|
+
</div>
|
|
535
|
+
|
|
536
|
+
<div>
|
|
537
|
+
<p class="text-subtitle-2 mb-2">Sans messages de succès</p>
|
|
538
|
+
<PasswordField
|
|
539
|
+
v-model="value2"
|
|
540
|
+
label="Mot de passe sans messages de succès"
|
|
541
|
+
required
|
|
542
|
+
:showSuccessMessages="false"
|
|
543
|
+
/>
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
|
|
547
|
+
<div class="mt-4 text-body-2">
|
|
548
|
+
<p>Observations :</p>
|
|
549
|
+
<ul>
|
|
550
|
+
<li class="ml-4">Les deux champs ont la même valeur valide</li>
|
|
551
|
+
<li class="ml-4">Le champ de gauche affiche un message de succès et un indicateur visuel vert</li>
|
|
552
|
+
<li class="ml-4">Le champ de droite n'affiche pas de message de succès, mais conserve l'indicateur visuel</li>
|
|
553
|
+
<li class="ml-4">Essayez de modifier les valeurs puis de les rendre à nouveau valides</li>
|
|
554
|
+
</ul>
|
|
555
|
+
</div>
|
|
556
|
+
</div>
|
|
557
|
+
`,
|
|
558
|
+
}),
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export const DisableErrorHandling: Story = {
|
|
562
|
+
parameters: {
|
|
563
|
+
a11y: {
|
|
564
|
+
disable: true,
|
|
565
|
+
},
|
|
566
|
+
docs: {
|
|
567
|
+
description: {
|
|
568
|
+
story: `
|
|
569
|
+
### Désactivation de la gestion des erreurs
|
|
570
|
+
|
|
571
|
+
Cette story illustre l'utilisation de la propriété \`disableErrorHandling\` qui permet de désactiver complètement
|
|
572
|
+
la gestion et l'affichage des erreurs dans un champ, même si des règles de validation sont définies.
|
|
573
|
+
|
|
574
|
+
Cela peut être utile dans des cas particuliers où vous souhaitez définir des règles de validation
|
|
575
|
+
mais gérer leur affichage différemment, ou utiliser la validation uniquement au niveau du formulaire parent.
|
|
576
|
+
`,
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
sourceCode: [
|
|
580
|
+
{
|
|
581
|
+
name: 'Template',
|
|
582
|
+
code: `<template>
|
|
583
|
+
<!-- Champ avec validation normale -->
|
|
584
|
+
<PasswordField
|
|
585
|
+
v-model="value1"
|
|
586
|
+
label="Mot de passe avec validation"
|
|
587
|
+
required
|
|
588
|
+
:custom-rules="customRules"
|
|
589
|
+
/>
|
|
590
|
+
|
|
591
|
+
<!-- Champ avec gestion d'erreurs désactivée -->
|
|
592
|
+
<PasswordField
|
|
593
|
+
v-model="value2"
|
|
594
|
+
label="Mot de passe sans gestion d'erreurs"
|
|
595
|
+
required
|
|
596
|
+
disableErrorHandling
|
|
597
|
+
:custom-rules="customRules"
|
|
598
|
+
/>
|
|
599
|
+
</template>`,
|
|
600
|
+
},
|
|
601
|
+
],
|
|
602
|
+
},
|
|
603
|
+
render: () => ({
|
|
604
|
+
components: { PasswordField },
|
|
605
|
+
setup() {
|
|
606
|
+
const value1 = ref('')
|
|
607
|
+
const value2 = ref('')
|
|
608
|
+
|
|
609
|
+
const customRules = [
|
|
610
|
+
{
|
|
611
|
+
type: 'custom',
|
|
612
|
+
options: {
|
|
613
|
+
validate: (value: string) => {
|
|
614
|
+
if (!value || value.length < 8) {
|
|
615
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
616
|
+
}
|
|
617
|
+
return true
|
|
618
|
+
},
|
|
619
|
+
fieldIdentifier: 'password',
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
]
|
|
623
|
+
|
|
624
|
+
return { value1, value2, customRules }
|
|
625
|
+
},
|
|
626
|
+
template: `
|
|
627
|
+
<div>
|
|
628
|
+
<p class="mb-4">Cette démonstration compare un PasswordField standard et un avec \`disableErrorHandling=true\`.</p>
|
|
629
|
+
|
|
630
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 16px;">
|
|
631
|
+
<div>
|
|
632
|
+
<p class="text-subtitle-2 mb-2">Validation normale</p>
|
|
633
|
+
<PasswordField
|
|
634
|
+
v-model="value1"
|
|
635
|
+
label="Mot de passe avec validation"
|
|
636
|
+
required
|
|
637
|
+
:custom-rules="customRules"
|
|
638
|
+
/>
|
|
639
|
+
</div>
|
|
640
|
+
|
|
641
|
+
<div>
|
|
642
|
+
<p class="text-subtitle-2 mb-2">Sans gestion d'erreurs</p>
|
|
643
|
+
<PasswordField
|
|
644
|
+
v-model="value2"
|
|
645
|
+
label="Mot de passe sans gestion d'erreurs"
|
|
646
|
+
required
|
|
647
|
+
disableErrorHandling
|
|
648
|
+
:custom-rules="customRules"
|
|
649
|
+
/>
|
|
650
|
+
</div>
|
|
651
|
+
</div>
|
|
652
|
+
|
|
653
|
+
<div class="mt-4 text-body-2">
|
|
654
|
+
<p>Instructions :</p>
|
|
655
|
+
<ol>
|
|
656
|
+
<li class="ml-4">Cliquez dans un champ puis en dehors pour déclencher la validation</li>
|
|
657
|
+
<li class="ml-4">Le champ de gauche affichera une erreur requise, mais pas celui de droite</li>
|
|
658
|
+
<li class="ml-4">Vous pouvez également essayer de soumettre les deux champs pour voir la différence de comportement</li>
|
|
659
|
+
</ol>
|
|
660
|
+
</div>
|
|
661
|
+
</div>
|
|
662
|
+
`,
|
|
663
|
+
}),
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Validation déclenchée à chaque frappe (isValidateOnBlur: false).
|
|
668
|
+
*/
|
|
669
|
+
export const ValidateOnInput: Story = {
|
|
670
|
+
parameters: {
|
|
671
|
+
docs: {
|
|
672
|
+
description: {
|
|
673
|
+
story: `
|
|
674
|
+
### Validation à la saisie
|
|
675
|
+
|
|
676
|
+
Lorsque \`isValidateOnBlur\` vaut \`false\`, la validation se déclenche à chaque modification
|
|
677
|
+
de la valeur plutôt qu'à la perte de focus. Utile pour un retour immédiat à l'utilisateur.
|
|
678
|
+
`,
|
|
679
|
+
},
|
|
680
|
+
},
|
|
681
|
+
sourceCode: [
|
|
682
|
+
{
|
|
683
|
+
name: 'Template',
|
|
684
|
+
code: `<template>
|
|
685
|
+
<PasswordField
|
|
686
|
+
v-model="password"
|
|
687
|
+
label="Mot de passe"
|
|
688
|
+
required
|
|
689
|
+
:is-validate-on-blur="false"
|
|
690
|
+
:custom-rules="[
|
|
691
|
+
{
|
|
692
|
+
type: 'custom',
|
|
693
|
+
options: {
|
|
694
|
+
message: 'Au moins 8 caractères requis',
|
|
695
|
+
validate: (value) => value.length >= 8,
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
]"
|
|
699
|
+
show-success-messages
|
|
700
|
+
/>
|
|
701
|
+
</template>`,
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: 'Script',
|
|
705
|
+
code: `<script setup lang="ts">
|
|
706
|
+
import { ref } from 'vue'
|
|
707
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
708
|
+
|
|
709
|
+
const password = ref('')
|
|
710
|
+
</script>`,
|
|
711
|
+
},
|
|
712
|
+
],
|
|
713
|
+
},
|
|
714
|
+
render: args => ({
|
|
715
|
+
components: { PasswordField },
|
|
716
|
+
setup() {
|
|
717
|
+
const password = ref('')
|
|
718
|
+
return { args, password }
|
|
719
|
+
},
|
|
720
|
+
template: `
|
|
721
|
+
<div>
|
|
722
|
+
<p class="mb-4">La validation se déclenche à chaque frappe (<code>isValidateOnBlur="false"</code>).</p>
|
|
723
|
+
<PasswordField
|
|
724
|
+
v-model="password"
|
|
725
|
+
label="Mot de passe"
|
|
726
|
+
required
|
|
727
|
+
:is-validate-on-blur="false"
|
|
728
|
+
:custom-rules="[
|
|
729
|
+
{
|
|
730
|
+
type: 'custom',
|
|
731
|
+
options: {
|
|
732
|
+
message: 'Au moins 8 caractères requis',
|
|
733
|
+
validate: (value) => value.length >= 8,
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
]"
|
|
737
|
+
show-success-messages
|
|
738
|
+
/>
|
|
739
|
+
</div>
|
|
740
|
+
`,
|
|
741
|
+
}),
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Messages de validation injectés directement par le parent (errorMessages, warningMessages, successMessages).
|
|
746
|
+
*/
|
|
747
|
+
export const ExternalMessages: Story = {
|
|
748
|
+
parameters: {
|
|
749
|
+
docs: {
|
|
750
|
+
description: {
|
|
751
|
+
story: `
|
|
752
|
+
### Messages externes
|
|
753
|
+
|
|
754
|
+
Les props \`errorMessages\`, \`warningMessages\` et \`successMessages\`
|
|
755
|
+
`,
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
sourceCode: [
|
|
759
|
+
{
|
|
760
|
+
name: 'Template',
|
|
761
|
+
code: `<template>
|
|
762
|
+
<PasswordField
|
|
763
|
+
v-model="password"
|
|
764
|
+
label="Mot de passe"
|
|
765
|
+
:error-messages="errorMessages"
|
|
766
|
+
:warning-messages="warningMessages"
|
|
767
|
+
:success-messages="successMessages"
|
|
768
|
+
:showSuccessMessages='true'
|
|
769
|
+
/>
|
|
770
|
+
<div class="mt-4">
|
|
771
|
+
<VBtn @click="setError">Simuler une erreur</VBtn>
|
|
772
|
+
<VBtn @click="setWarning" class="ml-2">Simuler un avertissement</VBtn>
|
|
773
|
+
<VBtn @click="setSuccess" class="ml-2">Simuler un succès</VBtn>
|
|
774
|
+
<VBtn @click="reset" class="ml-2">Réinitialiser</VBtn>
|
|
775
|
+
</div>
|
|
776
|
+
</template>`,
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: 'Script',
|
|
780
|
+
code: `<script setup lang="ts">
|
|
781
|
+
import { ref } from 'vue'
|
|
782
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
783
|
+
|
|
784
|
+
const password = ref('')
|
|
785
|
+
const errorMessages = ref<string[] | null>(null)
|
|
786
|
+
const warningMessages = ref<string[] | null>(null)
|
|
787
|
+
const successMessages = ref<string[] | null>(null)
|
|
788
|
+
|
|
789
|
+
function setError() {
|
|
790
|
+
errorMessages.value = ['Ce mot de passe a déjà été utilisé']
|
|
791
|
+
warningMessages.value = null
|
|
792
|
+
successMessages.value = null
|
|
793
|
+
}
|
|
794
|
+
function setWarning() {
|
|
795
|
+
errorMessages.value = null
|
|
796
|
+
warningMessages.value = ['Ce mot de passe figure dans une liste de mots de passe courants']
|
|
797
|
+
successMessages.value = null
|
|
798
|
+
}
|
|
799
|
+
function setSuccess() {
|
|
800
|
+
errorMessages.value = null
|
|
801
|
+
warningMessages.value = null
|
|
802
|
+
successMessages.value = ['Mot de passe accepté par le serveur']
|
|
803
|
+
}
|
|
804
|
+
function reset() {
|
|
805
|
+
errorMessages.value = null
|
|
806
|
+
warningMessages.value = null
|
|
807
|
+
successMessages.value = null
|
|
808
|
+
}
|
|
809
|
+
</script>`,
|
|
810
|
+
},
|
|
811
|
+
],
|
|
812
|
+
},
|
|
813
|
+
render: args => ({
|
|
814
|
+
components: { PasswordField },
|
|
815
|
+
setup() {
|
|
816
|
+
const password = ref('')
|
|
817
|
+
const errorMessages = ref<string[] | null>(null)
|
|
818
|
+
const warningMessages = ref<string[] | null>(null)
|
|
819
|
+
const successMessages = ref<string[] | null>(null)
|
|
820
|
+
|
|
821
|
+
function setError() {
|
|
822
|
+
errorMessages.value = ['Ce mot de passe a déjà été utilisé']
|
|
823
|
+
warningMessages.value = null
|
|
824
|
+
successMessages.value = null
|
|
825
|
+
}
|
|
826
|
+
function setWarning() {
|
|
827
|
+
errorMessages.value = null
|
|
828
|
+
warningMessages.value = ['Ce mot de passe figure dans une liste de mots de passe courants']
|
|
829
|
+
successMessages.value = null
|
|
830
|
+
}
|
|
831
|
+
function setSuccess() {
|
|
832
|
+
errorMessages.value = null
|
|
833
|
+
warningMessages.value = null
|
|
834
|
+
successMessages.value = ['Mot de passe accepté par le serveur']
|
|
835
|
+
}
|
|
836
|
+
function reset() {
|
|
837
|
+
errorMessages.value = null
|
|
838
|
+
warningMessages.value = null
|
|
839
|
+
successMessages.value = null
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
return { args, password, errorMessages, warningMessages, successMessages, setError, setWarning, setSuccess, reset }
|
|
843
|
+
},
|
|
844
|
+
template: `
|
|
845
|
+
<div>
|
|
846
|
+
<p class="mb-4">
|
|
847
|
+
Les messages ci-dessous sont injectés par le parent sans déclencher de règle de validation.
|
|
848
|
+
</p>
|
|
849
|
+
<PasswordField
|
|
850
|
+
v-model="password"
|
|
851
|
+
label="Mot de passe"
|
|
852
|
+
:error-messages="errorMessages"
|
|
853
|
+
:warning-messages="warningMessages"
|
|
854
|
+
:success-messages="successMessages"
|
|
855
|
+
:showSuccessMessages='true'
|
|
856
|
+
/>
|
|
857
|
+
<div class="mt-4 d-flex flex-wrap ga-2">
|
|
858
|
+
<VBtn color="error" @click="setError">Simuler une erreur</VBtn>
|
|
859
|
+
<VBtn color="warning" @click="setWarning">Simuler un avertissement</VBtn>
|
|
860
|
+
<VBtn color="success" @click="setSuccess">Simuler un succès</VBtn>
|
|
861
|
+
<VBtn @click="reset">Réinitialiser</VBtn>
|
|
862
|
+
</div>
|
|
863
|
+
</div>
|
|
864
|
+
`,
|
|
865
|
+
}),
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export const VFormVuetifyValidation: Story = {
|
|
869
|
+
parameters: {
|
|
870
|
+
docs: {
|
|
871
|
+
description: {
|
|
872
|
+
story: `
|
|
873
|
+
### Validation de style Vuetify
|
|
874
|
+
|
|
875
|
+
En passant \`useVuetifyValidation="true"\`, le composant délègue la validation à Vuetify.
|
|
876
|
+
Les règles sont de simples fonctions qui retournent \`true\` si la valeur est valide,
|
|
877
|
+
ou un message d'erreur (chaîne de caractères) sinon — exactement comme avec la prop \`rules\`
|
|
878
|
+
native de Vuetify (\`VTextField\`, etc.).
|
|
879
|
+
|
|
880
|
+
Cela permet de réutiliser des règles existantes écrites pour Vuetify sans adaptation.
|
|
881
|
+
`,
|
|
882
|
+
},
|
|
883
|
+
},
|
|
884
|
+
sourceCode: [
|
|
885
|
+
{
|
|
886
|
+
name: 'Template',
|
|
887
|
+
code: `<template>
|
|
888
|
+
<VForm @submit.prevent="handleSubmit">
|
|
889
|
+
<PasswordField
|
|
890
|
+
v-model="password"
|
|
891
|
+
label="Mot de passe"
|
|
892
|
+
:use-vuetify-validation="true"
|
|
893
|
+
:rules="rules"
|
|
894
|
+
:is-validate-on-blur="true"
|
|
895
|
+
/>
|
|
896
|
+
<div class="mt-4">
|
|
897
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
898
|
+
</div>
|
|
899
|
+
</VForm>
|
|
900
|
+
</template>`,
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
name: 'Script',
|
|
904
|
+
code: `<script setup lang="ts">
|
|
905
|
+
import { ref } from 'vue'
|
|
906
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
907
|
+
|
|
908
|
+
const password = ref('')
|
|
909
|
+
|
|
910
|
+
const rules = [
|
|
911
|
+
(value: string) => !!value || 'Le mot de passe est requis',
|
|
912
|
+
(value: string) => value.length >= 8 || 'Au moins 8 caractères requis',
|
|
913
|
+
(value: string) => /[A-Z]/.test(value) || 'Au moins une lettre majuscule requise',
|
|
914
|
+
(value: string) => /[0-9]/.test(value) || 'Au moins un chiffre requis',
|
|
915
|
+
(value: string) => /[!@#$%^&*(),.?":{}|<>]/.test(value) || 'Au moins un caractère spécial requis',
|
|
916
|
+
]
|
|
917
|
+
|
|
918
|
+
async function handleSubmit(e) {
|
|
919
|
+
const isValid = (await e).valid
|
|
920
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
921
|
+
}
|
|
922
|
+
</script>`,
|
|
923
|
+
},
|
|
924
|
+
],
|
|
925
|
+
},
|
|
926
|
+
render: args => ({
|
|
927
|
+
components: { VForm, PasswordField, VBtn },
|
|
928
|
+
setup() {
|
|
929
|
+
const password = ref('')
|
|
930
|
+
|
|
931
|
+
const rules = [
|
|
932
|
+
(value: string) => !!value || 'Le mot de passe est requis',
|
|
933
|
+
(value: string) => value.length >= 8 || 'Au moins 8 caractères requis',
|
|
934
|
+
(value: string) => /[A-Z]/.test(value) || 'Au moins une lettre majuscule requise',
|
|
935
|
+
(value: string) => /[0-9]/.test(value) || 'Au moins un chiffre requis',
|
|
936
|
+
(value: string) => /[!@#$%^&*(),.?":{}|<>]/.test(value) || 'Au moins un caractère spécial requis',
|
|
937
|
+
]
|
|
938
|
+
|
|
939
|
+
async function handleSubmit(e) {
|
|
940
|
+
const isValid = (await e).valid
|
|
941
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
return { args, password, rules, handleSubmit }
|
|
945
|
+
},
|
|
946
|
+
template: `
|
|
947
|
+
<div>
|
|
948
|
+
<p class="mb-4">
|
|
949
|
+
Les règles sont des fonctions Vuetify natives <code>(value) => true | 'message'</code>.
|
|
950
|
+
Cliquez sur <strong>Valider</strong> ou quittez le champ pour déclencher la validation.
|
|
951
|
+
</p>
|
|
952
|
+
<VForm @submit.prevent="handleSubmit">
|
|
953
|
+
<PasswordField
|
|
954
|
+
v-bind="args"
|
|
955
|
+
v-model="password"
|
|
956
|
+
label="Mot de passe"
|
|
957
|
+
:use-vuetify-validation="true"
|
|
958
|
+
:rules="rules"
|
|
959
|
+
:is-validate-on-blur="true"
|
|
960
|
+
/>
|
|
961
|
+
<div class="mt-4">
|
|
962
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
963
|
+
</div>
|
|
964
|
+
</VForm>
|
|
965
|
+
</div>
|
|
966
|
+
`,
|
|
967
|
+
}),
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
export const SyFormValidation: Story = {
|
|
971
|
+
parameters: {
|
|
972
|
+
sourceCode: [
|
|
973
|
+
{
|
|
974
|
+
name: 'Template',
|
|
975
|
+
code: `<template>
|
|
976
|
+
<SyForm @submit="handleSubmit">
|
|
977
|
+
<PasswordField
|
|
978
|
+
ref="fieldRef"
|
|
979
|
+
v-model="password"
|
|
980
|
+
label="Mot de passe"
|
|
981
|
+
:custom-rules="customRules"
|
|
982
|
+
required
|
|
983
|
+
/>
|
|
984
|
+
<div class="mt-4">
|
|
985
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
986
|
+
</div>
|
|
987
|
+
</SyForm>
|
|
988
|
+
</template>`,
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
name: 'Script',
|
|
992
|
+
code: `<script setup lang="ts">
|
|
993
|
+
import { ref } from 'vue'
|
|
994
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
995
|
+
|
|
996
|
+
const password = ref('')
|
|
997
|
+
|
|
998
|
+
const customRules = [
|
|
999
|
+
{
|
|
1000
|
+
type: 'custom',
|
|
1001
|
+
options: {
|
|
1002
|
+
validate: (value: string) => {
|
|
1003
|
+
if (!value || value.length < 8) {
|
|
1004
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
1005
|
+
}
|
|
1006
|
+
return true
|
|
1007
|
+
},
|
|
1008
|
+
fieldIdentifier: 'password',
|
|
1009
|
+
},
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
type: 'custom',
|
|
1013
|
+
options: {
|
|
1014
|
+
validate: (value: string) => {
|
|
1015
|
+
if (!value || !/[A-Z]/.test(value)) {
|
|
1016
|
+
return 'Le mot de passe doit contenir au moins une lettre majuscule'
|
|
1017
|
+
}
|
|
1018
|
+
return true
|
|
1019
|
+
},
|
|
1020
|
+
fieldIdentifier: 'password',
|
|
1021
|
+
},
|
|
1022
|
+
},
|
|
1023
|
+
]
|
|
1024
|
+
|
|
1025
|
+
function handleSubmit(e) {
|
|
1026
|
+
// La validation est gérée par SyForm, on peut juste vérifier le résultat
|
|
1027
|
+
const isValid = e.isValid
|
|
1028
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
1029
|
+
}
|
|
1030
|
+
</script>`,
|
|
1031
|
+
},
|
|
1032
|
+
],
|
|
1033
|
+
},
|
|
1034
|
+
render: args => ({
|
|
1035
|
+
components: { PasswordField, VBtn, SyForm },
|
|
1036
|
+
setup() {
|
|
1037
|
+
const password = ref('')
|
|
1038
|
+
|
|
1039
|
+
const customRules = [
|
|
1040
|
+
{
|
|
1041
|
+
type: 'custom',
|
|
1042
|
+
options: {
|
|
1043
|
+
validate: (value: string) => {
|
|
1044
|
+
if (!value || value.length < 8) {
|
|
1045
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
1046
|
+
}
|
|
1047
|
+
return true
|
|
1048
|
+
},
|
|
1049
|
+
fieldIdentifier: 'password',
|
|
1050
|
+
},
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
type: 'custom',
|
|
1054
|
+
options: {
|
|
1055
|
+
validate: (value: string) => {
|
|
1056
|
+
if (!value || !/[A-Z]/.test(value)) {
|
|
1057
|
+
return 'Le mot de passe doit contenir au moins une lettre majuscule'
|
|
1058
|
+
}
|
|
1059
|
+
return true
|
|
1060
|
+
},
|
|
1061
|
+
fieldIdentifier: 'password',
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1064
|
+
]
|
|
1065
|
+
|
|
1066
|
+
function handleSubmit(e) {
|
|
1067
|
+
// La validation est gérée par SyForm, on peut juste vérifier le résultat
|
|
1068
|
+
const isValid = e.isValid
|
|
1069
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
return { args, password, customRules, handleSubmit }
|
|
1073
|
+
},
|
|
1074
|
+
template: `
|
|
1075
|
+
<div>
|
|
1076
|
+
<SyForm @submit="handleSubmit">
|
|
1077
|
+
<PasswordField
|
|
1078
|
+
v-model="password"
|
|
1079
|
+
v-bind="args"
|
|
1080
|
+
:custom-rules="customRules"
|
|
1081
|
+
/>
|
|
1082
|
+
<div class="mt-4">
|
|
1083
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
1084
|
+
</div>
|
|
1085
|
+
</SyForm>
|
|
1086
|
+
</div>
|
|
1087
|
+
`,
|
|
1088
|
+
}),
|
|
1089
|
+
args: {
|
|
1090
|
+
required: true,
|
|
1091
|
+
},
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
export const SyFormVuetifyValidation: Story = {
|
|
1095
|
+
parameters: {
|
|
1096
|
+
sourceCode: [
|
|
1097
|
+
{
|
|
1098
|
+
name: 'Template',
|
|
1099
|
+
code: `<template>
|
|
1100
|
+
<SyForm @submit="handleSubmit">
|
|
1101
|
+
<PasswordField
|
|
1102
|
+
v-model="password"
|
|
1103
|
+
label="Mot de passe"
|
|
1104
|
+
:use-vuetify-validation="true"
|
|
1105
|
+
:rules="vuetifyRules"
|
|
1106
|
+
/>
|
|
1107
|
+
<div class="mt-4">
|
|
1108
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
1109
|
+
</div>
|
|
1110
|
+
</SyForm>
|
|
1111
|
+
</template>`,
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
name: 'Script',
|
|
1115
|
+
code: `<script setup lang="ts">
|
|
1116
|
+
import { ref } from 'vue'
|
|
1117
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
1118
|
+
|
|
1119
|
+
const password = ref('')
|
|
1120
|
+
|
|
1121
|
+
const vuetifyRules = [
|
|
1122
|
+
(value: string) => !!value || 'Le mot de passe est requis',
|
|
1123
|
+
(value: string) => value.length >= 8 || 'Au moins 8 caractères requis',
|
|
1124
|
+
(value: string) => /[A-Z]/.test(value) || 'Au moins une lettre majuscule requise',
|
|
1125
|
+
(value: string) => /[0-9]/.test(value) || 'Au moins un chiffre requis',
|
|
1126
|
+
(value: string) => /[!@#$%^&*(),.?":{}|<>]/.test(value) || 'Au moins un caractère spécial requis',
|
|
1127
|
+
]
|
|
1128
|
+
|
|
1129
|
+
function handleSubmit(e) {
|
|
1130
|
+
const isValid = e.isValid
|
|
1131
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
1132
|
+
}
|
|
1133
|
+
</script>`,
|
|
1134
|
+
},
|
|
1135
|
+
],
|
|
1136
|
+
},
|
|
1137
|
+
render: args => ({
|
|
1138
|
+
components: { PasswordField, VBtn, SyForm },
|
|
1139
|
+
setup() {
|
|
1140
|
+
const password = ref('')
|
|
1141
|
+
|
|
1142
|
+
const vuetifyRules = [
|
|
1143
|
+
(value: string) => !!value || 'Le mot de passe est requis',
|
|
1144
|
+
(value: string) => value.length >= 8 || 'Au moins 8 caractères requis',
|
|
1145
|
+
(value: string) => /[A-Z]/.test(value) || 'Au moins une lettre majuscule requise',
|
|
1146
|
+
(value: string) => /[0-9]/.test(value) || 'Au moins un chiffre requis',
|
|
1147
|
+
(value: string) => /[!@#$%^&*(),.?":{}|<>]/.test(value) || 'Au moins un caractère spécial requis',
|
|
1148
|
+
]
|
|
1149
|
+
|
|
1150
|
+
function handleSubmit(e) {
|
|
1151
|
+
const isValid = e.isValid
|
|
1152
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
return { args, password, vuetifyRules, handleSubmit }
|
|
1156
|
+
},
|
|
1157
|
+
template: `
|
|
1158
|
+
<div>
|
|
1159
|
+
<SyForm @submit="handleSubmit">
|
|
1160
|
+
<PasswordField
|
|
1161
|
+
v-model="password"
|
|
1162
|
+
v-bind="args"
|
|
1163
|
+
:use-vuetify-validation="true"
|
|
1164
|
+
:rules="vuetifyRules"
|
|
1165
|
+
/>
|
|
1166
|
+
<div class="mt-4">
|
|
1167
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
1168
|
+
</div>
|
|
1169
|
+
</SyForm>
|
|
1170
|
+
</div>
|
|
1171
|
+
`,
|
|
1172
|
+
}),
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
export const VFormValidation: Story = {
|
|
1176
|
+
parameters: {
|
|
1177
|
+
sourceCode: [
|
|
1178
|
+
{
|
|
1179
|
+
name: 'Template',
|
|
1180
|
+
code: `<template>
|
|
1181
|
+
<VForm @submit.prevent="handleSubmit">
|
|
1182
|
+
<PasswordField
|
|
1183
|
+
ref="fieldRef"
|
|
1184
|
+
v-model="password"
|
|
1185
|
+
label="Mot de passe"
|
|
1186
|
+
required
|
|
1187
|
+
:custom-rules="customRules"
|
|
1188
|
+
/>
|
|
1189
|
+
<div class="mt-4">
|
|
1190
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
1191
|
+
</div>
|
|
1192
|
+
</VForm>
|
|
1193
|
+
</template>`,
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
name: 'Script',
|
|
1197
|
+
code: `<script setup lang="ts">
|
|
1198
|
+
import { ref } from 'vue'
|
|
1199
|
+
import { PasswordField } from '@cnamts/synapse'
|
|
1200
|
+
|
|
1201
|
+
const password = ref('')
|
|
1202
|
+
const fieldRef = ref()
|
|
1203
|
+
|
|
1204
|
+
const customRules = [
|
|
1205
|
+
{
|
|
1206
|
+
type: 'custom',
|
|
1207
|
+
options: {
|
|
1208
|
+
validate: (value: string) => {
|
|
1209
|
+
return value.length >= 8
|
|
1210
|
+
},
|
|
1211
|
+
message: 'Au moins 8 caractères requis',
|
|
1212
|
+
fieldIdentifier: 'password',
|
|
1213
|
+
},
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
type: 'custom',
|
|
1217
|
+
options: {
|
|
1218
|
+
validate: (value: string) => {
|
|
1219
|
+
return /[A-Z]/.test(value)
|
|
1220
|
+
},
|
|
1221
|
+
message: 'Au moins une lettre majuscule requise',
|
|
1222
|
+
fieldIdentifier: 'password',
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1225
|
+
]
|
|
1226
|
+
|
|
1227
|
+
async function handleSubmit() {
|
|
1228
|
+
const isValid = await fieldRef.value?.validateOnSubmit()
|
|
1229
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
1230
|
+
}
|
|
1231
|
+
</script>`,
|
|
1232
|
+
},
|
|
1233
|
+
],
|
|
1234
|
+
},
|
|
1235
|
+
render: args => ({
|
|
1236
|
+
components: { PasswordField, VBtn },
|
|
1237
|
+
setup() {
|
|
1238
|
+
const password = ref('')
|
|
1239
|
+
const fieldRef = ref()
|
|
1240
|
+
|
|
1241
|
+
const customRules = [
|
|
1242
|
+
{
|
|
1243
|
+
type: 'custom',
|
|
1244
|
+
options: {
|
|
1245
|
+
validate: (value: string) => {
|
|
1246
|
+
return value.length >= 8
|
|
1247
|
+
},
|
|
1248
|
+
message: 'Au moins 8 caractères requis',
|
|
1249
|
+
fieldIdentifier: 'password',
|
|
1250
|
+
},
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
type: 'custom',
|
|
1254
|
+
options: {
|
|
1255
|
+
validate: (value: string) => {
|
|
1256
|
+
return /[A-Z]/.test(value)
|
|
1257
|
+
},
|
|
1258
|
+
message: 'Au moins une lettre majuscule requise',
|
|
1259
|
+
fieldIdentifier: 'password',
|
|
1260
|
+
},
|
|
1261
|
+
},
|
|
1262
|
+
]
|
|
1263
|
+
|
|
1264
|
+
async function handleSubmit() {
|
|
1265
|
+
const isValid = await fieldRef.value?.validateOnSubmit()
|
|
1266
|
+
alert(isValid ? 'Mot de passe valide !' : 'Veuillez corriger les erreurs.')
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
return { args, password, fieldRef, customRules, handleSubmit }
|
|
1270
|
+
},
|
|
1271
|
+
template: `
|
|
1272
|
+
<div>
|
|
1273
|
+
<p class="mb-4">
|
|
1274
|
+
Il est préférable d'utiliser <code>SyForm</code> pour bénéficier de toutes les fonctionnalités de validation, mais voici un exemple d'utilisation avec <code>VForm</code> et la méthode <code>validateOnSubmit()</code> du champ.
|
|
1275
|
+
</p>
|
|
1276
|
+
<VForm @submit.prevent="handleSubmit">
|
|
1277
|
+
<PasswordField
|
|
1278
|
+
v-bind="args"
|
|
1279
|
+
ref="fieldRef"
|
|
1280
|
+
v-model="password"
|
|
1281
|
+
label="Mot de passe"
|
|
1282
|
+
required
|
|
1283
|
+
:custom-rules="customRules"
|
|
1284
|
+
/>
|
|
1285
|
+
<div class="mt-4">
|
|
1286
|
+
<VBtn type="submit" color="primary">Valider</VBtn>
|
|
1287
|
+
</div>
|
|
1288
|
+
</VForm>
|
|
1289
|
+
</div>
|
|
1290
|
+
`,
|
|
1291
|
+
}),
|
|
1292
|
+
args: {
|
|
1293
|
+
modelValue: '',
|
|
1294
|
+
},
|
|
1295
|
+
}
|