@cnamts/synapse 1.0.6 → 1.0.7
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/{DateFilter-BlOpwEVq.js → DateFilter-CHDLz2EO.js} +1 -1
- package/dist/{NumberFilter-BPUXE4wY.js → NumberFilter-DXNQ4Uls.js} +1 -1
- package/dist/{PeriodFilter-B2yx329_.js → PeriodFilter-C8Qf3Jcn.js} +1 -1
- package/dist/{SelectFilter-CedKn1oV.js → SelectFilter-B2Ejs4Cb.js} +1 -1
- package/dist/{TextFilter-DkhJjRtR.js → TextFilter-CfR5_A1S.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.d.ts +116 -0
- package/dist/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +220 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +68 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.d.ts +204 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +26 -26
- package/dist/components/Amelipro/AmeliproBadge/AmeliproBadge.d.ts +59 -0
- package/dist/components/Amelipro/AmeliproBtn/AmeliproBtn.d.ts +3 -3
- package/dist/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +214 -0
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproCarousel/types.d.ts +7 -0
- package/dist/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.d.ts +125 -0
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproResultList/AmeliproResultList.d.ts +164 -0
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +27 -27
- package/dist/components/Amelipro/AmeliproStateTile/AmeliproStateTile.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +32 -32
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +7 -7
- package/dist/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTooltips/AmeliproTooltips.d.ts +2 -2
- package/dist/components/ChipList/ChipList.d.ts +4 -0
- package/dist/components/ChipList/locales.d.ts +4 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +8 -8
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +445 -8
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +2 -0
- package/dist/components/Customs/SyTabs/SyTabs.d.ts +71 -0
- package/dist/components/Customs/SyTabs/config.d.ts +17 -0
- package/dist/components/Customs/SyTabs/types.d.ts +11 -0
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +9 -9
- package/dist/components/DataList/DataList.d.ts +1 -1
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +4811 -240
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +52 -33
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +23 -10
- package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +1 -0
- package/dist/components/DatePicker/composables/useTodayButton.d.ts +1 -0
- package/dist/components/DialogBox/DialogBox.d.ts +219 -0
- package/dist/components/HeaderLoading/HeaderLoading.d.ts +27 -0
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +110 -3
- package/dist/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.d.ts +19 -1
- package/dist/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/components/NirField/NirField.d.ts +18 -18
- package/dist/components/PeriodField/PeriodField.d.ts +10766 -1620
- package/dist/components/PhoneField/PhoneField.d.ts +1866 -2
- package/dist/components/PhoneField/indicatifs.d.ts +1 -0
- package/dist/components/PhoneField/locales.d.ts +1 -0
- package/dist/components/RangeField/RangeField.d.ts +1 -1
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/SubHeader/SubHeader.d.ts +8 -0
- package/dist/components/SubHeader/locales.d.ts +1 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +6 -6
- 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 +448 -7
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +2 -2
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/design-system-v3.js +173 -164
- package/dist/design-system-v3.umd.cjs +288 -261
- package/dist/{main-BXPFSAB4.js → main-C66C1BkG.js} +12984 -11291
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/amelipro/icons.ts +38 -11
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.stories.ts +135 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.vue +107 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/AmeliproAccordionGroup.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/__snapshots__/AmeliproAccordionGroup.spec.ts.snap +513 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.mdx +16 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +300 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +288 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/AmeliproAccordionList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/__snapshots__/AmeliproAccordionList.spec.ts.snap +1712 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.mdx +19 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +68 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +66 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.vue +145 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/AmeliproAccordionResultTemplate.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/__snapshots__/AmeliproAccordionResultTemplate.spec.ts.snap +127 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/AmeliproAccordionResult.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/__snapshots__/AmeliproAccordionResult.spec.ts.snap +123 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +273 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +275 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/AmeliproAccordionResultList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/__snapshots__/AmeliproAccordionResultList.spec.ts.snap +1593 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.mdx +15 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.stories.ts +54 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.vue +76 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/AmeliproBadge.spec.ts +20 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/__snapshots__/AmeliproBadge.spec.ts.snap +19 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.mdx +15 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.stories.ts +191 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.vue +263 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.vue +93 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/AmeliproCarouselItem.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/__snapshots__/AmeliproCarouselItem.spec.ts.snap +43 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/AmeliproCarousel.spec.ts +40 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/__snapshots__/AmeliproCarousel.spec.ts.snap +342 -0
- package/src/components/Amelipro/AmeliproCarousel/types.d.ts +8 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.mdx +18 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.stories.ts +67 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.vue +233 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/AmeliproClickableTile.spec.ts +21 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/__snapshots__/AmeliproClickableTile.spec.ts.snap +140 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +7 -1
- package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproIcon/iconList.ts +6 -0
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.mdx +15 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.stories.ts +264 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +231 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/AmeliproResultList.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/__snapshots__/AmeliproResultList.spec.ts.snap +434 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +6 -5
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +23 -26
- package/src/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.stories.ts +2 -2
- package/src/components/ChipList/Accessibilite.stories.ts +4 -0
- package/src/components/ChipList/ChipList.vue +185 -42
- package/src/components/ChipList/locales.ts +4 -2
- package/src/components/ChipList/tests/chipList.spec.ts +7 -4
- package/src/components/Customs/Selects/SelectOverview.mdx +18 -15
- package/src/components/Customs/Selects/SyBtnSelect/SyBtnSelect.stories.ts +10 -10
- package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +13 -5
- package/src/components/Customs/Selects/SySelect/SySelect.vue +108 -37
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +3 -1
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +165 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +28 -9
- package/src/components/Customs/SyTabs/Accessibilite.mdx +309 -0
- package/src/components/Customs/SyTabs/SyTabs.mdx +117 -0
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +354 -0
- package/src/components/Customs/SyTabs/SyTabs.vue +350 -0
- package/src/components/Customs/SyTabs/config.ts +17 -0
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +425 -0
- package/src/components/Customs/SyTabs/types.ts +12 -0
- package/src/components/Customs/SyTextField/SyTextField.mdx +3 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +142 -1
- package/src/components/Customs/SyTextField/SyTextField.vue +19 -16
- package/src/components/DataList/DataList.vue +47 -49
- package/src/components/DataListGroup/DataListGroup.vue +1 -1
- package/src/components/DataListItem/DataListItem.vue +67 -63
- package/src/components/DataListItem/tests/DataListItem.spec.ts +2 -2
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +3 -3
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +49 -13
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +412 -649
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +215 -0
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.mdx +2 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +1 -1
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +281 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +17 -4
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +111 -18
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +238 -6
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +716 -757
- package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +4 -4
- package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +17 -10
- package/src/components/DatePicker/composables/useDateInputEditing.ts +52 -22
- package/src/components/DatePicker/composables/useDisplayedDateString.ts +18 -4
- package/src/components/DatePicker/composables/useTodayButton.ts +13 -1
- package/src/components/DatePicker/utils/dateFormattingUtils.ts +79 -14
- package/src/components/DialogBox/DialogBox.stories.ts +12 -0
- package/src/components/DialogBox/DialogBox.vue +16 -11
- package/src/components/DialogBox/tests/DialogBox.spec.ts +22 -0
- package/src/components/HeaderLoading/Accessibilite.mdx +429 -8
- package/src/components/HeaderLoading/Accessibilite.stories.ts +4 -0
- package/src/components/HeaderLoading/HeaderLoading.vue +59 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +17 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +91 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +37 -1
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +276 -21
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +2 -2
- package/src/components/NirField/NirField.mdx +3 -0
- package/src/components/NirField/NirField.vue +10 -1
- package/src/components/NirField/tests/NirField.spec.ts +81 -0
- package/src/components/PasswordField/PasswordField.mdx +3 -0
- package/src/components/PeriodField/PeriodField.mdx +2 -0
- package/src/components/PeriodField/PeriodField.stories.ts +195 -0
- package/src/components/PhoneField/Accessibilite.stories.ts +4 -0
- package/src/components/PhoneField/PhoneField.mdx +3 -1
- package/src/components/PhoneField/PhoneField.stories.ts +285 -1
- package/src/components/PhoneField/PhoneField.vue +228 -95
- package/src/components/PhoneField/indicatifs.ts +102 -102
- package/src/components/PhoneField/locales.ts +1 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +429 -2
- package/src/components/SkipLink/SkipLink.vue +3 -31
- package/src/components/SkipLink/tests/skipLink.spec.ts +0 -21
- package/src/components/SubHeader/Accessibilite.stories.ts +8 -0
- package/src/components/SubHeader/SubHeader.mdx +1 -0
- package/src/components/SubHeader/SubHeader.stories.ts +179 -60
- package/src/components/SubHeader/SubHeader.vue +45 -15
- package/src/components/SubHeader/locales.ts +1 -0
- package/src/components/SyAlert/SyAlert.vue +6 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +3 -10
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +242 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +29 -10
- package/src/components/Tables/SyTable/SyTable.mdx +3 -10
- package/src/components/Tables/SyTable/SyTable.stories.ts +242 -0
- package/src/components/Tables/SyTable/SyTable.vue +2 -0
- package/src/components/Tables/common/SyTablePagination.vue +13 -6
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +157 -0
- package/src/components/Tables/common/types.ts +2 -0
- package/src/components/index.ts +9 -0
- package/src/composables/useFilterable/useFilterable.ts +10 -0
- package/src/designTokens/tokens/amelipro/apColors.ts +1 -1
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +3 -3
- package/src/stories/Components/Components.stories.ts +1 -1
- package/src/stories/GuideDuDev/FormValidationGuide.mdx +342 -0
- package/src/stories/Templates/Templates.stories.ts +1 -1
- package/src/utils/functions/ameliproColors/ameliproColors.ts +1 -1
- package/dist/components/DataList/locales.d.ts +0 -3
- package/src/components/DataList/locales.ts +0 -3
- package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +0 -266
|
@@ -2,6 +2,17 @@ import type { Meta, StoryObj } from '@storybook/vue3'
|
|
|
2
2
|
import PeriodField from './PeriodField.vue'
|
|
3
3
|
import { ref } from 'vue'
|
|
4
4
|
|
|
5
|
+
// Type pour les méthodes exposées par PeriodField
|
|
6
|
+
type ValidationMessage = { type: string, message: string }[]
|
|
7
|
+
|
|
8
|
+
interface PeriodFieldExpose {
|
|
9
|
+
validateOnSubmit: () => boolean
|
|
10
|
+
errors: Record<string, ValidationMessage>
|
|
11
|
+
successes: Record<string, ValidationMessage>
|
|
12
|
+
warnings: Record<string, ValidationMessage>
|
|
13
|
+
isValid: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
const meta: Meta<typeof PeriodField> = {
|
|
6
17
|
title: 'Composants/Formulaires/PeriodField',
|
|
7
18
|
component: PeriodField,
|
|
@@ -901,3 +912,187 @@ const periodNoValidation = ref({ from: null, to: null })
|
|
|
901
912
|
`,
|
|
902
913
|
}),
|
|
903
914
|
}
|
|
915
|
+
|
|
916
|
+
export const FormValidation: Story = {
|
|
917
|
+
parameters: {
|
|
918
|
+
sourceCode: [
|
|
919
|
+
{
|
|
920
|
+
name: 'Template',
|
|
921
|
+
code: `
|
|
922
|
+
<template>
|
|
923
|
+
<v-form @submit.prevent="submitForm" ref="formRef">
|
|
924
|
+
<v-container>
|
|
925
|
+
<v-row>
|
|
926
|
+
<v-col cols="12">
|
|
927
|
+
<h3>Formulaire avec validation</h3>
|
|
928
|
+
</v-col>
|
|
929
|
+
<v-col cols="12" md="6">
|
|
930
|
+
<PeriodField
|
|
931
|
+
v-model="form.period"
|
|
932
|
+
ref="periodFieldRef"
|
|
933
|
+
required
|
|
934
|
+
:custom-rules="periodRules"
|
|
935
|
+
placeholder-from="Début de l'événement"
|
|
936
|
+
placeholder-to="Fin de l'événement"
|
|
937
|
+
/>
|
|
938
|
+
</v-col>
|
|
939
|
+
<v-col cols="12">
|
|
940
|
+
<v-btn type="submit" color="primary" :disabled="isSubmitting">Valider</v-btn>
|
|
941
|
+
</v-col>
|
|
942
|
+
</v-row>
|
|
943
|
+
|
|
944
|
+
<v-row v-if="isFormSubmitted">
|
|
945
|
+
<v-col cols="12">
|
|
946
|
+
<v-alert
|
|
947
|
+
type="success"
|
|
948
|
+
class="mt-4"
|
|
949
|
+
>
|
|
950
|
+
Formulaire envoyé avec succès !
|
|
951
|
+
</v-alert>
|
|
952
|
+
<pre>{{ formData }}</pre>
|
|
953
|
+
</v-col>
|
|
954
|
+
</v-row>
|
|
955
|
+
</v-container>
|
|
956
|
+
</v-form>
|
|
957
|
+
</template>
|
|
958
|
+
`,
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
name: 'Script',
|
|
962
|
+
code: `
|
|
963
|
+
<script setup lang="ts">
|
|
964
|
+
import { ref } from 'vue'
|
|
965
|
+
import { PeriodField } from '@cnamts/synapse'
|
|
966
|
+
|
|
967
|
+
// Référence au formulaire
|
|
968
|
+
const formRef = ref(null)
|
|
969
|
+
const isSubmitting = ref(false)
|
|
970
|
+
const isFormSubmitted = ref(false)
|
|
971
|
+
const formData = ref(null)
|
|
972
|
+
|
|
973
|
+
// Données du formulaire
|
|
974
|
+
const form = {
|
|
975
|
+
name: '',
|
|
976
|
+
period: { from: null, to: null }
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// Règles de validation pour le champ période
|
|
980
|
+
const periodRules = [
|
|
981
|
+
{
|
|
982
|
+
type: 'custom',
|
|
983
|
+
options: {
|
|
984
|
+
validator: (value) => {
|
|
985
|
+
if (!value.from || !value.to) return 'Les deux dates sont obligatoires'
|
|
986
|
+
return true
|
|
987
|
+
},
|
|
988
|
+
successMessage: 'Période valide'
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
type: 'notAfterToday',
|
|
993
|
+
options: { message: "La date ne peut pas être après aujourd'hui" }
|
|
994
|
+
}
|
|
995
|
+
]
|
|
996
|
+
|
|
997
|
+
// Soumission du formulaire
|
|
998
|
+
const submitForm = () => {
|
|
999
|
+
if (periodFieldRef.value) {
|
|
1000
|
+
const isValid = periodFieldRef.value.validateOnSubmit()
|
|
1001
|
+
if (isValid) {
|
|
1002
|
+
formStatus.value = 'Formulaire soumis avec succès !'
|
|
1003
|
+
isFormSubmitted.value = true
|
|
1004
|
+
formData.value = JSON.stringify(form.value)
|
|
1005
|
+
}
|
|
1006
|
+
else {
|
|
1007
|
+
formStatus.value = 'Erreur de validation, veuillez corriger les champs'
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
</script>
|
|
1012
|
+
`,
|
|
1013
|
+
},
|
|
1014
|
+
],
|
|
1015
|
+
},
|
|
1016
|
+
render: () => ({
|
|
1017
|
+
components: { PeriodField },
|
|
1018
|
+
setup() {
|
|
1019
|
+
// Référence au formulaire
|
|
1020
|
+
const formRef = ref(null)
|
|
1021
|
+
const periodFieldRef = ref<PeriodFieldExpose | null>(null)
|
|
1022
|
+
const isSubmitting = ref(false)
|
|
1023
|
+
const isFormSubmitted = ref(false)
|
|
1024
|
+
const formData = ref<string | null>(null)
|
|
1025
|
+
const formStatus = ref('')
|
|
1026
|
+
|
|
1027
|
+
// Données du formulaire
|
|
1028
|
+
const form = ref({
|
|
1029
|
+
period: { from: null, to: null },
|
|
1030
|
+
})
|
|
1031
|
+
|
|
1032
|
+
// Règles de validation pour le champ période
|
|
1033
|
+
const periodRules = [
|
|
1034
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourdhui' } },
|
|
1035
|
+
]
|
|
1036
|
+
|
|
1037
|
+
// Soumission du formulaire
|
|
1038
|
+
const submitForm = () => {
|
|
1039
|
+
if (periodFieldRef.value) {
|
|
1040
|
+
const isValid = periodFieldRef.value.validateOnSubmit()
|
|
1041
|
+
if (isValid) {
|
|
1042
|
+
formStatus.value = 'Formulaire soumis avec succès !'
|
|
1043
|
+
isFormSubmitted.value = true
|
|
1044
|
+
formData.value = JSON.stringify(form.value)
|
|
1045
|
+
}
|
|
1046
|
+
else {
|
|
1047
|
+
formStatus.value = 'Erreur de validation, veuillez corriger les champs'
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
return {
|
|
1053
|
+
formRef,
|
|
1054
|
+
periodFieldRef,
|
|
1055
|
+
isSubmitting,
|
|
1056
|
+
isFormSubmitted,
|
|
1057
|
+
formData,
|
|
1058
|
+
form,
|
|
1059
|
+
periodRules,
|
|
1060
|
+
formStatus,
|
|
1061
|
+
submitForm,
|
|
1062
|
+
}
|
|
1063
|
+
},
|
|
1064
|
+
template: `
|
|
1065
|
+
<div class="pa-4">
|
|
1066
|
+
<v-form @submit.prevent="submitForm" ref="formRef">
|
|
1067
|
+
<v-container>
|
|
1068
|
+
<v-row>
|
|
1069
|
+
<v-col cols="12">
|
|
1070
|
+
<h3>Formulaire avec validation</h3>
|
|
1071
|
+
</v-col>
|
|
1072
|
+
<v-col cols="12" md="6">
|
|
1073
|
+
<PeriodField
|
|
1074
|
+
v-model="form.period"
|
|
1075
|
+
ref="periodFieldRef"
|
|
1076
|
+
required
|
|
1077
|
+
:custom-rules="periodRules"
|
|
1078
|
+
placeholder-from="Début de l'événement"
|
|
1079
|
+
placeholder-to="Fin de l'événement"
|
|
1080
|
+
/>
|
|
1081
|
+
</v-col>
|
|
1082
|
+
<v-col cols="12">
|
|
1083
|
+
<v-btn type="submit" color="primary" :disabled="isSubmitting">Valider</v-btn>
|
|
1084
|
+
</v-col>
|
|
1085
|
+
</v-row>
|
|
1086
|
+
|
|
1087
|
+
<v-row v-if="formStatus">
|
|
1088
|
+
<v-col cols="12">
|
|
1089
|
+
{{ formStatus }}
|
|
1090
|
+
<pre v-if="formData">{{ formData }}</pre>
|
|
1091
|
+
</v-col>
|
|
1092
|
+
</v-row>
|
|
1093
|
+
</v-container>
|
|
1094
|
+
</v-form>
|
|
1095
|
+
</div>
|
|
1096
|
+
`,
|
|
1097
|
+
}),
|
|
1098
|
+
}
|
|
@@ -208,6 +208,10 @@ export const Legende: StoryObj = {
|
|
|
208
208
|
Problèmes relevés par Tanaguru
|
|
209
209
|
</div>
|
|
210
210
|
</div>
|
|
211
|
+
<div class="mt-4">
|
|
212
|
+
<p>Rapport d’audit manuel : <a href="/audits/PhoneField.xlsx" style="color:#0C41BD;">Voir le rapport</a></p>
|
|
213
|
+
<p style="color: grey; font-size: 14px">Correctifs associés (<a href="https://github.com/assurance-maladie-digital/design-system-v3/issues/797" target="_blank" style="color:#0C41BD;">issue #797</a>)</p>
|
|
214
|
+
</div>
|
|
211
215
|
</div>
|
|
212
216
|
`,
|
|
213
217
|
}
|
|
@@ -44,4 +44,6 @@ const customIndicatifs = ref([
|
|
|
44
44
|
@change="handleChange"
|
|
45
45
|
/>
|
|
46
46
|
</template>
|
|
47
|
-
`} />
|
|
47
|
+
`} />
|
|
48
|
+
|
|
49
|
+
<a href="/?path=/docs/guide-du-dev-guide-de-validation-des-formulaires--docs" className="action-link">Pour plus d'informations sur la validation, consultez le guide de validation des formulaires.</a>
|
|
@@ -31,6 +31,18 @@ const meta = {
|
|
|
31
31
|
control: 'boolean',
|
|
32
32
|
description: 'Permet d\'utiliser uniquement les indicatifs que vous renseignez dans la props customIndicatifs',
|
|
33
33
|
},
|
|
34
|
+
helpText: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Texte d\'aide affiché sous le champ. Lorsque présent, les messages d\'erreur incluent un exemple concret distinct du texte d\'aide.',
|
|
37
|
+
},
|
|
38
|
+
autocompleteCountryCode: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'Valeur de l\'attribut autocomplete pour le champ indicatif pays (par défaut: "tel-country-code")',
|
|
41
|
+
},
|
|
42
|
+
autocompletePhone: {
|
|
43
|
+
control: 'text',
|
|
44
|
+
description: 'Valeur de l\'attribut autocomplete pour le champ numéro de téléphone (par défaut: "tel-national")',
|
|
45
|
+
},
|
|
34
46
|
isValidatedOnBlur: { control: 'boolean' },
|
|
35
47
|
displayAsterisk: { control: 'boolean' },
|
|
36
48
|
disableErrorHandling: { control: 'boolean' },
|
|
@@ -104,7 +116,7 @@ export const Default: Story = {
|
|
|
104
116
|
return { args }
|
|
105
117
|
},
|
|
106
118
|
template: `
|
|
107
|
-
<div class="
|
|
119
|
+
<div class="pa-4">
|
|
108
120
|
<PhoneField
|
|
109
121
|
v-model="args.modelValue"
|
|
110
122
|
:required="args.required"
|
|
@@ -282,6 +294,278 @@ const phoneNumber = ref('')
|
|
|
282
294
|
},
|
|
283
295
|
}
|
|
284
296
|
|
|
297
|
+
export const HelpText: Story = {
|
|
298
|
+
parameters: {
|
|
299
|
+
sourceCode: [
|
|
300
|
+
{
|
|
301
|
+
name: 'Template',
|
|
302
|
+
code: `<template>
|
|
303
|
+
<div class="pa-4">
|
|
304
|
+
<div class="mb-6">
|
|
305
|
+
<h4 class="mb-2">Avec aide à la saisie</h4>
|
|
306
|
+
<PhoneField
|
|
307
|
+
v-model="phoneValue1"
|
|
308
|
+
required
|
|
309
|
+
help-text="Saisissez votre numéro de téléphone au format 01 23 45 67 89"
|
|
310
|
+
label="Numéro de téléphone"
|
|
311
|
+
/>
|
|
312
|
+
<p class="text-caption mt-2">
|
|
313
|
+
Essayez de laisser le champ vide ou de saisir un numéro incorrect pour voir
|
|
314
|
+
l'exemple dans le message d'erreur (différent de l'aide).
|
|
315
|
+
</p>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
<div class="mb-6">
|
|
319
|
+
<h4 class="mb-2">Avec aide à la saisie et indicatif pays</h4>
|
|
320
|
+
<PhoneField
|
|
321
|
+
v-model="phoneValue2"
|
|
322
|
+
v-model:selected-dial-code="selectedDialCode"
|
|
323
|
+
required
|
|
324
|
+
with-country-code
|
|
325
|
+
help-text="Choisissez votre pays et saisissez votre numéro de téléphone"
|
|
326
|
+
label="Numéro de téléphone international"
|
|
327
|
+
/>
|
|
328
|
+
<p class="text-caption mt-2">
|
|
329
|
+
L'exemple dans le message d'erreur s'adapte au format du pays sélectionné.
|
|
330
|
+
</p>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<div class="mt-4">
|
|
334
|
+
<h4>Valeurs actuelles :</h4>
|
|
335
|
+
<pre class="text-caption">phoneValue1: {{ phoneValue1 }}</pre>
|
|
336
|
+
<pre class="text-caption">phoneValue2: {{ phoneValue2 }}</pre>
|
|
337
|
+
<pre class="text-caption">selectedDialCode: {{ selectedDialCode }}</pre>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
</template>`,
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: 'Script',
|
|
344
|
+
code: `<script setup lang="ts">
|
|
345
|
+
import { ref } from 'vue'
|
|
346
|
+
import PhoneField from './PhoneField.vue'
|
|
347
|
+
|
|
348
|
+
const phoneValue1 = ref('')
|
|
349
|
+
const phoneValue2 = ref('')
|
|
350
|
+
const selectedDialCode = ref('')
|
|
351
|
+
</script>`,
|
|
352
|
+
},
|
|
353
|
+
],
|
|
354
|
+
},
|
|
355
|
+
args: {
|
|
356
|
+
required: true,
|
|
357
|
+
helpText: 'Saisissez votre numéro de téléphone français au format 01 23 45 67 89',
|
|
358
|
+
},
|
|
359
|
+
render(args) {
|
|
360
|
+
return {
|
|
361
|
+
components: { PhoneField },
|
|
362
|
+
setup() {
|
|
363
|
+
const phoneValue1 = ref('')
|
|
364
|
+
const phoneValue2 = ref('')
|
|
365
|
+
const selectedDialCode = ref('')
|
|
366
|
+
|
|
367
|
+
return {
|
|
368
|
+
args,
|
|
369
|
+
phoneValue1,
|
|
370
|
+
phoneValue2,
|
|
371
|
+
selectedDialCode,
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
template: `
|
|
375
|
+
<div class="pa-4">
|
|
376
|
+
<div class="mb-6">
|
|
377
|
+
<h4 class="mb-2">Avec aide à la saisie</h4>
|
|
378
|
+
<PhoneField
|
|
379
|
+
v-model="phoneValue1"
|
|
380
|
+
required
|
|
381
|
+
help-text="Saisissez votre numéro de téléphone au format 01 23 45 67 89"
|
|
382
|
+
label="Numéro de téléphone"
|
|
383
|
+
/>
|
|
384
|
+
<p class="text-caption mt-2">
|
|
385
|
+
Essayez de laisser le champ vide ou de saisir un numéro incorrect pour voir
|
|
386
|
+
l'exemple dans le message d'erreur (différent de l'aide).
|
|
387
|
+
</p>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
<div class="mb-6">
|
|
391
|
+
<h4 class="mb-2">Avec aide à la saisie et indicatif pays</h4>
|
|
392
|
+
<PhoneField
|
|
393
|
+
v-model="phoneValue2"
|
|
394
|
+
v-model:selected-dial-code="selectedDialCode"
|
|
395
|
+
required
|
|
396
|
+
with-country-code
|
|
397
|
+
help-text="Choisissez votre pays et saisissez votre numéro de téléphone"
|
|
398
|
+
label="Numéro de téléphone international"
|
|
399
|
+
/>
|
|
400
|
+
<p class="text-caption mt-2">
|
|
401
|
+
L'exemple dans le message d'erreur s'adapte au format du pays sélectionné.
|
|
402
|
+
</p>
|
|
403
|
+
</div>
|
|
404
|
+
|
|
405
|
+
<div class="mt-4">
|
|
406
|
+
<h4>Valeurs actuelles :</h4>
|
|
407
|
+
<pre class="text-caption">phoneValue1: {{ phoneValue1 }}</pre>
|
|
408
|
+
<pre class="text-caption">phoneValue2: {{ phoneValue2 }}</pre>
|
|
409
|
+
<pre class="text-caption">selectedDialCode: {{ selectedDialCode }}</pre>
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
`,
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export const Autocomplete: Story = {
|
|
418
|
+
parameters: {
|
|
419
|
+
sourceCode: [
|
|
420
|
+
{
|
|
421
|
+
name: 'Template',
|
|
422
|
+
code: `<template>
|
|
423
|
+
<div class="pa-4">
|
|
424
|
+
<p class="mb-4">
|
|
425
|
+
Les attributs <code>autocomplete</code> permettent aux navigateurs de remplir automatiquement
|
|
426
|
+
les champs avec les bonnes informations utilisateur.
|
|
427
|
+
</p>
|
|
428
|
+
|
|
429
|
+
<div class="mb-6">
|
|
430
|
+
<h4 class="mb-2">Avec indicatif pays (autocomplete="tel-country-code")</h4>
|
|
431
|
+
<PhoneField
|
|
432
|
+
v-model="phoneValue1"
|
|
433
|
+
v-model:selected-dial-code="selectedDialCode1"
|
|
434
|
+
required
|
|
435
|
+
with-country-code
|
|
436
|
+
autocomplete-country-code="tel-country-code"
|
|
437
|
+
autocomplete-phone="tel-national"
|
|
438
|
+
help-text="L'indicatif utilise tel-country-code, le numéro utilise tel-national"
|
|
439
|
+
label="Numéro de téléphone avec indicatif"
|
|
440
|
+
/>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
<div class="mb-6">
|
|
444
|
+
<h4 class="mb-2">Numéro complet (autocomplete="tel")</h4>
|
|
445
|
+
<PhoneField
|
|
446
|
+
v-model="phoneValue2"
|
|
447
|
+
required
|
|
448
|
+
autocomplete-phone="tel"
|
|
449
|
+
help-text="Pour un numéro complet avec indicatif intégré"
|
|
450
|
+
label="Numéro de téléphone complet"
|
|
451
|
+
/>
|
|
452
|
+
</div>
|
|
453
|
+
|
|
454
|
+
<div class="mb-6">
|
|
455
|
+
<h4 class="mb-2">Extension téléphonique (autocomplete="tel-extension")</h4>
|
|
456
|
+
<PhoneField
|
|
457
|
+
v-model="phoneValue3"
|
|
458
|
+
required
|
|
459
|
+
autocomplete-phone="tel-extension"
|
|
460
|
+
help-text="Pour les extensions ou postes téléphoniques"
|
|
461
|
+
label="Extension téléphonique"
|
|
462
|
+
/>
|
|
463
|
+
</div>
|
|
464
|
+
|
|
465
|
+
<div class="mt-4">
|
|
466
|
+
<h4>Valeurs actuelles :</h4>
|
|
467
|
+
<pre class="text-caption">phoneValue1: {{ phoneValue1 }}</pre>
|
|
468
|
+
<pre class="text-caption">selectedDialCode1: {{ selectedDialCode1 }}</pre>
|
|
469
|
+
<pre class="text-caption">phoneValue2: {{ phoneValue2 }}</pre>
|
|
470
|
+
<pre class="text-caption">phoneValue3: {{ phoneValue3 }}</pre>
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
</template>`,
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
name: 'Script',
|
|
477
|
+
code: `<script setup lang="ts">
|
|
478
|
+
import { ref } from 'vue'
|
|
479
|
+
import PhoneField from './PhoneField.vue'
|
|
480
|
+
|
|
481
|
+
const phoneValue1 = ref('')
|
|
482
|
+
const selectedDialCode1 = ref('')
|
|
483
|
+
const phoneValue2 = ref('')
|
|
484
|
+
const phoneValue3 = ref('')
|
|
485
|
+
</script>`,
|
|
486
|
+
},
|
|
487
|
+
],
|
|
488
|
+
},
|
|
489
|
+
args: {
|
|
490
|
+
required: true,
|
|
491
|
+
withCountryCode: true,
|
|
492
|
+
autocompleteCountryCode: 'tel-country-code',
|
|
493
|
+
autocompletePhone: 'tel-national',
|
|
494
|
+
helpText: 'Utilisez les valeurs autocomplete appropriées pour l\'accessibilité',
|
|
495
|
+
},
|
|
496
|
+
render(args) {
|
|
497
|
+
return {
|
|
498
|
+
components: { PhoneField },
|
|
499
|
+
setup() {
|
|
500
|
+
const phoneValue1 = ref('')
|
|
501
|
+
const selectedDialCode1 = ref('')
|
|
502
|
+
const phoneValue2 = ref('')
|
|
503
|
+
const phoneValue3 = ref('')
|
|
504
|
+
|
|
505
|
+
return {
|
|
506
|
+
args,
|
|
507
|
+
phoneValue1,
|
|
508
|
+
selectedDialCode1,
|
|
509
|
+
phoneValue2,
|
|
510
|
+
phoneValue3,
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
template: `
|
|
514
|
+
<div class="pa-4">
|
|
515
|
+
<p class="mb-4">
|
|
516
|
+
Les attributs <code>autocomplete</code> permettent aux navigateurs de remplir automatiquement
|
|
517
|
+
les champs avec les bonnes informations utilisateur.
|
|
518
|
+
</p>
|
|
519
|
+
|
|
520
|
+
<div class="mb-6">
|
|
521
|
+
<h4 class="mb-2">Avec indicatif pays (autocomplete="tel-country-code")</h4>
|
|
522
|
+
<PhoneField
|
|
523
|
+
v-model="phoneValue1"
|
|
524
|
+
v-model:selected-dial-code="selectedDialCode1"
|
|
525
|
+
required
|
|
526
|
+
with-country-code
|
|
527
|
+
autocomplete-country-code="tel-country-code"
|
|
528
|
+
autocomplete-phone="tel-national"
|
|
529
|
+
help-text="L'indicatif utilise tel-country-code, le numéro utilise tel-national"
|
|
530
|
+
label="Numéro de téléphone avec indicatif"
|
|
531
|
+
/>
|
|
532
|
+
</div>
|
|
533
|
+
|
|
534
|
+
<div class="mb-6">
|
|
535
|
+
<h4 class="mb-2">Numéro complet (autocomplete="tel")</h4>
|
|
536
|
+
<PhoneField
|
|
537
|
+
v-model="phoneValue2"
|
|
538
|
+
required
|
|
539
|
+
autocomplete-phone="tel"
|
|
540
|
+
help-text="Pour un numéro complet avec indicatif intégré"
|
|
541
|
+
label="Numéro de téléphone complet"
|
|
542
|
+
/>
|
|
543
|
+
</div>
|
|
544
|
+
|
|
545
|
+
<div class="mb-6">
|
|
546
|
+
<h4 class="mb-2">Extension téléphonique (autocomplete="tel-extension")</h4>
|
|
547
|
+
<PhoneField
|
|
548
|
+
v-model="phoneValue3"
|
|
549
|
+
required
|
|
550
|
+
autocomplete-phone="tel-extension"
|
|
551
|
+
help-text="Pour les extensions ou postes téléphoniques"
|
|
552
|
+
label="Extension téléphonique"
|
|
553
|
+
/>
|
|
554
|
+
</div>
|
|
555
|
+
|
|
556
|
+
<div class="mt-4">
|
|
557
|
+
<h4>Valeurs actuelles :</h4>
|
|
558
|
+
<pre class="text-caption">phoneValue1: {{ phoneValue1 }}</pre>
|
|
559
|
+
<pre class="text-caption">selectedDialCode1: {{ selectedDialCode1 }}</pre>
|
|
560
|
+
<pre class="text-caption">phoneValue2: {{ phoneValue2 }}</pre>
|
|
561
|
+
<pre class="text-caption">phoneValue3: {{ phoneValue3 }}</pre>
|
|
562
|
+
</div>
|
|
563
|
+
</div>
|
|
564
|
+
`,
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
}
|
|
568
|
+
|
|
285
569
|
export const CustomIndicatifs: Story = {
|
|
286
570
|
parameters: {
|
|
287
571
|
sourceCode: [
|