@cnamts/synapse 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/dist/{AutocompleteFilter-BPR-a55G.js → AutocompleteFilter-C9eLKyW8.js} +3 -3
  2. package/dist/{DateFilter-CknrJWs2.js → DateFilter-y-GLkAkn.js} +8 -8
  3. package/dist/{NumberFilter-DJ-yNlzv.js → NumberFilter-DN6hIBS7.js} +1 -1
  4. package/dist/{PeriodFilter-CiB5Oa9Z.js → PeriodFilter-MoUUp9qS.js} +1 -1
  5. package/dist/{SelectFilter-EiafX97M.js → SelectFilter-bCbrdLmu.js} +1 -1
  6. package/dist/{TextFilter-BzOmpdxj.js → TextFilter-CvjgEaoM.js} +4 -4
  7. package/dist/apLightTheme2026-ug4Y23ns.js +611 -0
  8. package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +2369 -353
  9. package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +18 -0
  10. package/dist/components/Customs/Selects/SyAutocomplete/utils/ariaManager.d.ts +1 -1
  11. package/dist/components/Customs/Selects/SyAutocomplete/utils/useKeyboardHandler.d.ts +3 -1
  12. package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +9 -10
  13. package/dist/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.d.ts +1 -0
  14. package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +15 -0
  15. package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +3 -3
  16. package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +3 -3
  17. package/dist/components/Customs/SyIconButton/SyIconButton.d.ts +18 -0
  18. package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +20 -38
  19. package/dist/components/Customs/SyRadioGroup/composables/useSyRadioGroupValidation.d.ts +50 -0
  20. package/dist/components/Customs/SyTextField/SyTextField.d.ts +6 -6
  21. package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +147 -136
  22. package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +62 -54
  23. package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +27 -24
  24. package/dist/components/DatePicker/composables/index.d.ts +1 -0
  25. package/dist/components/DatePicker/composables/useDatePickerValidationBridge.d.ts +51 -0
  26. package/dist/components/MonthPicker/MonthPicker.d.ts +23 -23
  27. package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +23 -23
  28. package/dist/components/NirField/NirField.d.ts +56 -56
  29. package/dist/components/PasswordField/PasswordField.d.ts +3 -3
  30. package/dist/components/PeriodField/PeriodField.d.ts +236 -212
  31. package/dist/components/PhoneField/PhoneField.d.ts +23 -23
  32. package/dist/components/SyTextArea/SyTextArea.d.ts +25 -15
  33. package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +20 -0
  34. package/dist/components/SyTextArea/locales.d.ts +1 -0
  35. package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +1 -0
  36. package/dist/components/Tables/SyTable/SyTable.d.ts +1 -0
  37. package/dist/components/Tables/common/SyTablePagination.d.ts +25 -25
  38. package/dist/components/Tables/common/types.d.ts +2 -0
  39. package/dist/components/index.d.ts +1 -0
  40. package/dist/composables/unifyValidation/documentationValidationProps.d.ts +160 -160
  41. package/dist/composables/unifyValidation/useValidation.d.ts +16 -14
  42. package/dist/design-system-v3.js +81 -80
  43. package/dist/designTokens/tokens/amelipro/apContextual.d.ts +6 -6
  44. package/dist/designTokens/tokens/amelipro/apDarkTheme.d.ts +3 -1
  45. package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +53 -100
  46. package/dist/designTokens/tokens/baseContextualTokens.d.ts +0 -6
  47. package/dist/designTokens/tokens/baseTokens.d.ts +232 -0
  48. package/dist/designTokens/tokens/cnam/cnamContextual.d.ts +6 -6
  49. package/dist/designTokens/tokens/cnam/cnamDarkTheme.d.ts +1 -1
  50. package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +57 -101
  51. package/dist/designTokens/tokens/pa/paContextual.d.ts +0 -6
  52. package/dist/designTokens/tokens/pa/paDarkTheme.d.ts +1 -1
  53. package/dist/designTokens/tokens/pa/paLightTheme.d.ts +53 -97
  54. package/dist/designTokens/tokens/pa/paSemantic.d.ts +1 -0
  55. package/dist/designTokens/tokens/semanticTokens.d.ts +112 -0
  56. package/dist/main-CI6Q9nmO.js +39234 -0
  57. package/dist/synapse.css +1 -1
  58. package/dist/vuetifyConfig.js +208 -72
  59. package/package.json +4 -2
  60. package/src/assets/overrides/_icons.scss +5 -4
  61. package/src/assets/overrides/_otp.scss +4 -4
  62. package/src/assets/overrides/_typography.scss +2 -1
  63. package/src/assets/overrides/_utilities.scss +1 -42
  64. package/src/components/ChipList/ChipList.vue +30 -18
  65. package/src/components/ChipList/tests/chipList.spec.ts +4 -4
  66. package/src/components/CopyBtn/CopyBtn.vue +2 -2
  67. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +4 -0
  68. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +7 -6
  69. package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +223 -0
  70. package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.stories.ts +283 -351
  71. package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +182 -218
  72. package/src/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.ts +101 -0
  73. package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +761 -1
  74. package/src/components/Customs/Selects/SyAutocomplete/utils/ariaManager.ts +3 -1
  75. package/src/components/Customs/Selects/SyAutocomplete/utils/useKeyboardHandler.ts +79 -5
  76. package/src/components/Customs/Selects/SyAutocomplete/validation/Validation.stories.ts +1029 -0
  77. package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +9 -491
  78. package/src/components/Customs/Selects/SySelect/SySelect.vue +46 -79
  79. package/src/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.ts +3 -0
  80. package/src/components/Customs/Selects/SySelect/composables/useSySelectValidation.ts +64 -0
  81. package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +196 -0
  82. package/src/components/Customs/Selects/SySelect/validation/Validation.stories.ts +1026 -0
  83. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +18 -7
  84. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +2 -2
  85. package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +8 -8
  86. package/src/components/Customs/SyCheckbox/SyCheckbox.vue +8 -8
  87. package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +1 -1
  88. package/src/components/Customs/SyIcon/accessibilite/Accessibility.mdx +0 -6
  89. package/src/components/Customs/SyIcon/utils/tests/iconUtils.spec.ts +107 -0
  90. package/src/components/Customs/SyRadioGroup/SyRadioGroup.mdx +2 -2
  91. package/src/components/Customs/SyRadioGroup/SyRadioGroup.stories.ts +395 -200
  92. package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +82 -127
  93. package/src/components/Customs/SyRadioGroup/composables/useSyRadioGroupValidation.ts +127 -0
  94. package/src/components/Customs/SyRadioGroup/tests/SyRadioGroup.a11y.spec.ts +93 -1
  95. package/src/components/Customs/SyRadioGroup/tests/SyRadioGroup.spec.ts +146 -9
  96. package/src/components/Customs/SyRadioGroup/tests/SyRadioGroup.visual.cy.ts +165 -0
  97. package/src/components/Customs/SyRadioGroup/validation/Validation.stories.ts +773 -0
  98. package/src/components/Customs/SyTabs/config.ts +3 -3
  99. package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +265 -0
  100. package/src/components/Customs/SyTabs/tests/useTabTransition.spec.ts +188 -0
  101. package/src/components/Customs/SyTextField/SyTextField.stories.ts +10 -29
  102. package/src/components/Customs/SyTextField/SyTextField.vue +23 -15
  103. package/src/components/DataList/DataList.stories.ts +1 -1
  104. package/src/components/DataListItem/tests/DataListItem.spec.ts +3 -1
  105. package/src/components/DatePicker/CalendarMode/DatePicker.vue +37 -142
  106. package/src/components/DatePicker/CalendarMode/tests/DatePicker.coverage.spec.ts +156 -0
  107. package/src/components/DatePicker/CalendarMode/tests/DatePicker.spec.ts +495 -4
  108. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +47 -66
  109. package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +206 -0
  110. package/src/components/DatePicker/ComplexDatePicker/tests/bridge-integration.regression.spec.ts +210 -0
  111. package/src/components/DatePicker/ComplexDatePicker/tests/calendar-navigation.regression.spec.ts +214 -0
  112. package/src/components/DatePicker/ComplexDatePicker/tests/validation-cross.regression.spec.ts +194 -0
  113. package/src/components/DatePicker/ComplexDatePicker/tests/validation-success-messages.regression.spec.ts +83 -0
  114. package/src/components/DatePicker/DateTextInput/DateTextInput.vue +129 -54
  115. package/src/components/DatePicker/DateTextInput/tests/DateTextInput.spec.ts +320 -0
  116. package/src/components/DatePicker/composables/index.ts +1 -0
  117. package/src/components/DatePicker/composables/tests/useCalendarKeyboardNavigation.spec.ts +360 -0
  118. package/src/components/DatePicker/composables/tests/useDatePickerValidationBridge.spec.ts +129 -0
  119. package/src/components/DatePicker/composables/useDatePickerValidationBridge.ts +205 -0
  120. package/src/components/DatePicker/docExamples/BidirectionalComplexValidation.vue +1 -1
  121. package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +1 -1
  122. package/src/components/DatePicker/tests/exposed-methods.coverage.spec.ts +75 -0
  123. package/src/components/DialogBox/DialogBox.vue +1 -1
  124. package/src/components/FileList/UploadItem/UploadItem.vue +4 -4
  125. package/src/components/FileUpload/FileUpload.vue +2 -2
  126. package/src/components/FileUpload/FileUploadContent.vue +1 -1
  127. package/src/components/FilterInline/FilterInline.mdx +2 -2
  128. package/src/components/FilterSideBar/FilterSideBar.stories.ts +1 -1
  129. package/src/components/FilterSideBar/FilterSideBar.vue +2 -2
  130. package/src/components/FooterBar/FooterBar.vue +7 -7
  131. package/src/components/FranceConnectBtn/FranceConnectBtn.vue +1 -1
  132. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.vue +2 -2
  133. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.vue +7 -7
  134. package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +2 -2
  135. package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +87 -8
  136. package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +3 -3
  137. package/src/components/HeaderNavigationBar/HorizontalNavbar/tests/HorizontalNavbar.spec.ts +589 -0
  138. package/src/components/HeaderToolbar/tests/HeaderToolBar.spec.ts +153 -1
  139. package/src/components/HeaderToolbar/tests/useMobileRightMenu.spec.ts +258 -0
  140. package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +2 -2
  141. package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +1 -1
  142. package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +184 -0
  143. package/src/components/MonthPicker/MonthPickerVisual/MonthSelector.vue +3 -3
  144. package/src/components/MonthPicker/MonthPickerVisual/VisualPickerFooter.vue +1 -1
  145. package/src/components/MonthPicker/MonthPickerVisual/VisualPickerHeader.vue +2 -2
  146. package/src/components/MonthPicker/MonthPickerVisual/YearSelector.vue +1 -1
  147. package/src/components/NirField/NirField.vue +3 -3
  148. package/src/components/NotificationBar/Notification/Notification.vue +12 -12
  149. package/src/components/NotificationBar/NotificationBar.stories.ts +8 -8
  150. package/src/components/PaginatedTable/Pagination.vue +2 -2
  151. package/src/components/PasswordField/PasswordField.vue +8 -8
  152. package/src/components/PasswordField/tests/PasswordField.spec.ts +3 -3
  153. package/src/components/RangeField/RangeSlider/RangeSlider.vue +2 -2
  154. package/src/components/RangeField/RangeSlider/Tooltip/Tooltip.vue +1 -1
  155. package/src/components/StatusPage/tests/StatusPage.spec.ts +149 -0
  156. package/src/components/SubHeader/SubHeader.vue +1 -1
  157. package/src/components/SyAlert/SyAlert.vue +23 -23
  158. package/src/components/SyTextArea/SyTextArea.stories.ts +177 -131
  159. package/src/components/SyTextArea/SyTextArea.vue +235 -83
  160. package/src/components/SyTextArea/composables/useSyTextAreaValidation.ts +81 -0
  161. package/src/components/SyTextArea/locales.ts +1 -0
  162. package/src/components/SyTextArea/tests/SyTextArea.spec.ts +449 -1
  163. package/src/components/SyTextArea/useDefaultValidationRules.ts +2 -7
  164. package/src/components/SyTextArea/validation/Validation.stories.ts +856 -0
  165. package/src/components/TableToolbar/TableToolbar.vue +6 -6
  166. package/src/components/TableToolbar/accessibilite/Accessibility.mdx +81 -7
  167. package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +163 -0
  168. package/src/components/Tables/SyServerTable/SyServerTable.vue +2 -1
  169. package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +67 -0
  170. package/src/components/Tables/SyTable/SyTable.stories.ts +94 -0
  171. package/src/components/Tables/SyTable/SyTable.vue +2 -1
  172. package/src/components/Tables/SyTable/tests/SyTable.spec.ts +64 -0
  173. package/src/components/Tables/common/TableHeader.vue +2 -2
  174. package/src/components/Tables/common/filters/logics/tests/NumberFilterLogic.spec.ts +176 -0
  175. package/src/components/Tables/common/filters/logics/tests/SelectFilterLogic.spec.ts +111 -0
  176. package/src/components/Tables/common/tableStyles.scss +6 -6
  177. package/src/components/Tables/common/types.ts +2 -0
  178. package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +2 -0
  179. package/src/components/index.ts +1 -0
  180. package/src/composables/date/tests/useDateFormatDayjs.spec.ts +31 -0
  181. package/src/composables/date/tests/useHolidayDay.spec.ts +109 -0
  182. package/src/composables/rules/tests/useFieldValidation.spec.ts +374 -0
  183. package/src/composables/tests/useError.spec.ts +30 -0
  184. package/src/composables/tests/useFormFieldErrorHandling.spec.ts +234 -0
  185. package/src/composables/unifyValidation/documentationValidationProps.ts +5 -5
  186. package/src/composables/unifyValidation/tests/documentationValidationProps.spec.ts +177 -0
  187. package/src/composables/unifyValidation/tests/useCustomValidation.spec.ts +30 -0
  188. package/src/composables/unifyValidation/tests/useValidation.spec.ts +6 -2
  189. package/src/composables/unifyValidation/useCustomValidation.ts +19 -9
  190. package/src/composables/unifyValidation/useValidation.ts +18 -21
  191. package/src/composables/useFilterable/useFilterable.spec.ts +42 -0
  192. package/src/composables/useFilterable/useFilterable.ts +11 -7
  193. package/src/composables/useFormFieldErrorHandling.ts +2 -2
  194. package/src/composantsVuetify/VBtn/VBtn.mdx +9 -39
  195. package/src/composantsVuetify/VBtn/v-btn.stories.ts +26 -86
  196. package/src/designTokens/tokens/amelipro/apContextual.ts +6 -0
  197. package/src/designTokens/tokens/amelipro/apDarkTheme.ts +2 -2
  198. package/src/designTokens/tokens/amelipro/apLightTheme.ts +72 -103
  199. package/src/designTokens/tokens/amelipro/apSemantic.ts +1 -1
  200. package/src/designTokens/tokens/baseContextualTokens.ts +1 -6
  201. package/src/designTokens/tokens/baseTokens.ts +232 -0
  202. package/src/designTokens/tokens/cnam/cnamContextual.ts +6 -0
  203. package/src/designTokens/tokens/cnam/cnamDarkTheme.ts +2 -2
  204. package/src/designTokens/tokens/cnam/cnamLightTheme.ts +76 -104
  205. package/src/designTokens/tokens/pa/paDarkTheme.ts +2 -2
  206. package/src/designTokens/tokens/pa/paLightTheme.ts +73 -99
  207. package/src/designTokens/tokens/pa/paSemantic.ts +2 -0
  208. package/src/designTokens/tokens/semanticTokens.ts +114 -0
  209. package/src/stories/Components/Components.stories.ts +7 -3
  210. package/src/stories/DesignTokens/ColorIntegrationExample.vue +2 -3
  211. package/src/stories/DesignTokens/Colors.mdx +6 -8
  212. package/src/stories/DesignTokens/colors.stories.ts +244 -1081
  213. package/src/utils/amelipro/toKebabCase/tests/toKebabCase.spec.ts +52 -0
  214. package/src/utils/formatNir/tests/formatNir.spec.ts +34 -0
  215. package/src/utils/tests/insertAt.spec.ts +44 -0
  216. package/dist/apLightTheme-DS0Uy44H.js +0 -954
  217. package/dist/components/RatingPicker/tests/RatingPicker.a11y.spect.d.ts +0 -1
  218. package/dist/main-BsJ9ec3i.js +0 -38954
  219. package/src/components/BackBtn/tests/__snapshots__/back-btn-custom-bg.snap.png +0 -0
  220. package/src/components/BackBtn/tests/__snapshots__/back-btn-dark-mode.snap.png +0 -0
  221. package/src/components/BackBtn/tests/__snapshots__/back-btn-default.snap.png +0 -0
  222. package/src/components/BackBtn/tests/__snapshots__/back-btn-no-icon.snap.png +0 -0
  223. package/src/components/DatePicker/CalendarMode/tests/DatePicker.events.spec.ts +0 -178
  224. package/src/components/DialogBox/tests/__snapshots__/dialog-box-custom-texts.snap.png +0 -0
  225. package/src/components/DialogBox/tests/__snapshots__/dialog-box-default.snap.png +0 -0
  226. package/src/components/DialogBox/tests/__snapshots__/dialog-box-no-actions.snap.png +0 -0
  227. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/header-burger-menu-generated-submenu-open.snap.png +0 -0
  228. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/header-burger-menu-generated.snap.png +0 -0
  229. package/src/components/HeaderBar/tests/__snapshots__/header-bar-custom-width.snap.png +0 -0
  230. package/src/components/HeaderBar/tests/__snapshots__/header-bar-default.snap.png +0 -0
  231. package/src/components/HeaderBar/tests/__snapshots__/header-bar-no-sticky.snap.png +0 -0
  232. package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-prepend.snap.png +0 -0
  233. package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-side.snap.png +0 -0
  234. package/src/components/HeaderBar/tests/__snapshots__/header-bar-with-subtitle.snap.png +0 -0
  235. package/src/components/Logo/tests/__snapshots__/logo-avatar.snap.png +0 -0
  236. package/src/components/Logo/tests/__snapshots__/logo-dark.snap.png +0 -0
  237. package/src/components/Logo/tests/__snapshots__/logo-default.snap.png +0 -0
  238. package/src/components/Logo/tests/__snapshots__/logo-no-organism.snap.png +0 -0
  239. package/src/components/Logo/tests/__snapshots__/logo-no-signature.snap.png +0 -0
  240. package/src/components/Logo/tests/__snapshots__/logo-risque-pro.snap.png +0 -0
  241. package/src/components/RangeField/tests/__snapshots__/range-field-custom-bg.snap.png +0 -0
  242. package/src/components/RangeField/tests/__snapshots__/range-field-custom-range.snap.png +0 -0
  243. package/src/components/RangeField/tests/__snapshots__/range-field-default.snap.png +0 -0
  244. package/src/components/RangeField/tests/__snapshots__/range-field-step.snap.png +0 -0
  245. package/src/components/RangeField/tests/__snapshots__/range-field-with-label.snap.png +0 -0
  246. package/src/components/SyAlert/tests/__snapshots__/sy-alert-closable.snap.png +0 -0
  247. package/src/components/SyAlert/tests/__snapshots__/sy-alert-error.snap.png +0 -0
  248. package/src/components/SyAlert/tests/__snapshots__/sy-alert-info.snap.png +0 -0
  249. package/src/components/SyAlert/tests/__snapshots__/sy-alert-success.snap.png +0 -0
  250. package/src/components/SyAlert/tests/__snapshots__/sy-alert-variant-outlined.snap.png +0 -0
  251. package/src/components/SyAlert/tests/__snapshots__/sy-alert-variant-tonal.snap.png +0 -0
  252. package/src/components/SyAlert/tests/__snapshots__/sy-alert-warning.snap.png +0 -0
  253. /package/src/components/RatingPicker/tests/{RatingPicker.a11y.spect.ts → RatingPicker.a11y.spec.ts} +0 -0
@@ -2,168 +2,157 @@ import type { Meta, StoryObj } from '@storybook/vue3'
2
2
  import SyAutocomplete from './SyAutocomplete.vue'
3
3
  import SyForm from '../../SyForm/SyForm.vue'
4
4
  import AccessibilityDocs from './accessibilite/Accessibility.mdx'
5
- import { ref } from 'vue'
5
+ import { computed, ref } from 'vue'
6
6
  import { fn } from '@storybook/test'
7
- import { VBtn } from 'vuetify/components'
7
+ import { VBtn, VCheckbox, VDivider, VListItem, VListItemTitle } from 'vuetify/components'
8
+ import { getValidationDocumentation } from '@/composables/unifyValidation/documentationValidationProps'
8
9
 
9
10
  const meta: Meta<typeof SyAutocomplete> = {
10
11
  title: 'Composants/Formulaires/Selects/SyAutocomplete',
11
12
  component: SyAutocomplete,
12
13
  parameters: {
13
14
  layout: 'fullscreen',
14
- controls: { exclude: ['selectedValue', 'isOpen', 'closeList'] },
15
- docs: { page: AccessibilityDocs },
15
+ controls: { exclude: ['selectedValue', 'closeList', 'clearValidation', 'checkErrorOnBlur', 'isOpen', 'selectItem'] },
16
+ docs: {
17
+ page: AccessibilityDocs,
18
+ controls: { sort: 'none' },
19
+ },
16
20
  },
17
21
  args: {
18
22
  'onUpdate:modelValue': fn(),
19
23
  },
20
24
  argTypes: {
25
+ ...getValidationDocumentation(),
26
+
27
+ // Override : défaut false sur SyAutocomplete (la validation se déclenche à la sélection, pas à chaque frappe)
28
+ 'isValidateOnBlur': {
29
+ control: 'boolean',
30
+ description: 'Détermine si la validation doit être déclenchée lors de la saisie ou du blur de l\'input. Par défaut `false` sur ce composant : la validation se déclenche dès qu\'une option est sélectionnée.',
31
+ table: {
32
+ type: { summary: 'boolean' },
33
+ defaultValue: { summary: 'false' },
34
+ category: 'props',
35
+ },
36
+ },
37
+
21
38
  'bgColor': {
22
39
  control: 'text',
23
40
  description: 'Couleur de fond du champ',
41
+ table: { category: 'props' },
24
42
  },
25
43
  'chips': {
26
44
  control: 'boolean',
27
45
  description: 'Affiche les options sélectionnées sous forme de chips',
46
+ table: { category: 'props' },
28
47
  },
29
48
  'clearable': {
30
49
  control: 'boolean',
31
50
  description: 'Permet de vider la sélection',
32
- },
33
- 'customRules': {
34
- control: 'object',
35
- description: 'Règles de validation personnalisées',
36
- },
37
- 'customSuccessRules': {
38
- control: 'object',
39
- description: 'Règles de succès personnalisées',
40
- },
41
- 'customWarningRules': {
42
- control: 'object',
43
- description: 'Règles d\'avertissement personnalisées',
51
+ table: { category: 'props' },
44
52
  },
45
53
  'debounce': {
46
54
  control: 'number',
47
- description: 'Délai en millisecondes avant le filtrage (défaut: 200)',
55
+ description: 'Délai en millisecondes entre la dernière frappe et l\'émission de l\'événement search. Permet de limiter les appels lors d\'une recherche asynchrone.',
56
+ table: { category: 'props' },
48
57
  },
49
58
  'density': {
50
59
  control: 'select',
51
60
  options: ['default', 'comfortable', 'compact'],
52
61
  description: 'Définit la densité du champ',
53
- },
54
- 'disableErrorHandling': {
55
- control: 'boolean',
56
- description: 'Désactive la gestion des erreurs',
62
+ table: { category: 'props' },
57
63
  },
58
64
  'displayAsterisk': {
59
65
  control: 'boolean',
60
66
  description: 'Affiche un astérisque pour les champs obligatoires',
61
- },
62
- 'errorMessages': {
63
- control: 'object',
64
- description: 'Messages d\'erreur personnalisés',
67
+ table: { category: 'props' },
65
68
  },
66
69
  'filter': {
67
70
  control: 'boolean',
68
71
  description: 'Active le filtrage des options basé sur la saisie',
72
+ table: { category: 'props' },
69
73
  },
70
- 'hasError': {
71
- control: 'boolean',
72
- description: 'Indique si le champ a une erreur',
73
- },
74
- 'hasSuccess': {
75
- control: 'boolean',
76
- description: 'Indique si le champ est en succès',
77
- },
78
- 'hasWarning': {
79
- control: 'boolean',
80
- description: 'Indique si le champ a un avertissement',
74
+ 'helpText': {
75
+ control: 'text',
76
+ description: 'Texte d\'aide affiché sous le champ',
77
+ table: { category: 'props' },
81
78
  },
82
79
  'hideNoData': {
83
80
  control: 'boolean',
84
81
  description: 'Cache le message "aucune option" quand la liste est vide',
82
+ table: { category: 'props' },
85
83
  },
86
- 'isValidateOnBlur': {
87
- control: 'boolean',
88
- description: 'Valide le champ à la perte de focus',
89
- },
90
- 'items': { control: 'object' },
91
- 'label': {
92
- control: 'text',
93
- description: 'Libellé du champ',
84
+ 'items': {
85
+ control: 'object',
86
+ table: { category: 'props' },
94
87
  },
95
88
  'loading': {
96
89
  control: 'boolean',
97
90
  description: 'Affiche un indicateur de chargement',
91
+ table: { category: 'props' },
98
92
  },
99
93
  'menuId': {
100
94
  control: 'text',
101
- description: 'ID personnalisé pour le menu',
95
+ description: 'Identifiant HTML du menu déroulant. Utile pour éviter les conflits d\'ID en cas de multiples instances sur la même page.',
96
+ table: { category: 'props' },
97
+ },
98
+ 'modelValue': {
99
+ control: 'text',
100
+ table: { category: 'props' },
102
101
  },
103
- 'modelValue': { control: 'text' },
104
102
  'multiple': {
105
103
  control: 'boolean',
106
104
  description: 'Permet la sélection multiple d\'options',
105
+ table: { category: 'props' },
107
106
  },
108
107
  'noDataText': {
109
108
  control: 'text',
110
109
  description: 'Texte affiché quand aucune option n\'est disponible',
110
+ table: { category: 'props' },
111
111
  },
112
112
  'placeholder': {
113
113
  control: 'text',
114
114
  description: 'Texte d\'indice affiché quand le champ est vide',
115
+ table: { category: 'props' },
115
116
  },
116
117
  'plainTextKey': {
117
118
  control: 'text',
118
- description: 'Nom de la propriété pour le texte brut de filtrage',
119
- },
120
- 'onSearch': {
121
- action: 'search',
122
- description: 'Émis à chaque frappe dans le champ. Reçoit la valeur saisie en paramètre. Utile pour déclencher des recherches asynchrones.',
123
- },
124
- 'onUpdate:modelValue': {
125
- action: 'update:modelValue',
126
- description: 'Émis lors de la sélection d\'une option. Reçoit la valeur sélectionnée.',
127
- },
128
- 'disabled': {
129
- control: 'boolean',
130
- description: 'Désactive le champ',
131
- },
132
- 'readonly': {
133
- control: 'boolean',
134
- description: 'Rend le champ en lecture seule',
135
- },
136
- 'required': {
137
- control: 'boolean',
138
- description: 'Marque le champ comme obligatoire',
119
+ description: 'Propriété de l\'objet utilisée pour le filtrage côté client (filter: true). Si absente, c\'est textKey qui est utilisée.',
120
+ table: { category: 'props' },
139
121
  },
140
122
  'returnObject': {
141
123
  control: 'boolean',
142
- description: 'Retourne l\'objet complet sélectionné',
124
+ description: 'Retourne l\'objet complet sélectionné au lieu de la seule valeur de valueKey.',
125
+ table: { category: 'props' },
143
126
  },
144
- 'showSuccessMessages': {
145
- control: 'boolean',
146
- description: 'Affiche les messages de succès',
147
- },
148
- 'successMessages': {
149
- control: 'object',
150
- description: 'Messages de succès personnalisés',
127
+ 'selectionText': {
128
+ control: false,
129
+ description: 'Fonction de personnalisation du texte affiché dans l\'input en mode multiple. Reçoit le tableau des valeurs sélectionnées et retourne une chaîne.',
130
+ table: { category: 'props' },
151
131
  },
152
132
  'textKey': {
153
133
  control: 'text',
154
134
  description: 'Nom de la propriété qui contient le texte à afficher',
135
+ table: { category: 'props' },
155
136
  },
156
137
  'valueKey': {
157
138
  control: 'text',
158
139
  description: 'Nom de la propriété qui contient la valeur à retourner',
140
+ table: { category: 'props' },
159
141
  },
160
- 'selectionText': {
161
- control: false,
162
- description: 'Fonction de personnalisation du texte affiché dans l\'input en mode multiple. Reçoit le tableau des valeurs sélectionnées et retourne une chaîne.',
142
+ 'onSearch': {
143
+ action: 'search',
144
+ description: 'Émis à chaque frappe dans le champ. Reçoit la valeur saisie en paramètre. Utile pour déclencher des recherches asynchrones.',
145
+ table: { category: 'events' },
163
146
  },
164
- 'warningMessages': {
165
- control: 'object',
166
- description: 'Messages d\'avertissement personnalisés',
147
+ 'onUpdate:modelValue': {
148
+ action: 'update:modelValue',
149
+ description: 'Émis lors de la sélection d\'une option. Reçoit la valeur sélectionnée.',
150
+ table: { category: 'events' },
151
+ },
152
+ 'validateOnSubmit': {
153
+ control: false,
154
+ description: 'Déclenche la validation du champ (équivalent à un submit de formulaire). Retourne une promesse résolue en `true` si le champ est valide.',
155
+ table: { category: 'expose' },
167
156
  },
168
157
  },
169
158
  } as Meta<typeof SyAutocomplete>
@@ -187,7 +176,7 @@ const sampleItems = [
187
176
 
188
177
  export const Default: Story = {
189
178
  parameters: {
190
-
179
+ docs: { controls: { sort: 'none' } },
191
180
  sourceCode: [
192
181
  {
193
182
  name: 'Template',
@@ -249,122 +238,84 @@ export const Default: Story = {
249
238
  },
250
239
  }
251
240
 
252
- export const FormValidation: Story = {
241
+ export const HelpText: Story = {
253
242
  parameters: {
254
- docs: {
255
- description: {
256
- story: 'Le champ requis ne montre l\'erreur qu\'après interaction (blur/submit), pas au mount.',
257
- },
258
- },
259
243
  sourceCode: [
260
244
  {
261
245
  name: 'Template',
262
246
  code: `
263
247
  <template>
264
- <SyForm @submit="onSubmit">
265
- <SyAutocomplete
266
- v-model="value"
267
- :items="items"
268
- label="Recherche obligatoire"
269
- required
270
- display-asterisk
271
- class="mb-4"
272
- />
273
- <VBtn type="submit" color="primary">Soumettre</VBtn>
274
- </SyForm>
248
+ <SyAutocomplete
249
+ v-model="selectedValue"
250
+ :items="items"
251
+ label="Rechercher un prénom"
252
+ help-text="Texte d'aide à la saisie"
253
+ />
275
254
  </template>
276
- `,
255
+ `,
277
256
  },
278
257
  {
279
258
  name: 'Script',
280
259
  code: `
281
260
  <script setup lang="ts">
282
261
  import { ref } from 'vue'
283
- import { SyAutocomplete, SyForm } from '@cnamts/synapse'
284
- import { VBtn } from 'vuetify/components'
262
+ import { SyAutocomplete } from '@cnamts/synapse'
285
263
 
286
- const value = ref('')
264
+ const selectedValue = ref('')
287
265
  const items = [
288
- { text: 'Option 1', value: '1' },
289
- { text: 'Option 2', value: '2' },
290
- { text: 'Option 3', value: '3' }
266
+ { text: 'Adrien', value: 'Adrien' },
267
+ { text: 'Axel', value: 'Axel' },
268
+ { text: 'Baptiste', value: 'Baptiste' },
269
+ { text: 'Clement', value: 'Clement' },
270
+ { text: 'Corentin', value: 'Corentin' },
271
+ { text: 'Damien', value: 'Damien' },
272
+ { text: 'David', value: 'David' },
273
+ { text: 'Eloi', value: 'Eloi' },
274
+ { text: 'Louis', value: 'Louis' },
275
+ { text: 'Valentin', value: 'Valentin' },
291
276
  ]
292
-
293
- const onSubmit = (event) => {
294
- if (event.isValid) {
295
- alert('Formulaire valide : ' + JSON.stringify(value.value))
296
- } else {
297
- alert('Formulaire invalide : veuillez choisir une option.')
298
- }
299
- }
300
277
  </script>
301
- `,
278
+ `,
302
279
  },
303
280
  ],
304
281
  },
305
282
  args: {
306
- items: [
307
- { text: 'Option 1', value: '1' },
308
- { text: 'Option 2', value: '2' },
309
- { text: 'Option 3', value: '3' },
310
- ],
311
- label: 'Recherche obligatoire',
312
- required: true,
313
- displayAsterisk: true,
283
+ items: sampleItems,
284
+ label: 'Rechercher un prénom',
285
+ helpText: 'Texte d\'aide à la saisie',
314
286
  },
315
287
  render: (args) => {
316
288
  return {
317
- components: { SyAutocomplete, SyForm, VBtn },
289
+ components: { SyAutocomplete },
318
290
  setup() {
319
- const value = ref('')
320
-
321
- const onSubmit = (event: { isValid: boolean }) => {
322
- if (event.isValid) {
323
- alert(`Formulaire valide : ${JSON.stringify(value.value)}`)
324
- }
325
- else {
326
- alert('Formulaire invalide : veuillez choisir une option.')
327
- }
328
- }
329
-
330
- return { args, value, onSubmit }
291
+ const selectedValue = ref('')
292
+ return { args, selectedValue }
331
293
  },
332
294
  template: `
333
295
  <div class="pa-4">
334
- <SyForm @submit="onSubmit">
335
- <SyAutocomplete
336
- v-model="value"
337
- v-bind="args"
338
- class="mb-4"
339
- />
340
- <VBtn type="submit" color="primary">Soumettre</VBtn>
341
- </SyForm>
296
+ <SyAutocomplete
297
+ v-model="selectedValue"
298
+ v-bind="args"
299
+ />
342
300
  </div>
343
301
  `,
344
302
  }
345
303
  },
346
304
  }
347
305
 
348
- export const ExternalErrorToggle: Story = {
306
+ export const Required: Story = {
349
307
  parameters: {
350
- docs: {
351
- description: {
352
- story: 'Démontre l\'affichage d\'un message d\'erreur externe injecté via `error-messages`.',
353
- },
354
- },
355
308
  sourceCode: [
356
309
  {
357
310
  name: 'Template',
358
311
  code: `
359
312
  <template>
360
313
  <SyAutocomplete
361
- v-model="value"
314
+ v-model="selectedValue"
362
315
  :items="items"
363
- label="Erreur serveur"
364
- :error-messages="errorMessages"
316
+ label="Champ obligatoire"
317
+ required
365
318
  />
366
- <VBtn class="mt-2" @click="triggerError">Déclencher l'erreur</VBtn>
367
- <VBtn class="mt-2 ml-2" variant="text" @click="clearError">Effacer</VBtn>
368
319
  </template>
369
320
  `,
370
321
  },
@@ -374,22 +325,12 @@ export const ExternalErrorToggle: Story = {
374
325
  <script setup lang="ts">
375
326
  import { ref } from 'vue'
376
327
  import { SyAutocomplete } from '@cnamts/synapse'
377
- import { VBtn } from 'vuetify/components'
378
328
 
379
- const value = ref('')
329
+ const selectedValue = ref()
380
330
  const items = [
381
331
  { text: 'Option 1', value: '1' },
382
- { text: 'Option 2', value: '2' }
332
+ { text: 'Option 2', value: '2' },
383
333
  ]
384
- const errorMessages = ref<string[]>([])
385
-
386
- const triggerError = () => {
387
- errorMessages.value = ['Erreur serveur : sélection invalide']
388
- }
389
-
390
- const clearError = () => {
391
- errorMessages.value = []
392
- }
393
334
  </script>
394
335
  `,
395
336
  },
@@ -400,78 +341,83 @@ const clearError = () => {
400
341
  { text: 'Option 1', value: '1' },
401
342
  { text: 'Option 2', value: '2' },
402
343
  ],
403
- label: 'Erreur serveur',
344
+ label: 'Champ obligatoire',
345
+ required: true,
404
346
  },
405
347
  render: (args) => {
406
348
  return {
407
- components: { SyAutocomplete, VBtn },
349
+ components: { SyAutocomplete },
408
350
  setup() {
409
- const value = ref('')
410
- const errorMessages = ref<string[]>([])
411
- const triggerError = () => {
412
- errorMessages.value = ['Erreur serveur : sélection invalide']
413
- }
414
- const clearError = () => {
415
- errorMessages.value = []
416
- }
417
- return { args, value, errorMessages, triggerError, clearError }
351
+ const selectedValue = ref()
352
+ return { args, selectedValue }
418
353
  },
419
354
  template: `
420
- <div class="pa-4 d-flex flex-column gap-2">
355
+ <div class="pa-4">
421
356
  <SyAutocomplete
422
- v-model="value"
357
+ v-model="selectedValue"
423
358
  v-bind="args"
424
- :error-messages="errorMessages"
425
359
  />
426
- <div class="d-flex align-center gap-2">
427
- <VBtn color="error" @click="triggerError">Déclencher l'erreur</VBtn>
428
- <VBtn variant="text" @click="clearError">Effacer</VBtn>
429
- </div>
430
360
  </div>
431
361
  `,
432
362
  }
433
363
  },
434
364
  }
435
365
 
436
- export const WarningSuccessMessages: Story = {
366
+ export const RequiredWithAsterisk: Story = {
437
367
  parameters: {
438
- docs: {
439
- description: {
440
- story: 'Déclenche un warning si "Option 1" est choisi et un succès si "Option 2" est choisi.',
368
+ sourceCode: [
369
+ {
370
+ name: 'Template',
371
+ code: `
372
+ <template>
373
+ <SyAutocomplete
374
+ v-model="selectedValue"
375
+ :items="items"
376
+ label="Champ obligatoire"
377
+ required
378
+ display-asterisk
379
+ />
380
+ </template>
381
+ `,
441
382
  },
442
- },
383
+ {
384
+ name: 'Script',
385
+ code: `
386
+ <script setup lang="ts">
387
+ import { ref } from 'vue'
388
+ import { SyAutocomplete } from '@cnamts/synapse'
389
+
390
+ const selectedValue = ref()
391
+ const items = [
392
+ { text: 'Option 1', value: '1' },
393
+ { text: 'Option 2', value: '2' },
394
+ ]
395
+ </script>
396
+ `,
397
+ },
398
+ ],
443
399
  },
444
400
  args: {
445
401
  items: [
446
402
  { text: 'Option 1', value: '1' },
447
403
  { text: 'Option 2', value: '2' },
448
404
  ],
449
- label: 'Avec warning & succès',
405
+ label: 'Champ obligatoire',
406
+ required: true,
407
+ displayAsterisk: true,
450
408
  },
451
409
  render: (args) => {
452
410
  return {
453
411
  components: { SyAutocomplete },
454
412
  setup() {
455
- const value = ref('')
456
- const warningMessages = ref<string[]>([])
457
- const successMessages = ref<string[]>([])
458
-
459
- const handleChange = (newVal: unknown) => {
460
- value.value = newVal as string
461
- warningMessages.value = newVal === '1' ? ['Attention: Option 1 choisie'] : []
462
- successMessages.value = newVal === '2' ? ['Succès: Option 2 valide'] : []
463
- }
464
-
465
- return { args, value, warningMessages, successMessages, handleChange }
413
+ const selectedValue = ref()
414
+ return { args, selectedValue }
466
415
  },
467
416
  template: `
468
417
  <div class="pa-4">
469
418
  <SyAutocomplete
470
- v-model="value"
419
+ v-model="selectedValue"
471
420
  v-bind="args"
472
- :warning-messages="warningMessages"
473
- :success-messages="successMessages"
474
- @update:modelValue="handleChange"
475
421
  />
476
422
  </div>
477
423
  `,
@@ -908,69 +854,6 @@ const loadOnClick = () => {
908
854
  },
909
855
  }
910
856
 
911
- export const RequiredField: Story = {
912
- parameters: {
913
-
914
- sourceCode: [
915
- {
916
- name: 'Template',
917
- code: `
918
- <template>
919
- <SyAutocomplete
920
- v-model="selectedValue"
921
- :items="items"
922
- label="Champ obligatoire"
923
- required
924
- display-asterisk
925
- />
926
- </template>
927
- `,
928
- },
929
- {
930
- name: 'Script',
931
- code: `
932
- <script setup lang="ts">
933
- import { ref } from 'vue'
934
- import { SyAutocomplete } from '@cnamts/synapse'
935
-
936
- const selectedValue = ref()
937
- const items = [
938
- { text: 'Option 1', value: '1' },
939
- { text: 'Option 2', value: '2' },
940
- ]
941
- </script>
942
- `,
943
- },
944
- ],
945
- },
946
- args: {
947
- items: [
948
- { text: 'Option 1', value: '1' },
949
- { text: 'Option 2', value: '2' },
950
- ],
951
- label: 'Champ obligatoire',
952
- required: true,
953
- displayAsterisk: true,
954
- },
955
- render: (args) => {
956
- return {
957
- components: { SyAutocomplete },
958
- setup() {
959
- const selectedValue = ref()
960
- return { args, selectedValue }
961
- },
962
- template: `
963
- <div class="pa-4">
964
- <SyAutocomplete
965
- v-model="selectedValue"
966
- v-bind="args"
967
- />
968
- </div>
969
- `,
970
- }
971
- },
972
- }
973
-
974
857
  export const HideDetails: Story = {
975
858
  parameters: {
976
859
  sourceCode: [
@@ -1058,88 +941,6 @@ const value2 = ref('1')
1058
941
  },
1059
942
  }
1060
943
 
1061
- export const DisableErrorHandling: Story = {
1062
- parameters: {
1063
- sourceCode: [
1064
- {
1065
- name: 'Template',
1066
- code: `
1067
- <template>
1068
- <div class="d-flex flex-column gap-4">
1069
- <SyAutocomplete
1070
- v-model="value1"
1071
- :items="items"
1072
- label="Avec validation interne (défaut)"
1073
- required
1074
- />
1075
-
1076
- <SyAutocomplete
1077
- v-model="value2"
1078
- :items="items"
1079
- label="Validation interne désactivée"
1080
- required
1081
- disable-error-handling
1082
- />
1083
- </div>
1084
- </template>
1085
- `,
1086
- },
1087
- {
1088
- name: 'Script',
1089
- code: `
1090
- <script setup lang="ts">
1091
- import { ref } from 'vue'
1092
- import { SyAutocomplete } from '@cnamts/synapse'
1093
-
1094
- const items = [
1095
- { text: 'Option 1', value: '1' },
1096
- { text: 'Option 2', value: '2' },
1097
- { text: 'Option 3', value: '3' },
1098
- ]
1099
-
1100
- const value1 = ref(null)
1101
- const value2 = ref(null)
1102
- </script>
1103
- `,
1104
- },
1105
- ],
1106
- },
1107
- args: {
1108
- items: [
1109
- { text: 'Option 1', value: '1' },
1110
- { text: 'Option 2', value: '2' },
1111
- { text: 'Option 3', value: '3' },
1112
- ],
1113
- },
1114
- render: (args) => {
1115
- return {
1116
- components: { SyAutocomplete },
1117
- setup() {
1118
- const value1 = ref(null)
1119
- const value2 = ref(null)
1120
- return { args, value1, value2 }
1121
- },
1122
- template: `
1123
- <div class="pa-4 d-flex flex-column" style="gap: 16px;">
1124
- <SyAutocomplete
1125
- v-model="value1"
1126
- v-bind="args"
1127
- label="Avec validation interne (défaut)"
1128
- required
1129
- />
1130
- <SyAutocomplete
1131
- v-model="value2"
1132
- v-bind="args"
1133
- label="Validation interne désactivée"
1134
- required
1135
- disable-error-handling
1136
- />
1137
- </div>
1138
- `,
1139
- }
1140
- },
1141
- }
1142
-
1143
944
  export const ReadonlyField: Story = {
1144
945
  parameters: {
1145
946
 
@@ -1265,6 +1066,137 @@ const items = [
1265
1066
  },
1266
1067
  }
1267
1068
 
1069
+ export const PrependItem: Story = {
1070
+ parameters: {
1071
+ docs: {
1072
+ description: {
1073
+ story: 'Le slot `#prepend-item` permet d\'insérer du contenu personnalisé en tête de la liste déroulante. Exemple typique : un bouton « Tous » pour la sélection multiple, avec état indéterminé quand la sélection est partielle.',
1074
+ },
1075
+ },
1076
+ sourceCode: [
1077
+ {
1078
+ name: 'Template',
1079
+ code: `
1080
+ <template>
1081
+ <SyAutocomplete
1082
+ v-model="selectedValues"
1083
+ :items="items"
1084
+ label="Sélectionner des prénoms"
1085
+ multiple
1086
+ clearable
1087
+ >
1088
+ <template #prepend-item>
1089
+ <VListItem
1090
+ role="option"
1091
+ :aria-selected="allSelected ? 'true' : 'false'"
1092
+ @mousedown.prevent
1093
+ @click="toggleAll"
1094
+ >
1095
+ <template #prepend>
1096
+ <div aria-hidden="true" inert>
1097
+ <VCheckbox
1098
+ :model-value="allSelected"
1099
+ :indeterminate="someSelected"
1100
+ density="compact"
1101
+ hide-details
1102
+ color="primary"
1103
+ class="mt-0 pt-0 mr-1"
1104
+ />
1105
+ </div>
1106
+ </template>
1107
+ <VListItemTitle>Tous</VListItemTitle>
1108
+ </VListItem>
1109
+ <VDivider role="none" />
1110
+ </template>
1111
+ </SyAutocomplete>
1112
+ <div class="mt-4">Valeurs sélectionnées : {{ selectedValues }}</div>
1113
+ </template>`,
1114
+ },
1115
+ {
1116
+ name: 'Script',
1117
+ code: `
1118
+ <script setup lang="ts">
1119
+ import { computed, ref } from 'vue'
1120
+ import { SyAutocomplete } from '@cnamts/synapse'
1121
+ import { VCheckbox, VDivider, VListItem, VListItemTitle } from 'vuetify/components'
1122
+
1123
+ const items = [
1124
+ { text: 'Adrien', value: 'Adrien' },
1125
+ { text: 'Axel', value: 'Axel' },
1126
+ { text: 'Baptiste', value: 'Baptiste' },
1127
+ { text: 'Clement', value: 'Clement' },
1128
+ { text: 'Corentin', value: 'Corentin' },
1129
+ { text: 'Damien', value: 'Damien' },
1130
+ { text: 'David', value: 'David' },
1131
+ { text: 'Eloi', value: 'Eloi' },
1132
+ { text: 'Louis', value: 'Louis' },
1133
+ { text: 'Valentin', value: 'Valentin' },
1134
+ ]
1135
+
1136
+ const selectedValues = ref([])
1137
+ const allSelected = computed(() => Array.isArray(selectedValues.value) && selectedValues.value.length === items.length)
1138
+ const someSelected = computed(() => Array.isArray(selectedValues.value) && selectedValues.value.length > 0 && !allSelected.value)
1139
+
1140
+ const toggleAll = () => {
1141
+ selectedValues.value = allSelected.value ? [] : items.map(i => i.value)
1142
+ }
1143
+ </script>`,
1144
+ },
1145
+ ],
1146
+ },
1147
+ args: {
1148
+ items: sampleItems,
1149
+ label: 'Sélectionner des prénoms',
1150
+ multiple: true,
1151
+ clearable: true,
1152
+ },
1153
+ render: args => ({
1154
+ components: { SyAutocomplete, VCheckbox, VDivider, VListItem, VListItemTitle },
1155
+ setup() {
1156
+ const selectedValues = ref<string[]>([])
1157
+ const allSelected = computed(() => Array.isArray(selectedValues.value) && selectedValues.value.length === sampleItems.length)
1158
+ const someSelected = computed(() => Array.isArray(selectedValues.value) && selectedValues.value.length > 0 && !allSelected.value)
1159
+ const toggleAll = () => {
1160
+ selectedValues.value = allSelected.value ? [] : sampleItems.map(i => i.value)
1161
+ }
1162
+ return { args, selectedValues, allSelected, someSelected, toggleAll }
1163
+ },
1164
+ template: `
1165
+ <div class="pa-4">
1166
+ <SyAutocomplete
1167
+ v-model="selectedValues"
1168
+ v-bind="args"
1169
+ >
1170
+ <template #prepend-item>
1171
+ <VListItem
1172
+ role="option"
1173
+ :aria-selected="allSelected ? 'true' : 'false'"
1174
+ @mousedown.prevent
1175
+ @click="toggleAll"
1176
+ >
1177
+ <template #prepend>
1178
+ <div aria-hidden="true" inert>
1179
+ <VCheckbox
1180
+ :model-value="allSelected"
1181
+ :indeterminate="someSelected"
1182
+ density="compact"
1183
+ hide-details
1184
+ color="primary"
1185
+ class="mt-0 pt-0 mr-1"
1186
+ />
1187
+ </div>
1188
+ </template>
1189
+ <VListItemTitle>Tous</VListItemTitle>
1190
+ </VListItem>
1191
+ <VDivider role="none" />
1192
+ </template>
1193
+ </SyAutocomplete>
1194
+ <div class="mt-4">Valeurs sélectionnées : {{ selectedValues }}</div>
1195
+ </div>
1196
+ `,
1197
+ }),
1198
+ }
1199
+
1268
1200
  export const WithCustomKeys: Story = {
1269
1201
  parameters: {
1270
1202