@cnamts/synapse 1.1.0 → 1.1.1

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.
Files changed (202) hide show
  1. package/dist/{AutocompleteFilter-DXd4szWO.js → AutocompleteFilter-CGF33skz.js} +1 -1
  2. package/dist/{DateFilter-BD59Kgwf.js → DateFilter-D7-MsKtx.js} +1 -1
  3. package/dist/{NumberFilter-BSMZE7uw.js → NumberFilter-bjQPPfsj.js} +1 -1
  4. package/dist/{PeriodFilter-keUdSSk0.js → PeriodFilter-B3wJpK8-.js} +1 -1
  5. package/dist/{SelectFilter-Dhvvwazl.js → SelectFilter-BN6DbKAV.js} +1 -1
  6. package/dist/{TextFilter-CU8FpXz0.js → TextFilter-BffP0J2f.js} +1 -1
  7. package/dist/{apLightTheme2026-DbS7BPUf.js → apLightTheme2026-C4ygwMHC.js} +11 -11
  8. package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +6 -6
  9. package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +6 -6
  10. package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +6 -6
  11. package/dist/components/Captcha/Captcha.d.ts +27 -16
  12. package/dist/components/Captcha/CaptchaForm.d.ts +29 -3
  13. package/dist/components/Captcha/types.d.ts +14 -0
  14. package/dist/components/Captcha/useCaptchaValidation.d.ts +37 -0
  15. package/dist/components/Customs/Selects/SelectBtnField/SelectBtnField.d.ts +33 -13
  16. package/dist/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.d.ts +23 -0
  17. package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +2 -2
  18. package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +2 -2
  19. package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +17 -48
  20. package/dist/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.d.ts +29 -0
  21. package/dist/components/Customs/SyCheckBoxGroup/types.d.ts +46 -0
  22. package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +16 -51
  23. package/dist/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.d.ts +27 -0
  24. package/dist/components/Customs/SyCheckbox/types.d.ts +49 -0
  25. package/dist/components/Customs/SyTextField/FieldState.d.ts +5 -0
  26. package/dist/components/Customs/SyTextField/useSyTextFieldValidation.d.ts +3 -3
  27. package/dist/components/DialogBox/DialogBox.d.ts +2 -0
  28. package/dist/components/DialogBox/locales.d.ts +1 -0
  29. package/dist/components/FilterSideBar/FilterSideBar.d.ts +4 -0
  30. package/dist/components/LunarCalendar/LunarCalendar.d.ts +43 -14
  31. package/dist/components/LunarCalendar/types.d.ts +35 -0
  32. package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +11 -12
  33. package/dist/components/MonthPicker/MonthPicker.d.ts +72 -1747
  34. package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +21 -1733
  35. package/dist/components/MonthPicker/MonthPickerText/useTextField.d.ts +5 -0
  36. package/dist/components/MonthPicker/locales.d.ts +1 -0
  37. package/dist/components/MonthPicker/types.d.ts +11 -0
  38. package/dist/components/MonthPicker/useMonthPickerValidation.d.ts +37 -24
  39. package/dist/components/NirField/NirField.d.ts +6 -4
  40. package/dist/components/NirField/useNirValidation.d.ts +7 -5
  41. package/dist/components/PageContainer/PageContainer.d.ts +8 -0
  42. package/dist/components/PasswordField/PasswordField.d.ts +2 -2
  43. package/dist/components/PasswordField/usePasswordFieldValidation.d.ts +2 -2
  44. package/dist/components/PhoneField/PhoneField.d.ts +960 -1938
  45. package/dist/components/PhoneField/indicatifs.d.ts +715 -8
  46. package/dist/components/PhoneField/locales.d.ts +7 -0
  47. package/dist/components/PhoneField/types.d.ts +29 -0
  48. package/dist/components/PhoneField/usePhoneFieldValidation.d.ts +45 -0
  49. package/dist/components/PhoneField/usePhoneIndicatifs.d.ts +947 -0
  50. package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +2 -2
  51. package/dist/composables/unifyValidation/documentationValidationProps.d.ts +1 -1
  52. package/dist/composables/unifyValidation/useValidation.d.ts +4 -5
  53. package/dist/design-system-v3.js +2 -2
  54. package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +10 -10
  55. package/dist/designTokens/tokens/baseTokens.d.ts +18 -18
  56. package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +10 -10
  57. package/dist/designTokens/tokens/pa/paLightTheme.d.ts +10 -10
  58. package/dist/designTokens/tokens/semanticTokens.d.ts +14 -14
  59. package/dist/{main-D8ryUoS5.js → main-C4wAktOs.js} +13718 -12991
  60. package/dist/synapse.css +1 -1
  61. package/dist/vuetifyConfig.js +1 -1
  62. package/package.json +7 -7
  63. package/src/assets/compat/_legacy-tokens.scss +91 -0
  64. package/src/assets/overrides/_utilities.scss +23 -0
  65. package/src/components/Accordion/Accordion.stories.ts +121 -1
  66. package/src/components/BackBtn/BackBtn.mdx +1 -1
  67. package/src/components/BackToTopBtn/BackToTopBtn.mdx +0 -1
  68. package/src/components/Captcha/Captcha.stories.ts +134 -31
  69. package/src/components/Captcha/Captcha.vue +95 -28
  70. package/src/components/Captcha/CaptchaForm.vue +51 -22
  71. package/src/components/Captcha/tests/Captcha.focus.spec.ts +214 -0
  72. package/src/components/Captcha/tests/Captcha.spec.ts +233 -24
  73. package/src/components/Captcha/tests/CaptchaForm.spec.ts +82 -0
  74. package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +16 -42
  75. package/src/components/Captcha/types.ts +15 -0
  76. package/src/components/Captcha/useCaptchaValidation.ts +87 -0
  77. package/src/components/Captcha/validation/validation.stories.ts +1194 -0
  78. package/src/components/ChipList/ChipList.mdx +0 -1
  79. package/src/components/CollapsibleList/CollapsibleList.mdx +0 -1
  80. package/src/components/CookieBanner/CookieBanner.mdx +0 -1
  81. package/src/components/CopyBtn/CopyBtn.mdx +0 -1
  82. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +123 -439
  83. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +147 -41
  84. package/src/components/Customs/Selects/SelectBtnField/Validation/Validation.stories.ts +600 -0
  85. package/src/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.ts +87 -0
  86. package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +402 -33
  87. package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/SelectBtnField.spec.ts.snap +52 -38
  88. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +342 -162
  89. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +77 -129
  90. package/src/components/Customs/SyCheckBoxGroup/Validation/Validation.stories.ts +1008 -0
  91. package/src/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.ts +107 -0
  92. package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.spec.ts +180 -7
  93. package/src/components/Customs/SyCheckBoxGroup/types.ts +49 -0
  94. package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +41 -161
  95. package/src/components/Customs/SyCheckbox/SyCheckbox.vue +71 -148
  96. package/src/components/Customs/SyCheckbox/Validation/Validation.stories.ts +654 -0
  97. package/src/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.ts +105 -0
  98. package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +106 -0
  99. package/src/components/Customs/SyCheckbox/tests/useSyCheckboxValidation.spec.ts +98 -0
  100. package/src/components/Customs/SyCheckbox/types.ts +51 -0
  101. package/src/components/Customs/SyTextField/FieldState.vue +50 -0
  102. package/src/components/Customs/SyTextField/SyTextField.vue +12 -9
  103. package/src/components/Customs/SyTextField/useSyTextFieldValidation.ts +2 -11
  104. package/src/components/DataList/DataList.mdx +0 -1
  105. package/src/components/DataListGroup/DataListGroup.mdx +0 -1
  106. package/src/components/DiacriticPicker/DiacriticPicker.mdx +0 -1
  107. package/src/components/DialogBox/DialogBox.mdx +0 -1
  108. package/src/components/DialogBox/DialogBox.stories.ts +399 -4
  109. package/src/components/DialogBox/DialogBox.vue +20 -0
  110. package/src/components/DialogBox/locales.ts +1 -0
  111. package/src/components/DialogBox/tests/DialogBox.spec.ts +73 -0
  112. package/src/components/DialogBox/tests/DialogBox.visual.cy.ts +24 -0
  113. package/src/components/ErrorPage/ErrorPage.mdx +1 -1
  114. package/src/components/ExternalLinks/ExternalLinks.mdx +0 -1
  115. package/src/components/FileList/FileList.mdx +0 -1
  116. package/src/components/FilterInline/FilterInline.mdx +0 -1
  117. package/src/components/FilterSideBar/FilterSideBar.mdx +8 -1
  118. package/src/components/FilterSideBar/FilterSideBar.stories.ts +133 -1
  119. package/src/components/FilterSideBar/FilterSideBar.vue +19 -2
  120. package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +55 -0
  121. package/src/components/FooterBar/FooterBar.mdx +0 -1
  122. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +0 -1
  123. package/src/components/HeaderBar/HeaderBar.mdx +0 -1
  124. package/src/components/HeaderLoading/HeaderLoading.mdx +0 -1
  125. package/src/components/LangBtn/LangBtn.mdx +0 -1
  126. package/src/components/Logo/Logo.mdx +1 -1
  127. package/src/components/LunarCalendar/LunarCalendar.mdx +6 -9
  128. package/src/components/LunarCalendar/LunarCalendar.stories.ts +243 -46
  129. package/src/components/LunarCalendar/LunarCalendar.vue +61 -26
  130. package/src/components/LunarCalendar/Validation/Validation.stories.ts +717 -0
  131. package/src/components/LunarCalendar/tests/LunarCalendar.a11y.spec.ts +1 -1
  132. package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +197 -6
  133. package/src/components/LunarCalendar/tests/useLunarCalendarValidation.spec.ts +287 -0
  134. package/src/components/LunarCalendar/types.ts +39 -0
  135. package/src/components/LunarCalendar/useLunarCalendarValidation.ts +115 -39
  136. package/src/components/MonthPicker/MonthPicker.stories.ts +38 -281
  137. package/src/components/MonthPicker/MonthPicker.vue +66 -17
  138. package/src/components/MonthPicker/MonthPickerText/MonthPickerInput.vue +44 -20
  139. package/src/components/MonthPicker/MonthPickerText/useTextField.ts +5 -0
  140. package/src/components/MonthPicker/Validation/Validation.stories.ts +1117 -0
  141. package/src/components/MonthPicker/locales.ts +1 -0
  142. package/src/components/MonthPicker/tests/MonthPicker.spec.ts +353 -2
  143. package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +12 -8
  144. package/src/components/MonthPicker/types.ts +16 -0
  145. package/src/components/MonthPicker/useMonthPickerValidation.ts +64 -27
  146. package/src/components/NirField/NirField.mdx +120 -66
  147. package/src/components/NirField/NirField.stories.ts +216 -0
  148. package/src/components/NirField/useNirValidation.ts +16 -17
  149. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +263 -245
  150. package/src/components/NotificationBar/NotificationBar.mdx +0 -1
  151. package/src/components/PageContainer/PageContainer.mdx +0 -1
  152. package/src/components/PageContainer/PageContainer.stories.ts +170 -2
  153. package/src/components/PageContainer/PageContainer.vue +63 -8
  154. package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +19 -11
  155. package/src/components/PaginatedTable/PaginatedTable.mdx +0 -1
  156. package/src/components/PeriodField/PeriodField.mdx +0 -1
  157. package/src/components/PhoneField/PhoneField.mdx +2 -3
  158. package/src/components/PhoneField/PhoneField.stories.ts +227 -410
  159. package/src/components/PhoneField/PhoneField.vue +204 -438
  160. package/src/components/PhoneField/indicatifs.ts +1 -1
  161. package/src/components/PhoneField/locales.ts +7 -0
  162. package/src/components/PhoneField/tests/PhoneField.a11y.spec.ts +0 -1
  163. package/src/components/PhoneField/tests/PhoneField.spec.ts +517 -220
  164. package/src/components/PhoneField/types.ts +30 -0
  165. package/src/components/PhoneField/usePhoneFieldValidation.ts +119 -0
  166. package/src/components/PhoneField/usePhoneIndicatifs.ts +89 -0
  167. package/src/components/PhoneField/validation/validation.stories.ts +717 -0
  168. package/src/components/RangeField/RangeField.mdx +0 -1
  169. package/src/components/RatingPicker/RatingPicker.mdx +0 -1
  170. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +0 -1
  171. package/src/components/StatusPage/StatusPage.vue +1 -0
  172. package/src/components/StatusPage/tests/__snapshots__/StatusPage.spec.ts.snap +248 -230
  173. package/src/components/SubHeader/SubHeader.mdx +5 -6
  174. package/src/components/Tables/common/tests/SyTableFilter.spec.ts +11 -12
  175. package/src/components/UploadWorkflow/UploadWorkflow.mdx +0 -1
  176. package/src/components/UserMenuBtn/UserMenuBtn.mdx +0 -1
  177. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +177 -0
  178. package/src/composables/unifyValidation/documentationValidationProps.ts +1 -1
  179. package/src/composables/unifyValidation/tests/useValidation.spec.ts +13 -1
  180. package/src/composables/unifyValidation/useValidation.ts +37 -33
  181. package/src/composantsVuetify/VCard/VCard.mdx +4 -0
  182. package/src/composantsVuetify/VCard/v-card.stories.ts +93 -1
  183. package/src/composantsVuetify/VCarousel/VCarousel.mdx +74 -0
  184. package/src/composantsVuetify/VCarousel/v-carousel.stories.ts +531 -0
  185. package/src/composantsVuetify/VNavigationDrawer/VNavgationDrawer.mdx +53 -0
  186. package/src/composantsVuetify/VNavigationDrawer/v-navigation-drawer.stories.ts +310 -0
  187. package/src/composantsVuetify/VSlideGroup/VSlideGroup.mdx +105 -0
  188. package/src/composantsVuetify/VSlideGroup/v-slide-group.stories.ts +463 -0
  189. package/src/designTokens/tokens/baseColors.ts +1 -1
  190. package/src/designTokens/tokens/baseTokens.ts +18 -18
  191. package/src/stories/Components/Components.stories.ts +34 -1
  192. package/src/stories/Demarrer/Releases.stories.ts +16 -2
  193. package/src/stories/DesignTokens/Arrondis.mdx +1 -1
  194. package/src/stories/DesignTokens/Correspondances.mdx +219 -0
  195. package/src/stories/DesignTokens/UtiliserLesTokens.mdx +235 -0
  196. package/src/stories/DesignTokens/colors.stories.ts +569 -569
  197. package/src/stories/GuideDuDev/Amelipro.stories.ts +335 -267
  198. package/dist/components/LunarCalendar/useLunarCalendarRules.d.ts +0 -5
  199. package/dist/components/PhoneField/tests/types.d.ts +0 -18
  200. package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +0 -184
  201. package/src/components/LunarCalendar/useLunarCalendarRules.ts +0 -96
  202. package/src/components/PhoneField/tests/types.d.ts +0 -19
@@ -19,7 +19,6 @@ import * as UserMenuBtnStories from './UserMenuBtn.stories';
19
19
  <Source dark code={`
20
20
  <script setup lang="ts">
21
21
  import { UserMenuBtn } from '@cnamts/synapse';
22
- import '../../stories/styles/shared.css';
23
22
 
24
23
  const menuItems = [
25
24
  { text: 'Administration', value: 'Administration' },
@@ -720,3 +720,180 @@ export const Slot: Story = {
720
720
  }
721
721
  },
722
722
  }
723
+
724
+ export const WithPsInfo: Story = {
725
+ parameters: {
726
+ sourceCode: [
727
+ {
728
+ name: 'Template',
729
+ code: `<template>
730
+ <UserMenuBtn
731
+ v-model="selected"
732
+ :hide-user-icon="false"
733
+ :hide-logout-btn="true"
734
+ :is-mobile-view="true"
735
+ >
736
+ <template #default>
737
+ <div class="pa-4">
738
+ <div class="mb-2">
739
+ <div class="text-subtitle-2 text-medium-emphasis">Nom</div>
740
+ <div class="text-body-2">{{ userName }}</div>
741
+ </div>
742
+ <div class="mb-2">
743
+ <div class="text-subtitle-2 text-medium-emphasis">Profil</div>
744
+ <div class="text-body-2">{{ profil }}</div>
745
+ </div>
746
+ <div class="mb-2">
747
+ <div class="text-subtitle-2 text-medium-emphasis">RPPS</div>
748
+ <div class="text-body-2">{{ rpps }}</div>
749
+ </div>
750
+ <div class="mb-2">
751
+ <div class="text-subtitle-2 text-medium-emphasis">ADELI</div>
752
+ <div class="text-body-2">{{ adeli }}</div>
753
+ </div>
754
+ <div class="mb-2">
755
+ <div class="text-subtitle-2 text-medium-emphasis">Email</div>
756
+ <div class="text-body-2">{{ email }}</div>
757
+ </div>
758
+ <p class="mt-6 mb-0 text-caption">
759
+ Dernière connexion : {{ lastConnexion }}
760
+ </p>
761
+ </div>
762
+
763
+ <div class="d-flex bg-primary-lighten-3" style="border-bottom-left-radius: 4px; border-bottom-right-radius: 4px;">
764
+ <v-btn
765
+ class="text-none font-weight-bold flex-grow-1"
766
+ color="primary"
767
+ variant="text"
768
+ rounded="0"
769
+ @click="handleAccount"
770
+ >
771
+ Mon Compte
772
+ </v-btn>
773
+
774
+ <v-btn
775
+ class="text-none font-weight-bold flex-grow-1"
776
+ color="primary"
777
+ variant="text"
778
+ rounded="0"
779
+ @click="handleLogout"
780
+ >
781
+ Déconnexion
782
+ </v-btn>
783
+ </div>
784
+ </template>
785
+ </UserMenuBtn>
786
+ </template>`,
787
+ },
788
+ {
789
+ name: 'Script',
790
+ code: `<script setup lang="ts">
791
+ import { ref } from 'vue'
792
+ import { UserMenuBtn } from '@cnamts/synapse'
793
+
794
+ const selected = ref(null)
795
+ const userName = ref('userName')
796
+ const profil = ref('profil')
797
+ const rpps = ref('RPPS')
798
+ const adeli = ref('ADELI')
799
+ const email = ref('email')
800
+ const lastConnexion = ref('01/01/2024')
801
+
802
+ const handleAccount = () => {
803
+ console.log('Mon Compte clicked')
804
+ }
805
+
806
+ const handleLogout = () => {
807
+ console.log('Déconnexion clicked')
808
+ }
809
+ </script>`,
810
+ },
811
+ ],
812
+ },
813
+ args: {
814
+ modelValue: null,
815
+ hideLogoutBtn: true,
816
+ hideUserIcon: false,
817
+ isMobileView: true,
818
+ vuetifyOptions: undefined,
819
+ },
820
+ render: (args) => {
821
+ return {
822
+ components: { UserMenuBtn },
823
+ setup() {
824
+ const userDetails = {
825
+ userName: 'John Doe',
826
+ profil: 'Médecin généraliste',
827
+ rpps: 'RPPS',
828
+ adeli: 'ADELI',
829
+ email: 'johndoe@gmail.com',
830
+ lastConnexion: '01/01/2024',
831
+ }
832
+
833
+ const handleAccount = () => {
834
+ console.log('Mon Compte clicked')
835
+ }
836
+
837
+ const handleLogout = () => {
838
+ console.log('Déconnexion clicked')
839
+ }
840
+
841
+ return { args, userDetails, handleAccount, handleLogout }
842
+ },
843
+ template: `
844
+ <div style="display: flex; justify-content: center; height: 500px;">
845
+ <UserMenuBtn v-bind="args">
846
+ <template #default>
847
+ <div class="pa-4">
848
+ <div class="mb-2">
849
+ <div class="text-subtitle-2 text-medium-emphasis">Nom</div>
850
+ <div class="text-body-2">{{ userDetails.userName }}</div>
851
+ </div>
852
+ <div class="mb-2">
853
+ <div class="text-subtitle-2 text-medium-emphasis">Profil</div>
854
+ <div class="text-body-2">{{ userDetails.profil }}</div>
855
+ </div>
856
+ <div class="mb-2">
857
+ <div class="text-subtitle-2 text-medium-emphasis">RPPS</div>
858
+ <div class="text-body-2">{{ userDetails.rpps }}</div>
859
+ </div>
860
+ <div class="mb-2">
861
+ <div class="text-subtitle-2 text-medium-emphasis">ADELI</div>
862
+ <div class="text-body-2">{{ userDetails.adeli }}</div>
863
+ </div>
864
+ <div class="mb-2">
865
+ <div class="text-subtitle-2 text-medium-emphasis">Email</div>
866
+ <div class="text-body-2">{{ userDetails.email }}</div>
867
+ </div>
868
+ <p class="mt-6 mb-0 text-caption">
869
+ Dernière connexion : {{ userDetails.lastConnexion }}
870
+ </p>
871
+ </div>
872
+
873
+ <div class="d-flex bg-primary-lighten-3" style="border-bottom-left-radius: 4px; border-bottom-right-radius: 4px;">
874
+ <v-btn
875
+ class="text-none font-weight-bold flex-grow-1"
876
+ color="primary"
877
+ variant="text"
878
+ rounded="0"
879
+ @click="handleAccount"
880
+ >
881
+ Mon Compte
882
+ </v-btn>
883
+
884
+ <v-btn
885
+ class="text-none font-weight-bold flex-grow-1"
886
+ color="primary"
887
+ variant="text"
888
+ rounded="0"
889
+ @click="handleLogout"
890
+ >
891
+ Déconnexion
892
+ </v-btn>
893
+ </div>
894
+ </template>
895
+ </UserMenuBtn>
896
+ </div>`,
897
+ }
898
+ },
899
+ }
@@ -18,7 +18,7 @@ function generateBuiltInRuleType(type: 'base' | 'date' | 'number' | 'string' | '
18
18
  }
19
19
  }
20
20
 
21
- export function getValidationDocumentation(type: 'date' | 'number' | 'string' | 'all' = 'all') {
21
+ export function getValidationDocumentation(type: 'base' | 'date' | 'number' | 'string' | 'all' = 'all') {
22
22
  const builtInRuleType = generateBuiltInRuleType(type)
23
23
 
24
24
  return {
@@ -114,6 +114,18 @@ describe('useValidation (unifyValidation)', () => {
114
114
  expect(result.errors.value).toContain('Nouvelle erreur')
115
115
  })
116
116
 
117
+ it('limits the number of errors from errorMessages according to maxErrors', async () => {
118
+ const errorMessages = ref<string[] | null>(['E1', 'E2', 'E3'])
119
+ const params = makeParams({ errorMessages, maxErrors: ref(2) })
120
+ const { result } = withSetup(() => useValidation(params as Parameters<typeof useValidation>[0]))
121
+
122
+ await nextTick()
123
+ expect(result.errors.value).toHaveLength(2)
124
+
125
+ expect(result.errors.value).toEqual(['E1', 'E2'])
126
+ expect(result.errors.value).not.toContain('E3')
127
+ })
128
+
117
129
  it('combines rule validation errors with external errorMessages', async () => {
118
130
  const errorMessages = ref<string[] | null>(['Erreur par défaut'])
119
131
  const params = makeParams({
@@ -125,7 +137,7 @@ describe('useValidation (unifyValidation)', () => {
125
137
 
126
138
  const valid = await result.validate()
127
139
  expect(valid).toBe(false)
128
- expect(result.errors.value).toEqual(['Erreur règle', 'Erreur par défaut'])
140
+ expect(result.errors.value).toEqual(['Erreur par défaut', 'Erreur règle'])
129
141
  expect(result.hasError.value).toBe(true)
130
142
  })
131
143
 
@@ -76,40 +76,26 @@ export function useValidation(params: {
76
76
  hasErrorProp?: Ref<boolean>
77
77
  hasWarningProp?: Ref<boolean>
78
78
  hasSuccessProp?: Ref<boolean>
79
+ maxErrors?: Ref<number>
79
80
  } & ({
80
81
  useVuetifyValidation: true
81
82
  rules: Ref<VuetifyValidationRule[] | undefined>
82
83
  customRules?: never
83
84
  customWarningRules?: never
84
85
  customSuccessRules?: never
85
- maxErrors?: Ref<number>
86
86
  } | {
87
87
  useVuetifyValidation: false
88
88
  customRules: Ref<SyValidationRule[]>
89
89
  customWarningRules?: Ref<SyValidationRule[]>
90
90
  customSuccessRules?: Ref<SyValidationRule[]>
91
91
  rules?: never
92
- maxErrors?: Ref<number>
93
92
  } | {
94
93
  useVuetifyValidation: Ref<boolean>
95
94
  customRules: Ref<SyValidationRule[]>
96
95
  customWarningRules?: Ref<SyValidationRule[]>
97
96
  customSuccessRules?: Ref<SyValidationRule[]>
98
97
  rules: Ref<VuetifyValidationRule[] | undefined>
99
- maxErrors?: Ref<number>
100
98
  })) {
101
- if (params.disableErrorHandling.value) {
102
- return {
103
- errors: computed(() => params.errorMessages?.value || []),
104
- warnings: computed(() => params.warningMessages?.value || []),
105
- successes: computed(() => params.successMessages?.value || []),
106
- hasError: computed(() => (params.errorMessages?.value?.length ?? 0) > 0 || (params.hasErrorProp?.value ?? false)),
107
- hasWarning: computed(() => (params.warningMessages?.value?.length ?? 0) > 0 || (params.hasWarningProp?.value ?? false)),
108
- hasSuccess: computed(() => params.hasSuccessProp?.value ?? false),
109
- validate: async () => true,
110
- clearValidation: () => {},
111
- }
112
- }
113
99
  const vuetifyErrors = ref<string[]>([])
114
100
  const customErrors = ref<string[]>([])
115
101
  const innerWarnings = ref<string[]>([])
@@ -127,7 +113,7 @@ export function useValidation(params: {
127
113
  computed(() => params.errorMessages?.value || []),
128
114
  params.focused,
129
115
  params.maxErrors,
130
- params.label,
116
+ computed(() => toValue(params.useVuetifyValidation) ? params.label?.value : undefined),
131
117
  params.label,
132
118
  params.readonly,
133
119
  computed(() => params.isValidateOnBlur.value ? 'blur' : 'input'),
@@ -173,27 +159,44 @@ export function useValidation(params: {
173
159
  }
174
160
 
175
161
  const errors = computed(() => {
176
- const allErrors = [...new Set([
177
- ...vuetifyErrors.value,
178
- ...customErrors.value,
179
- ...(params.errorMessages?.value || []),
180
- ])]
181
- // Plafonne le nombre d'erreurs affichées (maxErrors, défaut 1), tous modes confondus.
162
+ const errorslist = [...params.errorMessages?.value || []]
163
+ if (toValue(params.disableErrorHandling) !== true) {
164
+ errorslist.push(...vuetifyErrors.value)
165
+ errorslist.push(...customErrors.value)
166
+ }
167
+
182
168
  const max = params.maxErrors?.value
183
- return max && max > 0 ? allErrors.slice(0, max) : allErrors
169
+ return max && max > 0 ? [...new Set(errorslist)].slice(0, max) : [...new Set(errorslist)]
170
+ })
171
+
172
+ const warnings = computed(() => {
173
+ const warningsList = [...params.warningMessages?.value || []]
174
+ if (toValue(params.disableErrorHandling) !== true) {
175
+ warningsList.push(...innerWarnings.value)
176
+ }
177
+ const max = params.maxErrors?.value
178
+ return max && max > 0 ? [...new Set(warningsList)].slice(0, max) : [...new Set(warningsList)]
179
+ })
180
+ const successes = computed(() => {
181
+ const successesList = [...params.successMessages?.value || []]
182
+ if (toValue(params.disableErrorHandling) !== true) {
183
+ successesList.push(...innerSuccesses.value)
184
+ }
185
+ const max = params.maxErrors?.value
186
+ return max && max > 0 ? [...new Set(successesList)].slice(0, max) : [...new Set(successesList)]
184
187
  })
185
- const warnings = computed(() => [...new Set([
186
- ...innerWarnings.value,
187
- ...(params.warningMessages?.value || []),
188
- ])])
189
- const successes = computed(() => [...new Set([
190
- ...(params.showSuccessMessages.value ? innerSuccesses.value : []),
191
- ...(params.successMessages?.value || []),
192
- ])])
193
188
  const internalHasSuccess = computed(() => customValidator.hasSuccess.value)
194
189
 
195
- const hasError = computed(() => errors.value.length > 0 || params.hasErrorProp?.value)
196
- const hasWarning = computed(() => warnings.value.length > 0 || params.hasWarningProp?.value)
190
+ const hasError = computed(() => errors.value.length > 0 || Boolean(params.hasErrorProp?.value))
191
+ const hasWarning = computed(() => warnings.value.length > 0 || Boolean(params.hasWarningProp?.value))
192
+
193
+ const state = computed(() => {
194
+ if (hasError.value) return 'error'
195
+ if (hasWarning.value) return 'warning'
196
+ if (hasSuccess.value) return 'success'
197
+ return 'default'
198
+ })
199
+
197
200
  // TODO: vérifier si c'est la meilleure approche pour supprimer le succès en mode Vuetify
198
201
  const hasSuccess = computed(() => {
199
202
  if (toValue(params.useVuetifyValidation)) {
@@ -218,6 +221,7 @@ export function useValidation(params: {
218
221
  hasError,
219
222
  hasWarning,
220
223
  hasSuccess,
224
+ state,
221
225
  validate,
222
226
  clearValidation,
223
227
  }
@@ -59,6 +59,10 @@ Le composant `v-card` propose plusieurs variantes de style :
59
59
 
60
60
  <Canvas of={VCardStories.WithCustomActions} />
61
61
 
62
+ ### With Number
63
+
64
+ <Canvas of={VCardStories.WithNumber} />
65
+
62
66
  ## Accessibilité
63
67
 
64
68
  - Utilisez des titres descriptifs pour les cartes
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
- import { VCard, VCardTitle, VCardText, VCardActions, VDivider } from 'vuetify/components'
2
+ import { VCard, VCardTitle, VCardText, VCardActions, VDivider, VAvatar } from 'vuetify/components'
3
3
  import { VBtn } from 'vuetify/components'
4
4
 
5
5
  const meta: Meta<typeof VCard> = {
@@ -467,3 +467,95 @@ import { VCard, VCardTitle, VCardText, VDivider, VBtn } from 'vuetify/components
467
467
  },
468
468
  },
469
469
  }
470
+
471
+ export const WithNumber: Story = {
472
+ render: args => ({
473
+ components: { VCard, VCardText, VAvatar },
474
+ setup() {
475
+ return { args }
476
+ },
477
+ template: `
478
+ <div class="w-100">
479
+ <VCard
480
+ v-bind="args"
481
+ variant="outlined"
482
+ class="mb-6"
483
+ style="
484
+ width: 100%;
485
+ border-color: #BDBDBD;
486
+ position: relative;
487
+ overflow: visible;
488
+ padding-top: 32px;
489
+ "
490
+ >
491
+ <v-avatar
492
+ color="primary"
493
+ variant="outlined"
494
+ size="32"
495
+ style="
496
+ position: absolute;
497
+ background: white;
498
+ top: 0;
499
+ left: 50%;
500
+ transform: translate(-50%, -50%);
501
+ z-index: 1;
502
+ "
503
+ >
504
+ 1
505
+ </v-avatar>
506
+
507
+ <v-card-text>
508
+ Cette carte est numérotée.
509
+ </v-card-text>
510
+ </VCard>
511
+ </div>
512
+ `,
513
+ }),
514
+ args: {},
515
+ parameters: {
516
+ docs: {
517
+ source: {
518
+ code: `<template>
519
+ <div class="w-100">
520
+ <VCard
521
+ v-bind="args"
522
+ variant="outlined"
523
+ class="mb-6"
524
+ style="
525
+ width: 100%;
526
+ border-color: #BDBDBD;
527
+ position: relative;
528
+ overflow: visible;
529
+ padding-top: 32px;
530
+ "
531
+ >
532
+ <v-avatar
533
+ color="primary"
534
+ variant="outlined"
535
+ size="32"
536
+ style="
537
+ position: absolute;
538
+ background: white;
539
+ top: 0;
540
+ left: 50%;
541
+ transform: translate(-50%, -50%);
542
+ z-index: 1;
543
+ "
544
+ >
545
+ 1
546
+ </v-avatar>
547
+
548
+ <v-card-text>
549
+ Cette carte est numérotée.
550
+ </v-card-text>
551
+ </VCard>
552
+ </div>
553
+ </template>
554
+
555
+ <script setup lang="ts">
556
+ import { VCard, VCardText, VAvatar } from 'vuetify/components'
557
+ </script>`,
558
+ },
559
+ },
560
+ },
561
+ }
@@ -0,0 +1,74 @@
1
+ import { Meta, Canvas, Controls, Description } from '@storybook/blocks'
2
+ import * as VCarouselStories from './v-carousel.stories'
3
+
4
+ <Meta title="Composants/Composants Vuetify/VCarousel" />
5
+
6
+ <div className="header">
7
+ <h1>VCarousel</h1>
8
+ Le composant `v-carousel` est utilisé pour afficher un diaporama d'images ou de contenu. Il offre plusieurs options de personnalisation comme le défilement automatique, les indicateurs de pagination, et les flèches de navigation. Pour l'API complète du composant, consulter la [documentation Vuetify](https://vuetifyjs.com/en/api/v-carousel/#props).
9
+ </div>
10
+
11
+
12
+ ## Exemple par défaut
13
+
14
+ <Canvas of={VCarouselStories.Primary} />
15
+
16
+ ## Variantes
17
+
18
+ ### Avec défilement automatique
19
+
20
+ Utilisez la prop `cycle` pour activer le défilement automatique et `interval` pour définir la durée entre chaque slide.
21
+
22
+ <Canvas of={VCarouselStories.WithCycle} />
23
+
24
+ ### Sans indicateurs
25
+
26
+ Masquez les indicateurs de pagination avec la prop `hide-delimiters`.
27
+
28
+ <Canvas of={VCarouselStories.HideDelimiters} />
29
+
30
+ ### Flèches au survol
31
+
32
+ Affichez les flèches uniquement au survol avec `show-arrows="hover"`.
33
+
34
+ <Canvas of={VCarouselStories.ShowArrowsOnHover} />
35
+
36
+ ### Avec barre de progression
37
+
38
+ Ajoutez une barre de progression avec la prop `progress`.
39
+
40
+ <Canvas of={VCarouselStories.WithProgress} />
41
+
42
+ ### Avec images
43
+
44
+ Le carousel peut afficher des images avec la prop `src` sur `v-carousel-item`.
45
+
46
+ <Canvas of={VCarouselStories.WithImages} />
47
+
48
+ ### Hauteur personnalisée
49
+
50
+ Ajustez la hauteur du carousel avec la prop `height`.
51
+
52
+ <Canvas of={VCarouselStories.CustomHeight} />
53
+
54
+ ### Customization
55
+
56
+ <Canvas of={VCarouselStories.WithCustomSlots} />
57
+
58
+ ## Accessibilité
59
+
60
+ - Les flèches de navigation sont accessibles au clavier
61
+ - Les indicateurs de pagination peuvent être navigués avec Tab
62
+ - Support des gestes tactiles sur mobile
63
+
64
+ ## Bonnes pratiques
65
+
66
+ - ✅ Utilisez des images de taille cohérente pour éviter les sauts visuels
67
+ - ✅ Définissez un `interval` raisonnable (3-6 secondes) pour le défilement automatique
68
+ - ✅ Fournissez des alternatives textuelles pour les images
69
+ - ⚠️ Évitez trop de slides (max 5-7 recommandé)
70
+ - ⚠️ N'utilisez pas `cycle` si le contenu nécessite une lecture attentive
71
+
72
+ ## Documentation Vuetify
73
+
74
+ Pour plus d'informations, consultez la [documentation officielle de Vuetify](https://vuetifyjs.com/en/components/carousels/).