@cnamts/synapse 0.0.7-alpha → 0.0.9-alpha

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 (198) hide show
  1. package/dist/design-system-v3.d.ts +785 -372
  2. package/dist/design-system-v3.js +4993 -3357
  3. package/dist/design-system-v3.umd.cjs +1 -10
  4. package/dist/style.css +1 -1
  5. package/package.json +10 -2
  6. package/src/assets/settings.scss +2 -2
  7. package/src/assets/tokens.scss +107 -112
  8. package/src/components/BackBtn/BackBtn.vue +4 -4
  9. package/src/components/BackToTopBtn/BackToTopBtn.vue +1 -0
  10. package/src/components/CollapsibleList/CollapsibleList.mdx +1 -1
  11. package/src/components/CollapsibleList/CollapsibleList.vue +43 -44
  12. package/src/components/ContextualMenu/Accessibilite.mdx +14 -0
  13. package/src/components/ContextualMenu/Accessibilite.stories.ts +191 -0
  14. package/src/components/ContextualMenu/AccessibiliteItems.ts +89 -0
  15. package/src/components/ContextualMenu/ContextualMenu.mdx +118 -0
  16. package/src/components/ContextualMenu/ContextualMenu.stories.ts +430 -0
  17. package/src/components/ContextualMenu/ContextualMenu.vue +101 -0
  18. package/src/components/ContextualMenu/constants/ExpertiseLevelEnum.ts +4 -0
  19. package/src/components/ContextualMenu/tests/ContextualMenu.spec.ts +115 -0
  20. package/src/components/ContextualMenu/tests/__snapshots__/ContextualMenu.spec.ts.snap +10 -0
  21. package/src/components/ContextualMenu/types.ts +5 -0
  22. package/src/components/CookieBanner/CookieBanner.stories.ts +1 -2
  23. package/src/components/CookieBanner/CookieBanner.vue +13 -10
  24. package/src/components/CookieBanner/tests/__snapshots__/CookieBanner.spec.ts.snap +17 -15
  25. package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +6 -1
  26. package/src/components/CookiesSelection/CookiesInformation/locales.ts +1 -0
  27. package/src/components/CookiesSelection/CookiesTable/CookiesTable.vue +1 -0
  28. package/src/components/CookiesSelection/tests/__snapshots__/CookiesSelection.spec.ts.snap +17 -15
  29. package/src/components/CopyBtn/CopyBtn.vue +7 -7
  30. package/src/components/Customs/SyBtnSelect/SyBtnSelect.vue +26 -26
  31. package/src/components/Customs/SyInputSelect/SyInputSelect.vue +24 -24
  32. package/src/components/Customs/SySelect/SySelect.stories.ts +7 -7
  33. package/src/components/Customs/SySelect/SySelect.vue +36 -30
  34. package/src/components/Customs/SySelect/tests/SySelect.spec.ts +2 -2
  35. package/src/components/Customs/SyTextField/SyTextField.stories.ts +187 -2
  36. package/src/components/Customs/SyTextField/SyTextField.vue +185 -16
  37. package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +2 -4
  38. package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +18 -16
  39. package/src/components/Customs/SyTextField/types.d.ts +2 -2
  40. package/src/components/DataList/DataList.stories.ts +3 -2
  41. package/src/components/DataList/DataList.vue +1 -1
  42. package/src/components/DataListGroup/DataListGroup.stories.ts +3 -2
  43. package/src/components/DataListItem/DataListItem.vue +12 -12
  44. package/src/components/DatePicker/DatePicker.mdx +191 -0
  45. package/src/components/DatePicker/DatePicker.stories.ts +787 -0
  46. package/src/components/DatePicker/DatePicker.vue +560 -0
  47. package/src/components/DatePicker/DateTextInput.vue +409 -0
  48. package/src/components/DatePicker/tests/DatePicker.spec.ts +266 -0
  49. package/src/components/DialogBox/DialogBox.mdx +28 -2
  50. package/src/components/DialogBox/DialogBox.stories.ts +2 -2
  51. package/src/components/DialogBox/DialogBox.vue +3 -2
  52. package/src/components/DownloadBtn/DownloadBtn.vue +2 -1
  53. package/src/components/ExternalLinks/Accessibilite.mdx +14 -0
  54. package/src/components/ExternalLinks/Accessibilite.stories.ts +191 -0
  55. package/src/components/ExternalLinks/AccessibiliteItems.ts +197 -0
  56. package/src/components/ExternalLinks/ExternalLinks.mdx +86 -0
  57. package/src/components/ExternalLinks/ExternalLinks.stories.ts +553 -0
  58. package/src/components/ExternalLinks/ExternalLinks.vue +200 -0
  59. package/src/components/ExternalLinks/config.ts +34 -0
  60. package/src/components/ExternalLinks/constants/ExpertiseLevelEnum.ts +4 -0
  61. package/src/components/ExternalLinks/locales.ts +4 -0
  62. package/src/components/ExternalLinks/tests/ExternalLinks.spec.ts +154 -0
  63. package/src/components/ExternalLinks/tests/__snapshots__/ExternalLinks.spec.ts.snap +159 -0
  64. package/src/components/FileUpload/FileUpload.mdx +165 -0
  65. package/src/components/FileUpload/FileUpload.stories.ts +429 -0
  66. package/src/components/FileUpload/FileUpload.vue +195 -0
  67. package/src/components/FileUpload/FileUploadContent.vue +109 -0
  68. package/src/components/FileUpload/locales.ts +10 -0
  69. package/src/components/FileUpload/tests/FileUpload.spec.ts +332 -0
  70. package/src/components/FileUpload/tests/__snapshots__/FileUpload.spec.ts.snap +7 -0
  71. package/src/components/FileUpload/useFileDrop.ts +23 -0
  72. package/src/components/FileUpload/validateFiles.ts +39 -0
  73. package/src/components/FooterBar/FooterBar.vue +105 -80
  74. package/src/components/FranceConnectBtn/FranceConnectBtn.vue +14 -13
  75. package/src/components/HeaderBar/HeaderBar.vue +3 -3
  76. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.vue +11 -7
  77. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.vue +5 -5
  78. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.vue +2 -2
  79. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.vue +10 -8
  80. package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +2 -2
  81. package/src/components/HeaderBar/HeaderLogo/logos/Logo-mobile.vue +2 -1
  82. package/src/components/HeaderBar/HeaderLogo/logos/Logo.vue +2 -1
  83. package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +10 -10
  84. package/src/components/HeaderBar/consts.scss +1 -1
  85. package/src/components/HeaderLoading/HeaderLoading.vue +12 -11
  86. package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +2 -1
  87. package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +9 -9
  88. package/src/components/HeaderToolbar/HeaderToolbar.vue +215 -202
  89. package/src/components/LangBtn/LangBtn.vue +8 -6
  90. package/src/components/LogoBrandSection/LogoBrandSection.stories.ts +2 -2
  91. package/src/components/NirField/NirField.stories.ts +8 -8
  92. package/src/components/NirField/NirField.vue +46 -48
  93. package/src/components/NotFoundPage/NotFoundPage.stories.ts +33 -2
  94. package/src/components/NotFoundPage/NotFoundPage.vue +17 -0
  95. package/src/components/NotificationBar/NotificationBar.mdx +5 -5
  96. package/src/components/NotificationBar/NotificationBar.stories.ts +410 -314
  97. package/src/components/NotificationBar/NotificationBar.vue +43 -41
  98. package/src/components/PageContainer/PageContainer.vue +4 -4
  99. package/src/components/PasswordField/Accessibilite.mdx +14 -0
  100. package/src/components/PasswordField/Accessibilite.stories.ts +191 -0
  101. package/src/components/PasswordField/AccessibiliteItems.ts +184 -0
  102. package/src/components/PasswordField/PasswordField.mdx +70 -0
  103. package/src/components/PasswordField/PasswordField.stories.ts +213 -0
  104. package/src/components/PasswordField/PasswordField.vue +189 -0
  105. package/src/components/PasswordField/config.ts +11 -0
  106. package/src/components/PasswordField/constants/ExpertiseLevelEnum.ts +4 -0
  107. package/src/components/PasswordField/locales.ts +4 -0
  108. package/src/components/PasswordField/tests/PasswordField.spec.ts +96 -0
  109. package/src/components/PhoneField/PhoneField.mdx +0 -2
  110. package/src/components/PhoneField/PhoneField.stories.ts +10 -50
  111. package/src/components/PhoneField/PhoneField.vue +77 -93
  112. package/src/components/PhoneField/tests/PhoneField.spec.ts +0 -15
  113. package/src/components/RangeField/RangeField.mdx +54 -0
  114. package/src/components/RangeField/RangeField.stories.ts +189 -0
  115. package/src/components/RangeField/RangeField.vue +157 -0
  116. package/src/components/RangeField/RangeSlider/RangeSlider.vue +387 -0
  117. package/src/components/RangeField/RangeSlider/Tooltip/Tooltip.vue +64 -0
  118. package/src/components/RangeField/RangeSlider/tests/__snapshots__/rangeSlider.spec.ts.snap +27 -0
  119. package/src/components/RangeField/RangeSlider/tests/rangeSlider.spec.ts +100 -0
  120. package/src/components/RangeField/RangeSlider/tests/useDoubleSlider.spec.ts +246 -0
  121. package/src/components/RangeField/RangeSlider/tests/useMouseSlide.spec.ts +204 -0
  122. package/src/components/RangeField/RangeSlider/tests/useThumb.spec.ts +22 -0
  123. package/src/components/RangeField/RangeSlider/tests/useThumbKeyboard.spec.ts +233 -0
  124. package/src/components/RangeField/RangeSlider/tests/useTooltipsNudge.spec.ts +150 -0
  125. package/src/components/RangeField/RangeSlider/tests/useTrack.spec.ts +314 -0
  126. package/src/components/RangeField/RangeSlider/tests/vAnimateClick.spec.ts +32 -0
  127. package/src/components/RangeField/RangeSlider/types.ts +15 -0
  128. package/src/components/RangeField/RangeSlider/useMouseSlide.ts +109 -0
  129. package/src/components/RangeField/RangeSlider/useRangeSlider.ts +126 -0
  130. package/src/components/RangeField/RangeSlider/useThumb.ts +18 -0
  131. package/src/components/RangeField/RangeSlider/useThumbKeyboard.ts +84 -0
  132. package/src/components/RangeField/RangeSlider/useTooltipsNudge.ts +92 -0
  133. package/src/components/RangeField/RangeSlider/useTrack.ts +116 -0
  134. package/src/components/RangeField/RangeSlider/vAnimateClick.ts +19 -0
  135. package/src/components/RangeField/config.ts +7 -0
  136. package/src/components/RangeField/locales.ts +4 -0
  137. package/src/components/RangeField/tests/RangeField.spec.ts +224 -0
  138. package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +379 -0
  139. package/src/components/RatingPicker/EmotionPicker/EmotionPicker.vue +205 -0
  140. package/src/components/RatingPicker/EmotionPicker/locales.ts +3 -0
  141. package/src/components/RatingPicker/EmotionPicker/tests/EmotionPicker.spec.ts +104 -0
  142. package/src/components/RatingPicker/EmotionPicker/tests/__snapshots__/EmotionPicker.spec.ts.snap +66 -0
  143. package/src/components/RatingPicker/NumberPicker/NumberPicker.vue +159 -0
  144. package/src/components/RatingPicker/NumberPicker/locales.ts +4 -0
  145. package/src/components/RatingPicker/NumberPicker/tests/NumberPicker.spec.ts +73 -0
  146. package/src/components/RatingPicker/NumberPicker/tests/__snapshots__/NumberPicker.spec.ts.snap +105 -0
  147. package/src/components/RatingPicker/Rating.ts +45 -0
  148. package/src/components/RatingPicker/RatingPicker.mdx +56 -0
  149. package/src/components/RatingPicker/RatingPicker.stories.ts +515 -0
  150. package/src/components/RatingPicker/RatingPicker.vue +122 -0
  151. package/src/components/RatingPicker/StarsPicker/StarsPicker.vue +116 -0
  152. package/src/components/RatingPicker/StarsPicker/tests/StarsPicker.spec.ts +95 -0
  153. package/src/components/RatingPicker/StarsPicker/tests/__snapshots__/StarsPicker.spec.ts.snap +36 -0
  154. package/src/components/RatingPicker/locales.ts +3 -0
  155. package/src/components/RatingPicker/tests/Rating.spec.ts +104 -0
  156. package/src/components/RatingPicker/tests/RatingPicker.spec.ts +187 -0
  157. package/src/components/RatingPicker/tests/__snapshots__/RatingPicker.spec.ts.snap +108 -0
  158. package/src/components/SearchListField/SearchListField.mdx +74 -0
  159. package/src/components/SearchListField/SearchListField.stories.ts +126 -0
  160. package/src/components/SearchListField/SearchListField.vue +194 -0
  161. package/src/components/SearchListField/locales.ts +5 -0
  162. package/src/components/SearchListField/tests/SearchListField.spec.ts +323 -0
  163. package/src/components/SearchListField/types.d.ts +4 -0
  164. package/src/components/SelectBtnField/SelectBtnField.mdx +50 -0
  165. package/src/components/SelectBtnField/SelectBtnField.stories.ts +763 -0
  166. package/src/components/SelectBtnField/SelectBtnField.vue +283 -0
  167. package/src/components/SelectBtnField/config.ts +11 -0
  168. package/src/components/SelectBtnField/tests/SelectBtnField.spec.ts +327 -0
  169. package/src/components/SelectBtnField/tests/__snapshots__/SelectBtnField.spec.ts.snap +125 -0
  170. package/src/components/SelectBtnField/types.d.ts +11 -0
  171. package/src/components/SkipLink/SkipLink.vue +10 -10
  172. package/src/components/SocialMediaLinks/SocialMediaLinks.vue +28 -26
  173. package/src/components/SubHeader/SubHeader.vue +32 -31
  174. package/src/components/SyAlert/SyAlert.vue +12 -12
  175. package/src/components/UserMenuBtn/UserMenuBtn.vue +1 -1
  176. package/src/components/UserMenuBtn/config.ts +1 -1
  177. package/src/components/index.ts +17 -7
  178. package/src/composables/rules/useFieldValidation.ts +172 -44
  179. package/src/designTokens/index.ts +6 -4
  180. package/src/designTokens/{bootstrapColors.md → paColors.md} +1 -1
  181. package/src/designTokens/tokens/cnam/cnamLightTheme.ts +2 -0
  182. package/src/designTokens/tokens/pa/paColors.ts +171 -0
  183. package/src/designTokens/tokens/pa/paContextual.ts +58 -0
  184. package/src/designTokens/tokens/pa/paDarkTheme.ts +5 -0
  185. package/src/designTokens/tokens/pa/paLightTheme.ts +123 -0
  186. package/src/designTokens/tokens/pa/paSemantic.ts +87 -0
  187. package/src/stories/Fondamentaux/CustomisationEtThemes.mdx +52 -2
  188. package/src/stories/GuideDuDev/CreerUneIssue.mdx +64 -0
  189. package/src/stories/GuideDuDev/{CommentUtiliserLesRules.mdx → UtiliserLesRules.mdx} +2 -2
  190. package/src/stories/GuideDuDev/components.stories.ts +9 -7
  191. package/src/stories/Guidelines/Vuetify/Vuetify.stories.ts +163 -88
  192. package/src/stories/Guidelines/Vuetify/VuetifyItems.ts +250 -23
  193. package/src/temp/TestDTComponent.vue +5 -6
  194. package/src/utils/calcHumanFileSize/index.ts +12 -0
  195. package/src/utils/calcHumanFileSize/tests/calcHumanFileSize.spec.ts +21 -0
  196. package/src/designTokens/tokens/bootstrap/bootstrapColors.ts +0 -158
  197. package/src/designTokens/tokens/bootstrap/bootstrapLightTheme.ts +0 -22
  198. package/src/stories/GuideDuDev/CommentContribuer.mdx +0 -22
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryFn } from '@storybook/vue3'
2
2
  import NotificationBar from './NotificationBar.vue'
3
3
  import { VBtn } from 'vuetify/components'
4
- import { ref, toRefs, watch } from 'vue'
4
+ import { ref, toRefs } from 'vue'
5
5
  import { useNotificationService } from '@/services/NotificationService'
6
6
  import type { Notification } from '@/components/NotificationBar/types'
7
7
 
@@ -9,7 +9,7 @@ interface StoryArgs {
9
9
  closeBtnText: string
10
10
  type: Notification['type']
11
11
  bottom: boolean
12
- rounded: string
12
+ rounded: string | number | boolean
13
13
  }
14
14
 
15
15
  const meta: Meta<typeof NotificationBar> = {
@@ -17,10 +17,42 @@ const meta: Meta<typeof NotificationBar> = {
17
17
  parameters: {
18
18
  layout: 'fullscreen',
19
19
  },
20
+ component: NotificationBar,
20
21
  argTypes: {
21
- closeBtnText: { control: 'text', type: 'string' },
22
- bottom: { control: 'boolean', type: 'boolean' },
23
- rounded: { control: 'text', type: 'string' },
22
+ closeBtnText: {
23
+ control: 'text',
24
+ table: {
25
+ type: {
26
+ summary: 'string',
27
+ },
28
+ defaultValue: {
29
+ summary: 'Fermer',
30
+ },
31
+ },
32
+ },
33
+ bottom: {
34
+ control: 'boolean',
35
+ table: {
36
+ type: {
37
+ summary: 'boolean',
38
+ },
39
+ defaultValue: {
40
+ summary: 'false',
41
+ },
42
+ },
43
+ },
44
+ rounded: {
45
+ control: 'select',
46
+ options: [0, 1, 2, 3, 4, 'xs', 'sm', true, 'lg', 'xl', 'pill', 'circle', 'shaped'],
47
+ table: {
48
+ type: {
49
+ summary: '0, 1, 2, 3, 4, \'xs\', \'sm\', true, \'lg\', \'xl\', \'pill\', \'circle\', \'shaped\'',
50
+ },
51
+ defaultValue: {
52
+ summary: '4',
53
+ },
54
+ },
55
+ },
24
56
  },
25
57
  }
26
58
 
@@ -28,339 +60,403 @@ export default meta
28
60
 
29
61
  type Story = StoryFn<StoryArgs>
30
62
 
31
- const Template: Story = args => ({
32
- components: { NotificationBar, VBtn },
33
- setup() {
34
- const { addNotification } = useNotificationService()
35
- const showNotification = ref(false)
36
- const { closeBtnText, bottom, rounded } = toRefs(args)
37
- const typeRef = ref(args.type)
63
+ export const Default: Story = (args) => {
64
+ return {
65
+ components: { NotificationBar, VBtn },
66
+ setup() {
67
+ const { addNotification } = useNotificationService()
68
+ const showNotification = ref(false)
69
+ const { type, closeBtnText, bottom, rounded } = toRefs(args)
38
70
 
39
- watch(
40
- () => args,
41
- (newArgs) => {
42
- typeRef.value = newArgs.type
43
- closeBtnText.value = newArgs.closeBtnText
44
- bottom.value = newArgs.bottom
45
- rounded.value = newArgs.rounded
46
- },
47
- { deep: true },
48
- )
49
-
50
- const envoyerNotification = (message: string) => {
51
- const notification: Notification = {
52
- id: Date.now().toString(),
53
- message,
54
- type: typeRef.value,
55
- timeout: -1,
71
+ const envoyerNotification = (message: string) => {
72
+ const notification: Notification = {
73
+ id: Date.now().toString(),
74
+ message,
75
+ type: type.value,
76
+ timeout: -1,
77
+ }
78
+ addNotification(notification)
79
+ showNotification.value = true
56
80
  }
57
- addNotification(notification)
58
- showNotification.value = true
59
- }
60
81
 
61
- return {
62
- showNotification,
63
- typeRef,
64
- closeBtnText,
65
- bottom,
66
- rounded,
67
- envoyerNotification,
68
- }
69
- },
70
- template: `
71
- <div class="d-flex flex-wrap align-center justify-center">
72
- <NotificationBar
73
- v-model="showNotification"
74
- :close-btn-text="closeBtnText"
75
- :bottom="bottom"
76
- :rounded="rounded"
77
- >
78
- <template #default>This is a {{ typeRef }} notification</template>
79
- </NotificationBar>
80
- <VBtn
81
- color="primary"
82
- @click="envoyerNotification('This is a ' + typeRef + ' notification')"
83
- class="ma-6"
84
- >
85
- Afficher la notification
86
- </VBtn>
87
- </div>
88
- `,
89
- })
90
-
91
- export const Success = Template.bind({})
92
- Success.args = { type: 'success', closeBtnText: 'Fermer', bottom: false, rounded: 'lg' }
93
- export const Info = Template.bind({})
94
- Info.args = { type: 'info', closeBtnText: 'Fermer', bottom: false, rounded: 'lg' }
95
- export const Warning = Template.bind({})
96
- Warning.args = { type: 'warning', closeBtnText: 'Fermer', bottom: false, rounded: 'lg' }
97
- export const Error = Template.bind({})
98
- Error.args = { type: 'error', closeBtnText: 'Fermer', bottom: false, rounded: 'lg' }
99
-
100
- export const WithAction: Story = args => ({
101
- components: { NotificationBar, VBtn },
102
- setup() {
103
- const { addNotification } = useNotificationService()
104
- const showNotification = ref(false)
105
- const { type: typeRef, closeBtnText } = toRefs(args)
106
-
107
- const envoyerNotification = (message: string) => {
108
- const notification: Notification = {
109
- id: Date.now().toString(),
110
- message,
111
- type: typeRef.value,
112
- timeout: -1,
82
+ return {
83
+ showNotification,
84
+ type,
85
+ closeBtnText,
86
+ bottom,
87
+ rounded,
88
+ envoyerNotification,
113
89
  }
114
- addNotification(notification)
115
- showNotification.value = true
116
- }
90
+ },
91
+ template: `
92
+ <div class="d-flex flex-wrap align-center justify-center">
93
+ <NotificationBar
94
+ v-model="showNotification"
95
+ :close-btn-text="closeBtnText"
96
+ :bottom="bottom"
97
+ :rounded="rounded"
98
+ :type="type"
99
+ >
100
+ <template #default>This is a {{ type }} notification</template>
101
+ </NotificationBar>
102
+ <VBtn
103
+ color="primary"
104
+ @click="envoyerNotification('This is a ' + type + ' notification')"
105
+ class="ma-6"
106
+ >
107
+ Afficher la notification
108
+ </VBtn>
109
+ </div>
110
+ `,
111
+ }
112
+ }
117
113
 
118
- return {
119
- showNotification,
120
- typeRef,
121
- closeBtnText,
122
- envoyerNotification,
123
- }
124
- },
125
- template: `
126
- <div class="d-flex flex-wrap align-center justify-center">
127
- <NotificationBar
128
- v-model="showNotification"
129
- :close-btn-text="closeBtnText"
130
- >
131
- <template #default>This is a {{ typeRef }} notification</template>
132
- <template #action>
133
- <VBtn variant="outlined">Action</VBtn>
134
- </template>
135
- </NotificationBar>
136
- <VBtn
137
- color="primary"
138
- @click="envoyerNotification('This is a ' + typeRef + ' notification')"
139
- class="ma-6"
140
- >
141
- Afficher la notification
142
- </VBtn>
143
- </div>
144
- `,
145
- })
146
- WithAction.args = {
147
- type: 'info',
114
+ Default.args = {
148
115
  closeBtnText: 'Fermer',
116
+ type: 'info',
117
+ bottom: false,
118
+ rounded: 'rounded',
149
119
  }
150
120
 
151
- export const WithTimeout: Story = args => ({
152
- components: { NotificationBar, VBtn },
153
- setup() {
154
- const { addNotification } = useNotificationService()
155
- const showNotification = ref(false)
121
+ Default.parameters = {
122
+ sourceCode: [
123
+ {
124
+ name: 'Template',
125
+ code: `
126
+ <div class="d-flex flex-wrap align-center justify-center">
127
+ <NotificationBar
128
+ v-model="showNotification"
129
+ :close-btn-text="closeBtnText"
130
+ :bottom="bottom"
131
+ :rounded="rounded"
132
+ :type="type"
133
+ >
134
+ <template #default>This is a {{ type }} notification</template>
135
+ </NotificationBar>
136
+ <VBtn
137
+ color="primary"
138
+ @click="envoyerNotification('This is a ' + type + ' notification')"
139
+ class="ma-6"
140
+ >
141
+ Afficher la notification
142
+ </VBtn>
143
+ </div>
144
+ `,
145
+ },
146
+ {
147
+ name: 'Script',
148
+ code: `
149
+ <script setup lang="ts">
150
+ import { VBtn } from 'vuetify/components'
151
+ import { NotificationBar } from '@cnamts/synapse'
152
+ import { ref } from 'vue'
153
+ import { useNotificationService } from '@/services/NotificationService'
156
154
 
157
- // Ajouter une valeur par défaut si `args.type` n'est pas défini
158
- const typeRef = ref(args.type || 'info')
159
- const { closeBtnText } = toRefs(args)
155
+ const { addNotification } = useNotificationService()
156
+ const showNotification = ref(false)
160
157
 
161
- const envoyerNotification = (message: string) => {
162
- const notification: Notification = {
163
- id: Date.now().toString(),
164
- message,
165
- type: typeRef.value,
166
- timeout: 5000, // Timeout de 5 secondes
167
- }
168
- addNotification(notification)
169
- showNotification.value = true
170
- }
171
-
172
- return {
173
- showNotification,
174
- typeRef, // Utilisation de `typeRef`
175
- closeBtnText,
176
- envoyerNotification,
177
- }
178
- },
179
- template: `
180
- <div class="d-flex flex-wrap align-center justify-center">
181
- <NotificationBar
182
- v-model="showNotification"
183
- :close-btn-text="closeBtnText"
184
- >
185
- <template #default>This is a {{ typeRef }} notification</template>
186
- </NotificationBar>
187
- <VBtn
188
- color="primary"
189
- @click="envoyerNotification('This is a ' + typeRef + ' notification')"
190
- class="ma-6"
191
- >
192
- Afficher la notification
193
- </VBtn>
194
- </div>
195
- `,
196
- })
197
- WithTimeout.args = {
198
- type: 'info', // Valeur par défaut pour `type`
199
- closeBtnText: 'Fermer',
158
+ const envoyerNotification = (message: string) => {
159
+ const notification = {
160
+ id: Date.now().toString(),
161
+ message,
162
+ type: 'info',
163
+ timeout: -1,
164
+ }
165
+ addNotification(notification)
166
+ showNotification.value = true
167
+ }
168
+ </script>
169
+ `,
170
+ },
171
+ ],
200
172
  }
201
173
 
202
- export const WithLongText: Story = args => ({
203
- components: { NotificationBar, VBtn },
204
- setup() {
205
- const { addNotification } = useNotificationService()
206
- const showNotification = ref(false)
174
+ export const Success: Story = Default.bind({})
175
+ Success.args = {
176
+ ...Default.args,
177
+ type: 'success',
178
+ }
179
+ Success.parameters = {
180
+ sourceCode: [
181
+ {
182
+ name: 'Template',
183
+ code: `
184
+ <div class="d-flex flex-wrap align-center justify-center">
185
+ <NotificationBar
186
+ v-model="showNotification"
187
+ :close-btn-text="closeBtnText"
188
+ :bottom="bottom"
189
+ :rounded="rounded"
190
+ type="success"
191
+ >
192
+ <template #default>This is a success notification</template>
193
+ </NotificationBar>
194
+ <VBtn
195
+ color="success"
196
+ @click="envoyerNotification('This is a success notification')"
197
+ class="ma-6"
198
+ >
199
+ Afficher la notification
200
+ </VBtn>
201
+ </div>
202
+ `,
203
+ },
204
+ {
205
+ name: 'Script',
206
+ code: `
207
+ <script setup lang="ts">
208
+ import { VBtn } from 'vuetify/components'
209
+ import { NotificationBar } from '@cnamts/synapse'
210
+ import { ref } from 'vue'
211
+ import { useNotificationService } from '@/services/NotificationService'
207
212
 
208
- // Ajouter une valeur par défaut pour `type`
209
- const typeRef = ref(args.type || 'info')
210
- const { closeBtnText } = toRefs(args)
213
+ const { addNotification } = useNotificationService()
214
+ const showNotification = ref(false)
211
215
 
212
- const envoyerNotification = (message: string) => {
213
- const notification: Notification = {
214
- id: Date.now().toString(),
215
- message,
216
- type: typeRef.value,
217
- timeout: -1, // Notification persistante
218
- }
219
- addNotification(notification)
220
- showNotification.value = true
221
- }
222
-
223
- return {
224
- showNotification,
225
- typeRef, // Utilisation de `typeRef`
226
- closeBtnText,
227
- envoyerNotification,
228
- }
229
- },
230
- template: `
231
- <div class="d-flex flex-wrap align-center justify-center">
232
- <NotificationBar
233
- v-model="showNotification"
234
- :close-btn-text="closeBtnText"
235
- >
236
- <template #default>
237
- <div>
238
- <p>This is a {{ typeRef }} notification</p>
239
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p>
240
- </div>
241
- </template>
242
- </NotificationBar>
243
- <VBtn
244
- color="primary"
245
- @click="envoyerNotification('This is a ' + typeRef + ' lorem ipsum dolor sit amet, consectetur adipiscing elit...')"
246
- class="ma-6"
247
- >
248
- Afficher la notification
249
- </VBtn>
250
- </div>
251
- `,
252
- })
253
- WithLongText.args = {
254
- type: 'info',
255
- closeBtnText: 'Fermer',
216
+ const envoyerNotification = (message: string) => {
217
+ const notification = {
218
+ id: Date.now().toString(),
219
+ message,
220
+ type: 'success',
221
+ timeout: -1,
222
+ }
223
+ addNotification(notification)
224
+ showNotification.value = true
225
+ }
226
+ </script>
227
+ `,
228
+ },
229
+ ],
256
230
  }
257
231
 
258
- export const forMobile: Story = args => ({
259
- components: { NotificationBar, VBtn },
260
- setup() {
261
- const { addNotification } = useNotificationService()
262
- const showNotification = ref(false)
232
+ export const Warning: Story = Default.bind({})
233
+ Warning.args = {
234
+ ...Default.args,
235
+ type: 'warning',
236
+ }
237
+ Warning.parameters = {
238
+ sourceCode: [
239
+ {
240
+ name: 'Template',
241
+ code: `
242
+ <div class="d-flex flex-wrap align-center justify-center">
243
+ <NotificationBar
244
+ v-model="showNotification"
245
+ :close-btn-text="closeBtnText"
246
+ :bottom="bottom"
247
+ :rounded="rounded"
248
+ type="warning"
249
+ >
250
+ <template #default>This is a warning notification</template>
251
+ </NotificationBar>
252
+ <VBtn
253
+ color="warning"
254
+ @click="envoyerNotification('This is a warning notification')"
255
+ class="ma-6"
256
+ >
257
+ Afficher la notification
258
+ </VBtn>
259
+ </div>
260
+ `,
261
+ },
262
+ {
263
+ name: 'Script',
264
+ code: `
265
+ <script setup lang="ts">
266
+ import { VBtn } from 'vuetify/components'
267
+ import { NotificationBar } from '@cnamts/synapse'
268
+ import { ref } from 'vue'
269
+ import { useNotificationService } from '@/services/NotificationService'
263
270
 
264
- const typeRef = ref(args.type || 'info')
265
- const { closeBtnText } = toRefs(args)
271
+ const { addNotification } = useNotificationService()
272
+ const showNotification = ref(false)
266
273
 
267
- const envoyerNotification = (message: string) => {
268
- const notification: Notification = {
269
- id: Date.now().toString(),
270
- message,
271
- type: typeRef.value,
272
- timeout: -1,
273
- }
274
- addNotification(notification)
275
- showNotification.value = true
276
- }
274
+ const envoyerNotification = (message: string) => {
275
+ const notification = {
276
+ id: Date.now().toString(),
277
+ message,
278
+ type: 'warning',
279
+ timeout: -1,
280
+ }
281
+ addNotification(notification)
282
+ showNotification.value = true
283
+ }
284
+ </script>
285
+ `,
286
+ },
287
+ ],
288
+ }
277
289
 
278
- return {
279
- showNotification,
280
- typeRef,
281
- closeBtnText,
282
- envoyerNotification,
283
- }
284
- },
285
- template: `
286
- <div class="d-flex flex-wrap align-center justify-center">
287
- <NotificationBar
288
- v-model="showNotification"
289
- :close-btn-text="closeBtnText"
290
- >
291
- <template #default>This is a {{ typeRef }} notification</template>
292
- </NotificationBar>
293
- <VBtn
294
- color="primary"
295
- @click="envoyerNotification('This is a ' + typeRef + ' notification ')"
296
- class="ma-6"
297
- >
298
- Afficher la notification
299
- </VBtn>
300
- </div>
301
- `,
302
- })
303
- forMobile.args = {
304
- type: 'info',
305
- closeBtnText: 'Fermer',
290
+ export const Error: Story = Default.bind({})
291
+ Error.args = {
292
+ ...Default.args,
293
+ type: 'error',
306
294
  }
307
- forMobile.parameters = {
308
- viewport: {
309
- defaultViewport: 'mobile2',
310
- },
295
+ Error.parameters = {
296
+ sourceCode: [
297
+ {
298
+ name: 'Template',
299
+ code: `
300
+ <div class="d-flex flex-wrap align-center justify-center">
301
+ <NotificationBar
302
+ v-model="showNotification"
303
+ :close-btn-text="closeBtnText"
304
+ :bottom="bottom"
305
+ :rounded="rounded"
306
+ type="error"
307
+ >
308
+ <template #default>This is an error notification</template>
309
+ </NotificationBar>
310
+ <VBtn
311
+ color="error"
312
+ @click="envoyerNotification('This is an error notification')"
313
+ class="ma-6"
314
+ >
315
+ Afficher la notification
316
+ </VBtn>
317
+ </div>
318
+ `,
319
+ },
320
+ {
321
+ name: 'Script',
322
+ code: `
323
+ <script setup lang="ts">
324
+ import { VBtn } from 'vuetify/components'
325
+ import { NotificationBar } from '@cnamts/synapse'
326
+ import { ref } from 'vue'
327
+ import { useNotificationService } from '@/services/NotificationService'
328
+
329
+ const { addNotification } = useNotificationService()
330
+ const showNotification = ref(false)
331
+
332
+ const envoyerNotification = (message: string) => {
333
+ const notification = {
334
+ id: Date.now().toString(),
335
+ message,
336
+ type: 'error',
337
+ timeout: -1,
338
+ }
339
+ addNotification(notification)
340
+ showNotification.value = true
341
+ }
342
+ </script>
343
+ `,
344
+ },
345
+ ],
311
346
  }
312
347
 
313
- export const forMobileWithLongText: Story = args => ({
314
- components: { NotificationBar, VBtn },
315
- setup() {
316
- const { addNotification } = useNotificationService()
317
- const showNotification = ref(false)
348
+ export const Bottom: Story = Default.bind({})
349
+ Bottom.args = {
350
+ ...Default.args,
351
+ bottom: true,
352
+ }
353
+ Bottom.parameters = {
354
+ sourceCode: [
355
+ {
356
+ name: 'Template',
357
+ code: `
358
+ <div class="d-flex flex-wrap align-center justify-center">
359
+ <NotificationBar
360
+ v-model="showNotification"
361
+ :close-btn-text="closeBtnText"
362
+ :bottom="true"
363
+ :rounded="rounded"
364
+ :type="type"
365
+ >
366
+ <template #default>This is a bottom-positioned notification</template>
367
+ </NotificationBar>
368
+ <VBtn
369
+ color="primary"
370
+ @click="envoyerNotification('This is a bottom-positioned notification')"
371
+ class="ma-6"
372
+ >
373
+ Afficher la notification
374
+ </VBtn>
375
+ </div>
376
+ `,
377
+ },
378
+ {
379
+ name: 'Script',
380
+ code: `
381
+ <script setup lang="ts">
382
+ import { VBtn } from 'vuetify/components'
383
+ import { NotificationBar } from '@cnamts/synapse'
384
+ import { ref } from 'vue'
385
+ import { useNotificationService } from '@/services/NotificationService'
318
386
 
319
- const typeRef = ref(args.type || 'info')
320
- const { closeBtnText } = toRefs(args)
387
+ const { addNotification } = useNotificationService()
388
+ const showNotification = ref(false)
321
389
 
322
- const envoyerNotification = (message: string) => {
323
- const notification: Notification = {
324
- id: Date.now().toString(),
325
- message,
326
- type: typeRef.value,
327
- timeout: -1,
328
- }
329
- addNotification(notification)
330
- showNotification.value = true
331
- }
390
+ const envoyerNotification = (message: string) => {
391
+ const notification = {
392
+ id: Date.now().toString(),
393
+ message,
394
+ type: 'info',
395
+ timeout: -1,
396
+ }
397
+ addNotification(notification)
398
+ showNotification.value = true
399
+ }
400
+ </script>
401
+ `,
402
+ },
403
+ ],
404
+ }
332
405
 
333
- return {
334
- showNotification,
335
- typeRef,
336
- closeBtnText,
337
- envoyerNotification,
338
- }
339
- },
340
- template: `
341
- <div class="d-flex flex-wrap align-center justify-center">
342
- <NotificationBar
343
- v-model="showNotification"
344
- :close-btn-text="closeBtnText"
345
- >
346
- <template #default>This is a {{ typeRef }} notification</template>
347
- </NotificationBar>
348
- <VBtn
349
- color="primary"
350
- @click="envoyerNotification('This is a ' + typeRef + ' lorem ipsum dolor sit amet, consectetur adipiscing elit...')"
351
- class="ma-6"
352
- >
353
- Afficher la notification
354
- </VBtn>
355
- </div>
356
- `,
357
- })
358
- forMobileWithLongText.args = {
359
- type: 'info',
360
- closeBtnText: 'Fermer',
406
+ export const CustomCloseBtnText: Story = Default.bind({})
407
+ CustomCloseBtnText.args = {
408
+ ...Default.args,
409
+ closeBtnText: 'Masquer',
361
410
  }
362
- forMobileWithLongText.parameters = {
363
- viewport: {
364
- defaultViewport: 'mobile2',
365
- },
411
+ CustomCloseBtnText.parameters = {
412
+ sourceCode: [
413
+ {
414
+ name: 'Template',
415
+ code: `
416
+ <div class="d-flex flex-wrap align-center justify-center">
417
+ <NotificationBar
418
+ v-model="showNotification"
419
+ close-btn-text="Masquer"
420
+ :bottom="bottom"
421
+ :rounded="rounded"
422
+ :type="type"
423
+ >
424
+ <template #default>This is a notification with custom close button text</template>
425
+ </NotificationBar>
426
+ <VBtn
427
+ color="primary"
428
+ @click="envoyerNotification('This is a notification with custom close button text')"
429
+ class="ma-6"
430
+ >
431
+ Afficher la notification
432
+ </VBtn>
433
+ </div>
434
+ `,
435
+ },
436
+ {
437
+ name: 'Script',
438
+ code: `
439
+ <script setup lang="ts">
440
+ import { VBtn } from 'vuetify/components'
441
+ import { NotificationBar } from '@cnamts/synapse'
442
+ import { ref } from 'vue'
443
+ import { useNotificationService } from '@/services/NotificationService'
444
+
445
+ const { addNotification } = useNotificationService()
446
+ const showNotification = ref(false)
447
+
448
+ const envoyerNotification = (message: string) => {
449
+ const notification = {
450
+ id: Date.now().toString(),
451
+ message,
452
+ type: 'info',
453
+ timeout: -1,
454
+ }
455
+ addNotification(notification)
456
+ showNotification.value = true
457
+ }
458
+ </script>
459
+ `,
460
+ },
461
+ ],
366
462
  }