@cnamts/synapse 1.0.4 → 1.0.6

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 (206) hide show
  1. package/dist/DateFilter-BlOpwEVq.js +98 -0
  2. package/dist/NumberFilter-BPUXE4wY.js +121 -0
  3. package/dist/PeriodFilter-B2yx329_.js +112 -0
  4. package/dist/SelectFilter-CedKn1oV.js +136 -0
  5. package/dist/TextFilter-DkhJjRtR.js +114 -0
  6. package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordion.d.ts +103 -0
  7. package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/AmeliproAccordionTemplate.d.ts +105 -0
  8. package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +3 -3
  9. package/dist/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.d.ts +132 -0
  10. package/dist/components/Amelipro/AmeliproCaptcha/types.d.ts +5 -0
  11. package/dist/components/Amelipro/AmeliproCard/AmeliproCard.d.ts +3 -3
  12. package/dist/components/Amelipro/AmeliproCustomSelector/AmeliproCustomSelector.d.ts +126 -0
  13. package/dist/components/Amelipro/AmeliproCustomSelector/types.d.ts +6 -0
  14. package/dist/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.d.ts +1 -1
  15. package/dist/components/Amelipro/AmeliproMultipleFoldingCard/AmeliproMultipleFoldingCard.d.ts +1 -1
  16. package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +3 -3
  17. package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +190 -0
  18. package/dist/components/Amelipro/AmeliproTable/types.d.ts +34 -0
  19. package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +3 -3
  20. package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +1 -1
  21. package/dist/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.d.ts +1 -1
  22. package/dist/components/Amelipro/types.d.ts +6 -0
  23. package/dist/components/CookieBanner/CookieBanner.d.ts +1 -1
  24. package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +11 -2
  25. package/dist/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.d.ts +6 -1
  26. package/dist/components/Customs/SyTextField/SyTextField.d.ts +3 -1
  27. package/dist/components/DataList/DataList.d.ts +9 -0
  28. package/dist/components/DataListGroup/DataListGroup.d.ts +10 -1
  29. package/dist/components/DataListItem/DataListItem.d.ts +1 -1
  30. package/dist/components/DataListItem/config.d.ts +1 -1
  31. package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +18 -8
  32. package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +16 -6
  33. package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +6 -1
  34. package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +17 -8
  35. package/dist/components/DatePicker/composables/useKeyboardEvents.d.ts +41 -0
  36. package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +4 -9
  37. package/dist/components/DatePicker/utils/dateFormattingUtils.d.ts +72 -0
  38. package/dist/components/DatePicker/utils/validationUtils.d.ts +38 -0
  39. package/dist/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.d.ts +9 -3
  40. package/dist/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.d.ts +6 -1
  41. package/dist/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.d.ts +11 -1
  42. package/dist/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.d.ts +11 -1
  43. package/dist/components/HeaderBar/HeaderBurgerMenu/locals.d.ts +2 -0
  44. package/dist/components/HeaderBar/HeaderBurgerMenu/useMenuPosition.d.ts +4 -0
  45. package/dist/components/NirField/NirField.d.ts +14 -4
  46. package/dist/components/PeriodField/PeriodField.d.ts +24 -4
  47. package/dist/components/Tables/common/SyTablePagination.d.ts +10 -0
  48. package/dist/components/index.d.ts +4 -0
  49. package/dist/composables/index.d.ts +1 -0
  50. package/dist/composables/usePagination.d.ts +16 -0
  51. package/dist/design-system-v3.js +165 -160
  52. package/dist/design-system-v3.umd.cjs +120 -138
  53. package/dist/directives/lockFocus.d.ts +17 -0
  54. package/dist/{main-BzyNNvHX.js → main-BXPFSAB4.js} +14664 -13282
  55. package/dist/style.css +1 -0
  56. package/package.json +5 -2
  57. package/src/assets/amelipro/apTheme.scss +149 -0
  58. package/src/assets/amelipro/apTokens.scss +0 -148
  59. package/src/assets/overrides/_btns.scss +15 -0
  60. package/src/assets/overrides/_container.scss +36 -0
  61. package/src/assets/overrides/_forms.scss +7 -0
  62. package/src/assets/{_spacers.scss → overrides/_spacers.scss} +0 -7
  63. package/src/assets/overrides/_tables.scss +18 -0
  64. package/src/assets/overrides/_tooltips.scss +10 -0
  65. package/src/assets/overrides/_typography.scss +196 -0
  66. package/src/assets/settings.scss +11 -51
  67. package/src/assets/themes.scss +10 -0
  68. package/src/assets/tokens.scss +9 -156
  69. package/src/components/Accordion/composables/__tests__/useAccordionGroupCommunication.spec.ts +80 -40
  70. package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.mdx +15 -0
  71. package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.stories.ts +83 -0
  72. package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.vue +86 -0
  73. package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/AmeliproAccordionTemplate.vue +242 -0
  74. package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/__tests__/AmeliproAccordionTemplate.spec.ts +20 -0
  75. package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordionTemplate/__tests__/__snapshots__/AmeliproAccordionTemplate.spec.ts.snap +124 -0
  76. package/src/components/Amelipro/AmeliproAccordion/__tests__/AmeliproAccordion.spec.ts +20 -0
  77. package/src/components/Amelipro/AmeliproAccordion/__tests__/__snapshots__/AmeliproAccordion.spec.ts.snap +124 -0
  78. package/src/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.mdx +15 -0
  79. package/src/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.stories.ts +87 -0
  80. package/src/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.vue +233 -0
  81. package/src/components/Amelipro/AmeliproCaptcha/__tests__/AmeliproCaptcha.spec.ts +24 -0
  82. package/src/components/Amelipro/AmeliproCaptcha/__tests__/__snapshots__/AmeliproCaptcha.spec.ts.snap +384 -0
  83. package/src/components/Amelipro/AmeliproCaptcha/types.d.ts +5 -0
  84. package/src/components/Amelipro/AmeliproCustomSelector/AmeliproCustomSelector.mdx +15 -0
  85. package/src/components/Amelipro/AmeliproCustomSelector/AmeliproCustomSelector.stories.ts +143 -0
  86. package/src/components/Amelipro/AmeliproCustomSelector/AmeliproCustomSelector.vue +351 -0
  87. package/src/components/Amelipro/AmeliproCustomSelector/__tests__/AmeliproCustomSelector.spec.ts +50 -0
  88. package/src/components/Amelipro/AmeliproCustomSelector/__tests__/__snapshots__/AmeliproCustomSelector.spec.ts.snap +186 -0
  89. package/src/components/Amelipro/AmeliproCustomSelector/types.d.ts +6 -0
  90. package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/tests/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +1 -1
  91. package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/tests/__snapshots__/AmeliproHeaderBar.spec.ts.snap +1 -1
  92. package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +1 -708
  93. package/src/components/Amelipro/AmeliproMenu/tests/__snapshots__/AmeliproMenu.spec.ts.snap +1 -1
  94. package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +1 -708
  95. package/src/components/Amelipro/AmeliproTable/AmeliproTable.mdx +22 -0
  96. package/src/components/Amelipro/AmeliproTable/AmeliproTable.stories.ts +550 -0
  97. package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +421 -0
  98. package/src/components/Amelipro/AmeliproTable/__tests__/AmeliproTable.spec.ts +72 -0
  99. package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +427 -0
  100. package/src/components/Amelipro/AmeliproTable/types.d.ts +34 -0
  101. package/src/components/Amelipro/ServiceMenu/ServiceMenu.vue +12 -1
  102. package/src/components/Amelipro/ServiceMenu/tests/__snapshots__/ServiceMenu.spec.ts.snap +0 -820
  103. package/src/components/Amelipro/types.ts +8 -0
  104. package/src/components/CollapsibleList/CollapsibleList.vue +0 -2
  105. package/src/components/CookieBanner/CookieBanner.vue +1 -3
  106. package/src/components/CopyBtn/CopyBtn.vue +9 -2
  107. package/src/components/CopyBtn/tests/CopyBtn.spec.ts +3 -1
  108. package/src/components/Customs/Selects/SySelect/Accessibilite.mdx +7 -0
  109. package/src/components/Customs/Selects/SySelect/Accessibilite.stories.ts +4 -1
  110. package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +80 -0
  111. package/src/components/Customs/Selects/SySelect/SySelect.vue +280 -34
  112. package/src/components/Customs/Selects/SySelect/composables/tests/useSySelectKeyboard.spec.ts +14 -5
  113. package/src/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.ts +129 -12
  114. package/src/components/Customs/SyIcon/SyIcon.spec.ts +3 -0
  115. package/src/components/Customs/SyTextField/Accessibilite.stories.ts +3 -1
  116. package/src/components/Customs/SyTextField/SyTextField.stories.ts +79 -6
  117. package/src/components/Customs/SyTextField/SyTextField.vue +218 -24
  118. package/src/components/DataList/Accessibilite.stories.ts +4 -0
  119. package/src/components/DataList/DataList.vue +19 -12
  120. package/src/components/DataListGroup/Accessibilite.stories.ts +4 -0
  121. package/src/components/DataListGroup/DataListGroup.vue +32 -15
  122. package/src/components/DataListItem/DataListItem.vue +14 -11
  123. package/src/components/DataListItem/config.ts +1 -1
  124. package/src/components/DataListItem/tests/DataListItem.spec.ts +2 -2
  125. package/src/components/DatePicker/CalendarMode/DatePicker.vue +12 -7
  126. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +174 -0
  127. package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +27 -5
  128. package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +286 -0
  129. package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +1 -1
  130. package/src/components/DatePicker/DateTextInput/DateTextInput.vue +29 -31
  131. package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +11 -3
  132. package/src/components/DatePicker/composables/useDateInputEditing.ts +73 -209
  133. package/src/components/DatePicker/composables/useKeyboardEvents.ts +149 -0
  134. package/src/components/DatePicker/composables/useManualDateValidation.ts +27 -68
  135. package/src/components/DatePicker/utils/dateFormattingUtils.ts +228 -0
  136. package/src/components/DatePicker/utils/validationUtils.ts +90 -0
  137. package/src/components/DialogBox/Accessibilite.stories.ts +4 -0
  138. package/src/components/DialogBox/DialogBox.stories.ts +10 -10
  139. package/src/components/DialogBox/DialogBox.vue +83 -21
  140. package/src/components/DialogBox/tests/__snapshots__/DialogBox.spec.ts.snap +12 -6
  141. package/src/components/FileUpload/tests/FileUpload.spec.ts +3 -0
  142. package/src/components/FooterBar/FooterBar.vue +1 -0
  143. package/src/components/HeaderBar/Accessibilite.stories.ts +4 -0
  144. package/src/components/HeaderBar/HeaderBar.mdx +47 -22
  145. package/src/components/HeaderBar/HeaderBar.stories.ts +54 -13
  146. package/src/components/HeaderBar/HeaderBar.vue +2 -1
  147. package/src/components/HeaderBar/HeaderBurgerMenu/Accessibilite.stories.ts +4 -0
  148. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.stories.ts +160 -82
  149. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.vue +41 -56
  150. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.vue +10 -3
  151. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.vue +41 -18
  152. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/tests/HeaderMenuSection.spec.ts +7 -2
  153. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +36 -9
  154. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.vue +41 -9
  155. package/src/components/HeaderBar/HeaderBurgerMenu/locals.ts +2 -0
  156. package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +1 -1
  157. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderBurgerMenu.spec.ts.snap +8 -3
  158. package/src/components/HeaderBar/HeaderBurgerMenu/useMenuPosition.ts +50 -0
  159. package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +5 -5
  160. package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +7 -4
  161. package/src/components/HeaderBar/locales.ts +1 -1
  162. package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +2 -1
  163. package/src/components/HeaderLoading/HeaderLoading.vue +0 -1
  164. package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +2 -0
  165. package/src/components/LangBtn/LangBtn.vue +0 -3
  166. package/src/components/LogoBrandSection/Accessibilite.stories.ts +4 -1
  167. package/src/components/LogoBrandSection/LogoBrandSection.stories.ts +2 -2
  168. package/src/components/LogoBrandSection/LogoBrandSection.vue +13 -8
  169. package/src/components/LogoBrandSection/locales.ts +1 -1
  170. package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +1 -1
  171. package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +6 -4
  172. package/src/components/NirField/NirField.vue +5 -5
  173. package/src/components/NirField/tests/NirField.spec.ts +78 -12
  174. package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +104 -6
  175. package/src/components/Tables/common/TableHeader.vue +10 -7
  176. package/src/components/Tables/common/tableAccessibilityUtils.ts +13 -2
  177. package/src/components/Tables/common/useTableAria.ts +17 -1
  178. package/src/components/UserMenuBtn/tests/UserMenuBtn.spec.ts +2 -1
  179. package/src/components/index.ts +4 -0
  180. package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +34 -5
  181. package/src/composables/index.ts +3 -0
  182. package/src/composables/useFilterable/useFilterable.ts +13 -1
  183. package/src/composables/usePagination.ts +103 -0
  184. package/src/directives/lockFocus.ts +48 -0
  185. package/src/main.ts +1 -2
  186. package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +1 -8
  187. package/src/stories/Accessibilite/{Aculturation/AuditDesignSystem.mdx → AuditDesignSystem.mdx} +1 -1
  188. package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru/FauxPositifs.mdx +102 -0
  189. package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru/FauxPositifs.stories.ts +219 -0
  190. package/src/stories/Accessibilite/KitDePreAudit/Outils/{Tanaguru.mdx → Tanaguru/Utilisation.mdx} +1 -1
  191. package/src/stories/DesignTokens/ColorIntegrationExample.vue +43 -0
  192. package/src/stories/DesignTokens/Colors.mdx +2 -0
  193. package/src/stories/DesignTokens/colors.stories.ts +9 -0
  194. package/src/vuetifyConfig.ts +3 -3
  195. package/dist/DateFilter-yrwJv_2R.js +0 -95
  196. package/dist/NumberFilter-BQXtywZI.js +0 -117
  197. package/dist/PeriodFilter-BYXVSzr5.js +0 -108
  198. package/dist/SelectFilter-CJV_mlN3.js +0 -133
  199. package/dist/TextFilter-DN0ejYIs.js +0 -110
  200. package/dist/design-system-v3.css +0 -1
  201. package/dist/directives/letterSpacing.d.ts +0 -27
  202. package/src/assets/_fonts.scss +0 -6
  203. package/src/assets/_typography.scss +0 -157
  204. package/src/directives/letterSpacing.ts +0 -233
  205. /package/src/assets/{_elevations.scss → overrides/_elevations.scss} +0 -0
  206. /package/src/assets/{_radius.scss → overrides/_radius.scss} +0 -0
@@ -1,3 +1,9 @@
1
+ /*
2
+ * CNAM Design System
3
+ * Tokens and settings for the CNAM and PA themes.
4
+ * This file must not contain any styles as it will be duplicated many times.
5
+ */
6
+
1
7
  // Primitives
2
8
  $orange-darken-80: #2d100b;
3
9
  $orange-darken-60: #5a2017;
@@ -311,89 +317,7 @@ $heading-2-font-size: 20px;
311
317
  $heading-3-font-size: 16px;
312
318
  $heading-4-font-size: 14px;
313
319
 
314
- .title {
315
- font-size: $font-size-title !important;
316
- }
317
-
318
- .alt-title {
319
- font-size: $font-size-alt-title !important;
320
- }
321
-
322
- .body-text {
323
- font-size: $font-size-body-text !important;
324
- }
325
-
326
- .link-label {
327
- font-size: $font-size-link-label !important;
328
- }
329
-
330
- h1 {
331
- font-size: 32px !important;
332
- line-height: 130% !important;
333
- }
334
-
335
- .h1-bold {
336
- font-size: 32px !important;
337
- font-weight: bold !important;
338
- line-height: 130% !important;
339
- }
340
-
341
- h2 {
342
- font-size: 28px !important;
343
- line-height: 130% !important;
344
- }
345
-
346
- .h2-bold {
347
- font-size: 28px !important;
348
- font-weight: bold !important;
349
- line-height: 130% !important;
350
- }
351
-
352
- h3 {
353
- font-size: 24px !important;
354
- line-height: 130% !important;
355
- }
356
-
357
- .h3-bold {
358
- font-size: 24px !important;
359
- font-weight: bold !important;
360
- line-height: 130% !important;
361
- }
362
-
363
- h4 {
364
- font-size: 20px !important;
365
- line-height: 130% !important;
366
- }
367
-
368
- .h4-bold {
369
- font-size: 20px !important;
370
- font-weight: bold !important;
371
- line-height: 130% !important;
372
- }
373
-
374
- .display-1 {
375
- font-size: 40px !important;
376
- line-height: 130% !important;
377
- }
378
-
379
- .display-1-bold {
380
- font-size: 40px !important;
381
- font-weight: bold !important;
382
- line-height: 130% !important;
383
- }
384
-
385
- .display-2 {
386
- font-size: 30px !important;
387
- line-height: 130% !important;
388
- }
389
-
390
- .display-2-bold {
391
- font-size: 30px !important;
392
- font-weight: bold !important;
393
- line-height: 130% !important;
394
- }
395
-
396
- // espacement verticaux des elements
320
+ // vertical spacing
397
321
 
398
322
  $spacing-none: 0;
399
323
  $spacing-xx-small: 4px;
@@ -406,7 +330,7 @@ $spacing-xx-large: 56px;
406
330
  $spacing-xxx-large: 64px;
407
331
  $spacing-huge: 80px;
408
332
 
409
- // espacement horizontaux des elements
333
+ // horizontal spacing
410
334
 
411
335
  $spacing-horizontal-none: 0;
412
336
  $spacing-horizontal-xx-small: 4px;
@@ -419,79 +343,8 @@ $spacing-horizontal-xx-large: 56px;
419
343
  $spacing-horizontal-xxx-large: 64px;
420
344
  $spacing-horizontal-huge: 80px;
421
345
 
422
- .theme-cnam,
423
- .theme-pa {
424
- // Surcharger toutes les élévations pour utiliser uniquement l'élévation 02
425
- .elevation-1,
426
- .elevation-2,
427
- .elevation-3,
428
- .elevation-4,
429
- .elevation-5,
430
- .elevation-6,
431
- .elevation-7,
432
- .elevation-8,
433
- .elevation-9,
434
- .elevation-10,
435
- .elevation-11,
436
- .elevation-12,
437
- .elevation-13,
438
- .elevation-14,
439
- .elevation-15,
440
- .elevation-16,
441
- .elevation-17,
442
- .elevation-18,
443
- .elevation-19,
444
- .elevation-20,
445
- .elevation-21,
446
- .elevation-22,
447
- .elevation-23,
448
- .elevation-24 {
449
- box-shadow:
450
- 0 3px 1px -2px rgb(0 0 0 / 20%),
451
- 0 2px 2px 0 rgb(0 0 0 / 14%),
452
- 0 1px 5px 0 rgb(0 0 0 / 12%) !important;
453
- }
454
- }
346
+ // container
455
347
 
456
- // global.scss
457
-
458
- // Variables pour les largeurs des conteneurs
459
348
  $container-mobile-max-width: 600px;
460
349
  $container-tablet-max-width: 960px;
461
350
  $container-desktop-max-width: 960px;
462
-
463
- // Conteneur général
464
- .page-container {
465
- text-align: center;
466
- margin: 0 auto; // Centrer les conteneurs
467
- padding: 40px 40px 56px 56px;
468
- width: 1160px;
469
-
470
- // Mobile Styles
471
- @media (width <= 600px) {
472
- max-width: $container-mobile-max-width;
473
- padding: 40px 24px 80px;
474
- display: grid;
475
- grid-template-columns: repeat(3, 1fr);
476
- grid-gap: 24px;
477
- width: 80%;
478
- }
479
-
480
- // Tablet Styles
481
- @media (width >= 601px) and (width <= 960px) {
482
- max-width: $container-tablet-max-width;
483
- width: 80%;
484
- display: grid;
485
- grid-template-columns: repeat(6, 1fr);
486
- grid-gap: 24px;
487
- }
488
-
489
- // Desktop Styles
490
- @media (width >= 960px) {
491
- max-width: $container-desktop-max-width;
492
- width: 100%;
493
- display: grid;
494
- grid-template-columns: repeat(12, 1fr);
495
- grid-gap: 24px;
496
- }
497
- }
@@ -1,10 +1,35 @@
1
1
  import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
2
2
  import useAccordionGroupCommunication from '../useAccordionGroupCommunication'
3
+ import { mount } from '@vue/test-utils'
4
+ import { defineComponent } from 'vue'
5
+
6
+ // Composant vide qui servira de contexte pour les hooks Vue
7
+ const TestComponent = defineComponent({
8
+ setup() {
9
+ const instanceId = 'test-instance'
10
+ const groupId = 'test-group'
11
+ const onFocusChange = vi.fn()
12
+
13
+ const accordion = useAccordionGroupCommunication(instanceId, groupId, onFocusChange)
14
+
15
+ return {
16
+ instanceId,
17
+ groupId,
18
+ onFocusChange,
19
+ emitFocusChange: accordion.emitFocusChange,
20
+ handleFocusChange: accordion.handleFocusChange,
21
+ }
22
+ },
23
+ template: '<div></div>',
24
+ })
3
25
 
4
26
  describe('useAccordionGroupCommunication', () => {
5
27
  const instanceId = 'test-instance'
6
28
  const groupId = 'test-group'
7
29
  const mockOnFocusChange = vi.fn()
30
+ // Wrapper pour le composant de test
31
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
32
+ let wrapper: any
8
33
 
9
34
  // Espionner les méthodes addEventListener et removeEventListener de window
10
35
  beforeEach(() => {
@@ -21,29 +46,43 @@ describe('useAccordionGroupCommunication', () => {
21
46
  })
22
47
 
23
48
  describe('initialization', () => {
49
+ beforeEach(() => {
50
+ // Monter le composant de test pour fournir un contexte aux hooks Vue
51
+ wrapper = mount(TestComponent)
52
+ })
53
+
54
+ afterEach(() => {
55
+ // Démonter le composant après chaque test
56
+ wrapper.unmount()
57
+ })
58
+
24
59
  it('adds event listener on mount', () => {
25
- // Utiliser le composable pour tester son initialisation
26
- useAccordionGroupCommunication(
27
- instanceId,
28
- groupId,
29
- mockOnFocusChange,
30
- )
60
+ // Le composable est maintenant utilisé via le composant de test,
61
+ // ce qui fournit un contexte valide pour les hooks de cycle de vie
31
62
 
32
- // Vérifier que le composable a bien ajouté l'écouteur d'événements
33
- // Note: Nous ne pouvons pas vérifier directement l'appel à addEventListener car
34
- // il est appelé dans le hook onMounted qui n'est pas exécuté dans le contexte de test
35
- // Nous vérifions donc simplement que le test s'exécute sans erreur
36
- expect(true).toBe(true)
63
+ // Vérifier que le composant est bien monté
64
+ expect(wrapper.vm).toBeDefined()
65
+
66
+ // Si addEventListener a été appelé sur window, cela signifie que
67
+ // le hook onMounted a été correctement exécuté
68
+ expect(window.addEventListener).toHaveBeenCalled()
37
69
  })
38
70
  })
39
71
 
40
72
  describe('emitFocusChange', () => {
73
+ beforeEach(() => {
74
+ // Monter le composant de test pour fournir un contexte aux hooks Vue
75
+ wrapper = mount(TestComponent)
76
+ })
77
+
78
+ afterEach(() => {
79
+ // Démonter le composant après chaque test
80
+ wrapper.unmount()
81
+ })
82
+
41
83
  it('dispatches a custom event with the correct details', () => {
42
- const { emitFocusChange } = useAccordionGroupCommunication(
43
- instanceId,
44
- groupId,
45
- mockOnFocusChange,
46
- )
84
+ // Utiliser les méthodes exposées par le composant
85
+ const { emitFocusChange } = wrapper.vm
47
86
 
48
87
  const itemId = 'test-item'
49
88
  emitFocusChange(itemId)
@@ -61,11 +100,8 @@ describe('useAccordionGroupCommunication', () => {
61
100
  })
62
101
 
63
102
  it('dispatches a custom event with null itemId', () => {
64
- const { emitFocusChange } = useAccordionGroupCommunication(
65
- instanceId,
66
- groupId,
67
- mockOnFocusChange,
68
- )
103
+ // Utiliser les méthodes exposées par le composant
104
+ const { emitFocusChange } = wrapper.vm
69
105
 
70
106
  emitFocusChange(null)
71
107
 
@@ -83,12 +119,19 @@ describe('useAccordionGroupCommunication', () => {
83
119
  })
84
120
 
85
121
  describe('handleFocusChange', () => {
122
+ beforeEach(() => {
123
+ // Monter le composant de test pour fournir un contexte aux hooks Vue
124
+ wrapper = mount(TestComponent)
125
+ })
126
+
127
+ afterEach(() => {
128
+ // Démonter le composant après chaque test
129
+ wrapper.unmount()
130
+ })
131
+
86
132
  it('ignores events from the same instance', () => {
87
- const { handleFocusChange } = useAccordionGroupCommunication(
88
- instanceId,
89
- groupId,
90
- mockOnFocusChange,
91
- )
133
+ // Utiliser les méthodes exposées par le composant
134
+ const { handleFocusChange } = wrapper.vm
92
135
 
93
136
  const event = new CustomEvent('accordion-focus-changed', {
94
137
  detail: {
@@ -104,11 +147,8 @@ describe('useAccordionGroupCommunication', () => {
104
147
  })
105
148
 
106
149
  it('ignores events from different groups', () => {
107
- const { handleFocusChange } = useAccordionGroupCommunication(
108
- instanceId,
109
- groupId,
110
- mockOnFocusChange,
111
- )
150
+ // Utiliser les méthodes exposées par le composant
151
+ const { handleFocusChange } = wrapper.vm
112
152
 
113
153
  const event = new CustomEvent('accordion-focus-changed', {
114
154
  detail: {
@@ -124,23 +164,23 @@ describe('useAccordionGroupCommunication', () => {
124
164
  })
125
165
 
126
166
  it('calls onFocusChange with null when receiving a valid event', () => {
127
- const { handleFocusChange } = useAccordionGroupCommunication(
128
- instanceId,
129
- groupId,
130
- mockOnFocusChange,
131
- )
167
+ // Utiliser les méthodes exposées par le composant
168
+ const { handleFocusChange, onFocusChange } = wrapper.vm
169
+
170
+ // Réinitialiser le mock avant ce test
171
+ onFocusChange.mockReset()
132
172
 
133
173
  const event = new CustomEvent('accordion-focus-changed', {
134
174
  detail: {
135
- sourceInstanceId: 'other-instance', // Instance différente
136
- groupId, // Même groupe
137
- itemId: 'test-item',
175
+ sourceInstanceId: 'other-instance',
176
+ groupId,
177
+ itemId: null,
138
178
  },
139
179
  })
140
180
 
141
181
  handleFocusChange(event)
142
182
 
143
- expect(mockOnFocusChange).toHaveBeenCalledWith(null)
183
+ expect(onFocusChange).toHaveBeenCalledWith(null)
144
184
  })
145
185
  })
146
186
  })
@@ -0,0 +1,15 @@
1
+ import { Controls, Canvas, Meta, Source } from '@storybook/blocks';
2
+
3
+ import * as AmeliproAccordionStories from './AmeliproAccordion.stories';
4
+
5
+ <Meta of={AmeliproAccordionStories} />
6
+
7
+ # AmeliproAccordion
8
+
9
+ L’élément `AmeliproAccordion` est utilisé pour créer des cartes dépliables.
10
+
11
+ <Canvas of={AmeliproAccordionStories.Default} />
12
+
13
+ ## API
14
+
15
+ <Controls of={AmeliproAccordionStories.Default} />
@@ -0,0 +1,83 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import AmeliproAccordion from './AmeliproAccordion.vue'
3
+
4
+ const meta = {
5
+ argTypes: {
6
+ accordionTitle: { description: 'Titre du panneau dépliant' },
7
+ borderColor: { description: 'Couleur de bordure du panneau dépliant' },
8
+ bordered: { description: 'Défini une bordure au panneau dépliant' },
9
+ cardColor: { description: 'Couleur de fond du panneau dépliant' },
10
+ default: { description: 'Contenu du panneau dépliant' },
11
+ headerRight: { description: 'Partie droite du header du panneau dépliant' },
12
+ headerRightWidth: { description: 'Défini la largeur de la partie droite du header de la carte. Cette props est utile seulement si le slot headerRight est utilisé' },
13
+ hideSeparator: { description: 'Masque le séparateur entre le titre et le contenu des panneaux dépliants' },
14
+ isOpen: { description: 'Défini si le panneau dépliant est ouvert au chargement du composant' },
15
+ openClose: { description: 'Fonction permettant d’ouvrir ou fermer l’accordéon', type: 'void' },
16
+ titleLevel: { description: 'Niveau du titre du panneau dépliant' },
17
+ titleUppercase: { description: 'Transforme le titre du panneau dépliant en lettres capitales' },
18
+ uniqueId: { description: 'Identifiant unique du panneau dépliant' },
19
+ },
20
+ component: AmeliproAccordion,
21
+ title: 'Composants/Amelipro/Blocs dépliants/AmeliproAccordion',
22
+ } as Meta<typeof AmeliproAccordion>
23
+ export default meta
24
+
25
+ type Story = StoryObj<typeof AmeliproAccordion>
26
+
27
+ export const Default: Story = {
28
+ args: {
29
+ accordionTitle: 'Mon titre',
30
+ default: '[Slot: default]',
31
+ headerRight: '[Slot: headerRight]',
32
+ uniqueId: 'amelipro-accordion-unique-id',
33
+ },
34
+ parameters: {
35
+ sourceCode: [
36
+ {
37
+ name: 'Template',
38
+ code: `<template>
39
+ <AmeliproAccordion
40
+ accordion-title="Mon titre"
41
+ class="w-100"
42
+ unique-id="amelipro-accordion-unique-id"
43
+ >
44
+ <template #default>
45
+ [Slot: default]
46
+ </template>
47
+
48
+ <template #headerRight>
49
+ [Slot: headerRight]
50
+ </template>
51
+ </AmeliproAccordion>
52
+ </template>`,
53
+ },
54
+ {
55
+ name: 'Script',
56
+ code: `<script setup lang="ts">
57
+ import { AmeliproAccordion } from '@cnamts/synapse'
58
+ </script>
59
+ `,
60
+ },
61
+ ],
62
+ },
63
+ render: args => ({
64
+ components: { AmeliproAccordion },
65
+ setup() {
66
+ return { args }
67
+ },
68
+ template: `
69
+ <AmeliproAccordion
70
+ class="w-100"
71
+ v-bind="args"
72
+ >
73
+ <template #default>
74
+ {{ args.default }}
75
+ </template>
76
+
77
+ <template #headerRight>
78
+ {{ args.headerRight }}
79
+ </template>
80
+ </AmeliproAccordion>
81
+ `,
82
+ }),
83
+ }
@@ -0,0 +1,86 @@
1
+ <script setup lang="ts">
2
+ import AmeliproAccordionTemplate from './AmeliproAccordionTemplate/AmeliproAccordionTemplate.vue'
3
+ import { ref } from 'vue'
4
+
5
+ const props = defineProps({
6
+ accordionTitle: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ borderColor: {
11
+ type: String,
12
+ default: 'ap-grey-lighten-2',
13
+ },
14
+ bordered: {
15
+ type: Boolean,
16
+ default: true,
17
+ },
18
+ cardColor: {
19
+ type: String,
20
+ default: 'ap-white',
21
+ },
22
+ headerRightWidth: {
23
+ type: String,
24
+ default: '50%',
25
+ },
26
+ hideSeparator: {
27
+ type: Boolean,
28
+ default: false,
29
+ },
30
+ isOpen: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ titleLevel: {
35
+ type: Number,
36
+ default: 2,
37
+ },
38
+ titleUppercase: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ uniqueId: {
43
+ type: String,
44
+ required: true,
45
+ },
46
+ })
47
+
48
+ const opened = ref(props.isOpen)
49
+
50
+ const openClose = (): void => {
51
+ opened.value = !opened.value
52
+ }
53
+
54
+ // Rendre publique la méthode openClose permet à un bouton ou à un composant externe de fermer/ouvrir l'accordéon
55
+ defineExpose({ openClose })
56
+ </script>
57
+
58
+ <template>
59
+ <AmeliproAccordionTemplate
60
+ :accordion-title="accordionTitle"
61
+ :border-color="borderColor"
62
+ :bordered="bordered"
63
+ :card-color="cardColor"
64
+ :header-right-width="headerRightWidth"
65
+ :hide-separator="hideSeparator"
66
+ :is-open="opened"
67
+ :title-level="titleLevel"
68
+ :title-uppercase="titleUppercase"
69
+ :unique-id="uniqueId"
70
+ @open-close="openClose"
71
+ >
72
+ <template
73
+ v-if="$slots.default"
74
+ #default
75
+ >
76
+ <slot />
77
+ </template>
78
+
79
+ <template
80
+ v-if="$slots.headerRight"
81
+ #headerRight
82
+ >
83
+ <slot name="headerRight" />
84
+ </template>
85
+ </AmeliproAccordionTemplate>
86
+ </template>