@cnamts/synapse 0.0.3-alpha → 0.0.4-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 (185) hide show
  1. package/dist/design-system-v3.d.ts +712 -27
  2. package/dist/design-system-v3.js +2715 -1485
  3. package/dist/design-system-v3.umd.cjs +10 -1
  4. package/dist/style.css +1 -1
  5. package/package.json +5 -2
  6. package/src/components/Alert/Alert.mdx +1 -1
  7. package/src/components/Alert/Alert.stories.ts +91 -1
  8. package/src/components/BackBtn/BackBtn.mdx +1 -1
  9. package/src/components/BackBtn/BackBtn.stories.ts +84 -1
  10. package/src/components/BackToTopBtn/BackToTopBtn.mdx +3 -3
  11. package/src/components/BackToTopBtn/BackToTopBtn.stories.ts +172 -11
  12. package/src/components/CollapsibleList/CollapsibleList.mdx +2 -2
  13. package/src/components/CollapsibleList/CollapsibleList.stories.ts +37 -1
  14. package/src/components/CopyBtn/CopyBtn.mdx +1 -1
  15. package/src/components/CopyBtn/CopyBtn.stories.ts +120 -1
  16. package/src/components/CopyBtn/CopyBtn.vue +1 -1
  17. package/src/components/Customs/CustomInputSelect/CustomInputSelect.mdx +6 -8
  18. package/src/components/Customs/CustomInputSelect/CustomInputSelect.stories.ts +270 -4
  19. package/src/components/Customs/CustomInputSelect/CustomInputSelect.vue +80 -53
  20. package/src/components/Customs/CustomInputSelect/config.ts +10 -0
  21. package/src/components/Customs/CustomSelect/CustomSelect.mdx +3 -3
  22. package/src/components/Customs/CustomSelect/CustomSelect.stories.ts +158 -2
  23. package/src/components/Customs/CustomSelect/CustomSelect.vue +25 -6
  24. package/src/components/Customs/CustomTextField/CustomTextField.mdx +44 -0
  25. package/src/components/Customs/CustomTextField/CustomTextField.stories.ts +403 -0
  26. package/src/components/Customs/CustomTextField/CustomTextField.vue +110 -0
  27. package/src/components/Customs/CustomTextField/tests/CustomTextField.spec.ts +93 -0
  28. package/src/components/Customs/CustomTextField/tests/__snapshots__/CustomTextField.spec.ts.snap +59 -0
  29. package/src/components/Customs/CustomTextField/types.d.ts +3 -0
  30. package/src/components/DataList/DataList.mdx +77 -0
  31. package/src/components/DataList/DataList.stories.ts +960 -0
  32. package/src/components/DataList/DataList.vue +140 -0
  33. package/src/components/DataList/DataListLoading/DataListLoading.vue +56 -0
  34. package/src/components/DataList/DataListLoading/tests/DataListLoading.spec.ts +23 -0
  35. package/src/components/DataList/locales.ts +3 -0
  36. package/src/components/DataList/tests/DataList.spec.ts +194 -0
  37. package/src/components/DataList/types.d.ts +23 -0
  38. package/src/components/DataListGroup/DataListGroup.mdx +77 -0
  39. package/src/components/DataListGroup/DataListGroup.stories.ts +987 -0
  40. package/src/components/DataListGroup/DataListGroup.vue +59 -0
  41. package/src/components/DataListGroup/tests/DataListGroup.spec.ts +54 -0
  42. package/src/components/DataListGroup/tests/data/dataListGroupItems.ts +41 -0
  43. package/src/components/DataListGroup/types.d.ts +15 -0
  44. package/src/components/DataListItem/DataListItem.vue +135 -0
  45. package/src/components/DataListItem/config.ts +17 -0
  46. package/src/components/DataListItem/locales.ts +3 -0
  47. package/src/components/DataListItem/tests/DataListItem.spec.ts +156 -0
  48. package/src/components/DataListItem/types.d.ts +23 -0
  49. package/src/components/DownloadBtn/Accessibilite.mdx +14 -0
  50. package/src/components/DownloadBtn/Accessibilite.stories.ts +166 -0
  51. package/src/components/DownloadBtn/AccessibiliteItems.ts +129 -0
  52. package/src/components/DownloadBtn/DownloadBtn.mdx +5 -6
  53. package/src/components/DownloadBtn/DownloadBtn.stories.ts +207 -2
  54. package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +4 -0
  55. package/src/components/FooterBar/FooterBar.mdx +2 -2
  56. package/src/components/FooterBar/FooterBar.stories.ts +1 -1
  57. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +1 -1
  58. package/src/components/FranceConnectBtn/FranceConnectBtn.stories.ts +58 -1
  59. package/src/components/HeaderBar/HeaderBar.mdx +164 -45
  60. package/src/components/HeaderBar/HeaderBar.stories.ts +559 -15
  61. package/src/components/HeaderBar/HeaderBar.vue +60 -22
  62. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.mdx +433 -0
  63. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderBurgerMenu.stories.ts +1089 -0
  64. package/src/components/HeaderBar/{HeaderComplexMenu/HeaderComplexMenu.vue → HeaderBurgerMenu/HeaderBurgerMenu.vue} +74 -45
  65. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.mdx +38 -0
  66. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +89 -0
  67. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/__snapshots__/HeaderMenuItem.spec.ts.snap +1 -1
  68. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.mdx +17 -0
  69. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +121 -0
  70. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/HeaderMenuSection.vue +2 -2
  71. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuSection/tests/HeaderMenuSection.spec.ts +1 -3
  72. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.mdx +43 -0
  73. package/src/components/HeaderBar/HeaderBurgerMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +261 -0
  74. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/HeaderSubMenu.vue +17 -3
  75. package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderSubMenu/tests/HeaderSubMenu.spec.ts +1 -1
  76. package/src/components/HeaderBar/HeaderBurgerMenu/tests/HeaderBurgerMenu.spec.ts +180 -0
  77. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderBurgerMenu.spec.ts.snap +13 -0
  78. package/src/components/HeaderBar/HeaderBurgerMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +13 -0
  79. package/src/components/HeaderBar/HeaderLogo/HeaderLogo.vue +62 -25
  80. package/src/components/HeaderBar/HeaderLogo/tests/HeaderLogo.spec.ts +49 -1
  81. package/src/components/HeaderBar/HeaderMenuBtn/HeaderMenuBtn.vue +19 -23
  82. package/src/components/HeaderBar/HeaderMenuBtn/tests/HeaderMenuBtn.spec.ts +70 -0
  83. package/src/components/HeaderBar/Usages.mdx +85 -0
  84. package/src/components/HeaderBar/consts.scss +0 -1
  85. package/src/components/HeaderBar/tests/HeaderBar.spec.ts +8 -2
  86. package/src/components/HeaderBar/tests/__snapshots__/HeaderBar.spec.ts.snap +5 -10
  87. package/src/components/HeaderLoading/HeaderLoading.mdx +28 -0
  88. package/src/components/HeaderLoading/HeaderLoading.stories.ts +62 -0
  89. package/src/components/HeaderLoading/HeaderLoading.vue +45 -0
  90. package/src/components/HeaderLoading/tests/HeaderLoading.spec.ts +22 -0
  91. package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +128 -0
  92. package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +784 -0
  93. package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +194 -0
  94. package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +74 -0
  95. package/src/components/HeaderNavigationBar/HorizontalNavbar/config.ts +18 -0
  96. package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +127 -0
  97. package/src/components/HeaderNavigationBar/types.ts +7 -0
  98. package/src/components/HeaderToolbar/HeaderToolbar.mdx +31 -0
  99. package/src/components/HeaderToolbar/HeaderToolbar.stories.ts +343 -0
  100. package/src/components/HeaderToolbar/HeaderToolbar.vue +487 -0
  101. package/src/components/HeaderToolbar/tests/HeaderToolbar.spec.ts +196 -0
  102. package/src/components/HeaderToolbar/types.d.ts +20 -0
  103. package/src/components/LangBtn/LangBtn.mdx +1 -1
  104. package/src/components/LangBtn/LangBtn.stories.ts +125 -8
  105. package/src/components/Logo/Logo.mdx +2 -2
  106. package/src/components/Logo/Logo.stories.ts +147 -1
  107. package/src/components/LogoBrandSection/LogoBrandSection.mdx +14 -0
  108. package/src/components/LogoBrandSection/LogoBrandSection.stories.ts +158 -0
  109. package/src/components/LogoBrandSection/LogoBrandSection.vue +312 -0
  110. package/src/components/LogoBrandSection/assets/ameli-pro.svg +1 -0
  111. package/src/components/LogoBrandSection/assets/ameli.svg +1 -0
  112. package/src/components/LogoBrandSection/assets/cnam.svg +1 -0
  113. package/src/components/LogoBrandSection/assets/compte-ameli.svg +1 -0
  114. package/src/components/LogoBrandSection/dividerDimensionsMapping.ts +14 -0
  115. package/src/components/LogoBrandSection/locales.ts +14 -0
  116. package/src/components/LogoBrandSection/secondaryLogoMapping.ts +24 -0
  117. package/src/components/LogoBrandSection/tests/LogoBrandSection.spec.ts +365 -0
  118. package/src/components/LogoBrandSection/tests/__snapshots__/LogoBrandSection.spec.ts.snap +14 -0
  119. package/src/components/LogoBrandSection/types.ts +8 -0
  120. package/src/components/NotificationBar/NotificationBar.mdx +6 -6
  121. package/src/components/NotificationBar/NotificationBar.stories.ts +1 -1
  122. package/src/components/NotificationBar/NotificationBar.vue +2 -2
  123. package/src/components/NotificationBar/tests/NotificationBar.spec.ts +1 -1
  124. package/src/components/PageContainer/PageContainer.mdx +1 -1
  125. package/src/components/PageContainer/PageContainer.stories.ts +86 -1
  126. package/src/components/PhoneField/PhoneField.mdx +49 -0
  127. package/src/components/PhoneField/PhoneField.stories.ts +869 -0
  128. package/src/components/PhoneField/PhoneField.vue +230 -0
  129. package/src/components/PhoneField/indicatifs.ts +104 -0
  130. package/src/components/PhoneField/locales.ts +4 -0
  131. package/src/components/PhoneField/tests/PhoneField.spec.ts +179 -0
  132. package/src/components/SkipLink/SkipLink.stories.ts +50 -1
  133. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +28 -1
  134. package/src/components/SocialMediaLinks/SocialMediaLinks.stories.ts +37 -1
  135. package/src/components/SubHeader/SubHeader.mdx +31 -0
  136. package/src/components/SubHeader/SubHeader.stories.ts +1032 -0
  137. package/src/components/SubHeader/SubHeader.vue +185 -0
  138. package/src/components/SubHeader/config.ts +12 -0
  139. package/src/components/SubHeader/locales.ts +3 -0
  140. package/src/components/SubHeader/tests/SubHeader.spec.ts +144 -0
  141. package/src/components/index.ts +24 -7
  142. package/src/composables/widthable/index.ts +29 -0
  143. package/src/composables/widthable/tests/widthable.spec.ts +52 -0
  144. package/src/designTokens/tokens/cnam/cnamLightTheme.ts +2 -2
  145. package/src/main.ts +1 -0
  146. package/src/modules.d.ts +4 -0
  147. package/src/services/index.ts +1 -0
  148. package/src/stories/Demarrer/Accueil.mdx +10 -0
  149. package/src/stories/Demarrer/Accueil.stories.ts +76 -0
  150. package/src/stories/Demarrer/PolitiqueDeConfidentialite.mdx +9 -0
  151. package/src/stories/Demarrer/PolitiqueDeConfidentialite.stories.ts +20 -0
  152. package/src/stories/Fondamentaux/Accessibilite/Accessibilite.mdx +1 -2
  153. package/src/stories/Fondamentaux/Accessibilite/Accessibilite.stories.ts +1 -1
  154. package/src/stories/Fondamentaux/EcoConception/Econception.stories.ts +1 -1
  155. package/src/stories/GuideDuDev/moduleDeNotification.mdx +52 -48
  156. package/src/stories/GuideDuDev/vuetifyOptions.mdx +31 -28
  157. package/src/stories/Guidelines/CustomisationEtThemes.mdx +1 -1
  158. package/src/utils/functions/throttleDisplayFn/tests/throttleDisplayFn.spec.ts +47 -0
  159. package/src/utils/functions/throttleDisplayFn/throttleDisplayFn.ts +26 -0
  160. package/src/utils/rules/exactLength/index.ts +33 -0
  161. package/src/utils/rules/exactLength/locales.ts +6 -0
  162. package/src/utils/rules/required/index.ts +25 -0
  163. package/src/utils/rules/required/locales.ts +5 -0
  164. package/src/utils/rules/required/ruleMessageHelper.ts +14 -0
  165. package/src/utils/rules/required/tests/index.spec.ts +47 -0
  166. package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +22 -0
  167. package/src/utils/rules/types.d.ts +15 -0
  168. package/src/components/Beta/beta.mdx +0 -5
  169. package/src/components/Deprecated/deprecated.mdx +0 -5
  170. package/src/components/HeaderBar/HeaderComplexMenu/HeaderComplexMenu.stories.ts +0 -272
  171. package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuItem/HeaderMenuItem.stories.ts +0 -49
  172. package/src/components/HeaderBar/HeaderComplexMenu/HeaderMenuSection/HeaderMenuSection.stories.ts +0 -56
  173. package/src/components/HeaderBar/HeaderComplexMenu/HeaderSubMenu/HeaderSubMenu.stories.ts +0 -137
  174. package/src/components/HeaderBar/HeaderComplexMenu/tests/HeaderComplexMenu.spec.ts +0 -129
  175. package/src/components/HeaderBar/HeaderComplexMenu/tests/__snapshots__/HeaderComplexMenu.spec.ts.snap +0 -18
  176. package/src/stories/Home/Accueil.mdx +0 -7
  177. package/src/stories/Home/PolitiqueDeConfidentialite.mdx +0 -4
  178. package/src/stories/Home/synapse.webp +0 -0
  179. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/HeaderMenuItem.vue +0 -0
  180. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/HeaderMenuItem/tests/HeaderMenuItem.spec.ts +0 -0
  181. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/conts.ts +0 -0
  182. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/locals.ts +0 -0
  183. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/tests/useHandleSubMenus.spec.ts +0 -0
  184. /package/src/components/HeaderBar/{HeaderComplexMenu → HeaderBurgerMenu}/useHandleSubMenus.ts +0 -0
  185. /package/src/components/Logo/{types.d.ts → types.ts} +0 -0
@@ -0,0 +1,960 @@
1
+ import DataList from './DataList.vue'
2
+ import type { Meta, StoryObj } from '@storybook/vue3'
3
+ import { mdiAccount, mdiCalendar, mdiInformationOutline } from '@mdi/js'
4
+
5
+ const meta: Meta<typeof DataList> = {
6
+ title: 'Composants/Données/DataList',
7
+ component: DataList,
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ controls: { exclude: ['width', 'minWidth', 'maxWidth'] },
11
+ },
12
+ argTypes: {
13
+ items: { control: 'object' },
14
+ icons: { control: 'object' },
15
+ listTitle: { control: 'text' },
16
+ titleClass: { control: 'text' },
17
+ title: { control: 'text' },
18
+ placeholder: { control: 'text' },
19
+ row: { control: 'boolean' },
20
+ loading: { control: 'boolean' },
21
+ itemsNumberLoading: { control: 'number' },
22
+ headingLoading: { control: 'boolean' },
23
+ },
24
+ }
25
+
26
+ export default meta
27
+
28
+ type Story = StoryObj<typeof meta>
29
+
30
+ export const Default: Story = {
31
+ parameters: {
32
+ sourceCode: [
33
+ {
34
+ name: 'Template',
35
+ code: `
36
+ <template>
37
+ <DataList :items="items" />
38
+ </template>
39
+ `,
40
+ },
41
+ {
42
+ name: 'Script',
43
+ code: `
44
+ <script setup lang="ts">
45
+ import DataList from '@cnamts/synapse'
46
+
47
+ const items = [
48
+ {
49
+ key: 'Nom',
50
+ value: 'Dupont',
51
+ },
52
+ {
53
+ key: 'Prénom',
54
+ value: 'Paul',
55
+ },
56
+ {
57
+ key: 'Date de naissance',
58
+ value: '24/09/1970',
59
+ },
60
+ ]
61
+ </script>
62
+ `,
63
+ },
64
+ ],
65
+ },
66
+ args: {
67
+ items: [
68
+ {
69
+ key: 'Nom',
70
+ value: 'Dupont',
71
+ },
72
+ {
73
+ key: 'Prénom',
74
+ value: 'Paul',
75
+ },
76
+ {
77
+ key: 'Date de naissance',
78
+ value: '24/09/1970',
79
+ },
80
+ ],
81
+ icons: undefined,
82
+ listTitle: undefined,
83
+ titleClass: 'text-subtitle-1 font-weight-bold mb-3',
84
+ title: `<template #title>
85
+ <h3 class="text-subtitle-1 text-primary font-weight-bold">
86
+ Liste de données
87
+ </h3>
88
+ <p class="text-subtitle-2 mb-3">
89
+ Informations complémentaires
90
+ </p>
91
+ </template>`,
92
+ row: false,
93
+ placeholder: undefined,
94
+ loading: false,
95
+ itemsNumberLoading: 1,
96
+ headingLoading: false,
97
+ width: '100%',
98
+ minWidth: undefined,
99
+ maxWidth: undefined,
100
+ },
101
+ render: (args) => {
102
+ return {
103
+ components: { DataList },
104
+ setup() {
105
+ return { args }
106
+ },
107
+ template: `
108
+ <div class="pa-4">
109
+ <DataList
110
+ v-bind="args"
111
+ :items="args.items"
112
+ :icons="args.icons"
113
+ :list-title="args.listTitle"
114
+ :title-class="args.titleClass"
115
+ :title="args.title"
116
+ :row="args.row"
117
+ :placeholder="args.placeholder"
118
+ :loading="args.loading"
119
+ :items-number-loading="args.itemsNumberLoading"
120
+ :heading-loading="args.headingLoading"
121
+ :render-html-value="args.renderHtmlValue"
122
+ />
123
+ </div>
124
+ `,
125
+ }
126
+ },
127
+ }
128
+
129
+ export const Row: Story = {
130
+ parameters: {
131
+ controls: { exclude: ['icons', 'listTitle', 'titleClass', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'title', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
132
+ sourceCode: [
133
+ {
134
+ name: 'Template',
135
+ code: `
136
+ <template>
137
+ <DataList
138
+ :items="items"
139
+ row
140
+ />
141
+ </template>
142
+ `,
143
+ },
144
+ {
145
+ name: 'Script',
146
+ code: `
147
+ <script setup lang="ts">
148
+ import DataList from '@cnamts/synapse'
149
+
150
+ const items = [
151
+ {
152
+ key: 'Nom',
153
+ value: 'Dupont',
154
+ },
155
+ {
156
+ key: 'Prénom',
157
+ value: 'Paul',
158
+ },
159
+ {
160
+ key: 'Date de naissance',
161
+ value: '24/09/1970',
162
+ },
163
+ ]
164
+ </script>
165
+ `,
166
+ },
167
+ ],
168
+ },
169
+ args: {
170
+ items: [
171
+ {
172
+ key: 'Nom',
173
+ value: 'Dupont',
174
+ },
175
+ {
176
+ key: 'Prénom',
177
+ value: 'Paul',
178
+ },
179
+ {
180
+ key: 'Date de naissance',
181
+ value: '24/09/1970',
182
+ },
183
+ ],
184
+ icons: undefined,
185
+ listTitle: undefined,
186
+ titleClass: 'text-subtitle-1 font-weight-bold mb-3',
187
+ row: true,
188
+ placeholder: undefined,
189
+ loading: false,
190
+ itemsNumberLoading: 1,
191
+ headingLoading: false,
192
+ },
193
+ render: (args) => {
194
+ return {
195
+ components: { DataList },
196
+ setup() {
197
+ return { args }
198
+ },
199
+ template: `
200
+ <div class="pa-4">
201
+ <DataList
202
+ v-bind="args"
203
+ :items="args.items"
204
+ :icons="args.icons"
205
+ :list-title="args.listTitle"
206
+ :title-class="args.titleClass"
207
+ :row="args.row"
208
+ :placeholder="args.placeholder"
209
+ :loading="args.loading"
210
+ :items-number-loading="args.itemsNumberLoading"
211
+ :heading-loading="args.headingLoading"
212
+ :render-html-value="args.renderHtmlValue"
213
+ />
214
+ </div>
215
+ `,
216
+ }
217
+ },
218
+ }
219
+
220
+ export const Title: Story = {
221
+ parameters: {
222
+ controls: { exclude: ['icons', 'title', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
223
+ sourceCode: [
224
+ {
225
+ name: 'Template',
226
+ code: `
227
+ <template>
228
+ <DataList
229
+ :items="items"
230
+ list-title="Informations personnelles"
231
+ />
232
+ </template>
233
+ `,
234
+ },
235
+ {
236
+ name: 'Script',
237
+ code: `
238
+ <script setup lang="ts">
239
+ import DataList from '@cnamts/synapse'
240
+
241
+ const items = [
242
+ {
243
+ key: 'Nom',
244
+ value: 'Dupont',
245
+ },
246
+ {
247
+ key: 'Prénom',
248
+ value: 'Paul',
249
+ },
250
+ {
251
+ key: 'Date de naissance',
252
+ value: '24/09/1970',
253
+ },
254
+ ]
255
+ </script>
256
+ `,
257
+ },
258
+ ],
259
+ },
260
+ args: {
261
+ items: [
262
+ {
263
+ key: 'Nom',
264
+ value: 'Dupont',
265
+ },
266
+ {
267
+ key: 'Prénom',
268
+ value: 'Paul',
269
+ },
270
+ {
271
+ key: 'Date de naissance',
272
+ value: '24/09/1970',
273
+ },
274
+ ],
275
+ icons: undefined,
276
+ listTitle: 'Informations personnelles',
277
+ titleClass: 'text-subtitle-1 font-weight-bold mb-3',
278
+ row: false,
279
+ placeholder: undefined,
280
+ loading: false,
281
+ itemsNumberLoading: 1,
282
+ headingLoading: false,
283
+ },
284
+ render: (args) => {
285
+ return {
286
+ components: { DataList },
287
+ setup() {
288
+ return { args }
289
+ },
290
+ template: `
291
+ <div class="pa-4">
292
+ <DataList
293
+ v-bind="args"
294
+ :items="args.items"
295
+ :icons="args.icons"
296
+ :list-title="args.listTitle"
297
+ :title-class="args.titleClass"
298
+ :row="args.row"
299
+ :placeholder="args.placeholder"
300
+ :loading="args.loading"
301
+ :items-number-loading="args.itemsNumberLoading"
302
+ :heading-loading="args.headingLoading"
303
+ :render-html-value="args.renderHtmlValue"
304
+ />
305
+ </div>
306
+ `,
307
+ }
308
+ },
309
+ }
310
+
311
+ export const Icons: Story = {
312
+ parameters: {
313
+ controls: { exclude: ['listTitle', 'titleClass', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'title', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
314
+ sourceCode: [
315
+ {
316
+ name: 'Template',
317
+ code: `
318
+ <template>
319
+ <DataList
320
+ :items="items"
321
+ :icons="icons"
322
+ />
323
+ </template>
324
+ `,
325
+ },
326
+ {
327
+ name: 'Script',
328
+ code: `
329
+ <script setup lang="ts">
330
+ import DataList from '@cnamts/synapse'
331
+ import { mdiCalendar, mdiAccount, mdiInformationOutline } from '@mdi/js'
332
+
333
+ const icons = {
334
+ calendarIcon: mdiCalendar,
335
+ accountIcon: mdiAccount,
336
+ mdiInformationOutline: mdiInformationOutline,
337
+ }
338
+
339
+ const items = [
340
+ {
341
+ key: 'Nom',
342
+ value: 'Dupont',
343
+ icon: 'accountIcon',
344
+ },
345
+ {
346
+ key: 'Prénom',
347
+ value: 'Paul',
348
+ icon: 'accountIcon',
349
+ },
350
+ {
351
+ key: 'Date de naissance',
352
+ value: '24/09/1970',
353
+ icon: 'calendarIcon',
354
+ },
355
+ ]
356
+ </script>
357
+ `,
358
+ },
359
+ ],
360
+ },
361
+ args: {
362
+ items: [
363
+ {
364
+ key: 'Nom',
365
+ value: 'Dupont',
366
+ icon: 'accountIcon',
367
+ },
368
+ {
369
+ key: 'Prénom',
370
+ value: 'Paul',
371
+ icon: 'accountIcon',
372
+ },
373
+ {
374
+ key: 'Date de naissance',
375
+ value: '24/09/1970',
376
+ icon: 'calendarIcon',
377
+ },
378
+ ],
379
+ icons: {
380
+ calendarIcon: mdiCalendar,
381
+ accountIcon: mdiAccount,
382
+ mdiInformationOutline: mdiInformationOutline,
383
+ },
384
+ },
385
+ render: (args) => {
386
+ return {
387
+ components: { DataList },
388
+ setup() {
389
+ return { args }
390
+ },
391
+ template: `
392
+ <div class="pa-4">
393
+ <DataList
394
+ v-bind="args"
395
+ :items="args.items"
396
+ :icons="args.icons"
397
+ />
398
+ </div>
399
+ `,
400
+ }
401
+ },
402
+ }
403
+
404
+ export const ActionBtn: Story = {
405
+ parameters: {
406
+ controls: { exclude: ['icons', 'listTitle', 'titleClass', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'title', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
407
+ sourceCode: [
408
+ {
409
+ name: 'Template',
410
+ code: `
411
+ <template>
412
+ <DataList
413
+ :items="items"
414
+ @click:item-action="updateBirthdate"
415
+ />
416
+ </template>
417
+ `,
418
+ },
419
+ {
420
+ name: 'Script',
421
+ code: `
422
+ <script setup lang="ts">
423
+ import DataList from '@cnamts/synapse'
424
+
425
+ const items = [
426
+ {
427
+ key: 'Nom',
428
+ value: 'Dupont',
429
+ },
430
+ {
431
+ key: 'Prénom',
432
+ value: 'Paul',
433
+ },
434
+ {
435
+ key: 'Date de naissance',
436
+ value: '24/09/1970',
437
+ action: 'Modifier',
438
+ },
439
+ ]
440
+
441
+ const updateBirthdate = (index: number) => {
442
+ items[index].value = '25/09/1970'
443
+ }
444
+ </script>
445
+ `,
446
+ },
447
+ ],
448
+ },
449
+ args: {
450
+ items: [
451
+ {
452
+ key: 'Nom',
453
+ value: 'Dupont',
454
+ },
455
+ {
456
+ key: 'Prénom',
457
+ value: 'Paul',
458
+ },
459
+ {
460
+ key: 'Date de naissance',
461
+ value: '24/09/1970',
462
+ action: 'Modifier',
463
+ },
464
+ ],
465
+ },
466
+ render: (args) => {
467
+ return {
468
+ components: { DataList },
469
+ setup() {
470
+ const updateBirthdate = (index: number) => {
471
+ args.items[index].value = '25/09/1970'
472
+ }
473
+ return { args, updateBirthdate }
474
+ },
475
+ template: `
476
+ <div class="pa-4">
477
+ <DataList
478
+ v-bind="args"
479
+ :items="args.items"
480
+ @click:item-action="updateBirthdate"
481
+ />
482
+ </div>
483
+ `,
484
+ }
485
+ },
486
+ }
487
+
488
+ export const Chips: Story = {
489
+ parameters: {
490
+ controls: { exclude: ['icons', 'listTitle', 'titleClass', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'title', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
491
+ sourceCode: [
492
+ {
493
+ name: 'Template',
494
+ code: `
495
+ <template>
496
+ <DataList :items="items" />
497
+ </template>
498
+ `,
499
+ },
500
+ {
501
+ name: 'Script',
502
+ code: `
503
+ <script setup lang="ts">
504
+ import DataList from '@cnamts/synapse'
505
+
506
+ const items = [
507
+ {
508
+ key: 'Nom',
509
+ value: 'Dupont',
510
+ chip: true,
511
+ },
512
+ {
513
+ key: 'Prénom',
514
+ value: 'Paul',
515
+ chip: true,
516
+ },
517
+ {
518
+ key: 'Date de naissance',
519
+ value: '24/09/1970',
520
+ chip: true,
521
+ },
522
+ {
523
+ key: 'Statut',
524
+ value: 'Enregistré',
525
+ chip: true,
526
+ options: {
527
+ chip: {
528
+ color: 'success',
529
+ }
530
+ }
531
+ }
532
+ ]
533
+ </script>
534
+ `,
535
+ },
536
+ ],
537
+ },
538
+ args: {
539
+ items: [
540
+ {
541
+ key: 'Nom',
542
+ value: 'Dupont',
543
+ chip: true,
544
+ },
545
+ {
546
+ key: 'Prénom',
547
+ value: 'Paul',
548
+ chip: true,
549
+ },
550
+ {
551
+ key: 'Date de naissance',
552
+ value: '24/09/1970',
553
+ chip: true,
554
+ },
555
+ {
556
+ key: 'Statut',
557
+ value: 'Enregistré',
558
+ chip: true,
559
+ options: {
560
+ chip: {
561
+ color: 'success',
562
+ },
563
+ },
564
+ },
565
+ ],
566
+ },
567
+ render: (args) => {
568
+ return {
569
+ components: { DataList },
570
+ setup() {
571
+ return { args }
572
+ },
573
+ template: `
574
+ <div class="pa-4">
575
+ <DataList
576
+ v-bind="args"
577
+ :items="args.items"
578
+ />
579
+ </div>
580
+ `,
581
+ }
582
+ },
583
+ }
584
+
585
+ export const HtmlValue: Story = {
586
+ parameters: {
587
+ controls: { exclude: ['icons', 'listTitle', 'titleClass', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'title', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
588
+ sourceCode: [
589
+ {
590
+ name: 'Template',
591
+ code: `
592
+ <template>
593
+ <DataList
594
+ :items="items"
595
+ item-width="auto"
596
+ render-html-value
597
+ />
598
+ </template>
599
+ `,
600
+ },
601
+ {
602
+ name: 'Script',
603
+ code: `
604
+ <script setup lang="ts">
605
+ import DataList from '@cnamts/synapse'
606
+
607
+ const items = [
608
+ {
609
+ key: 'Nom',
610
+ value: 'Dupont'
611
+ },
612
+ {
613
+ key: 'Prénom',
614
+ value: 'Paul'
615
+ },
616
+ {
617
+ key: 'Adresse',
618
+ value: '<b>50 Avenue du Professeur André Lemierre</b><br>75020 Paris'
619
+ }
620
+ ]
621
+ </script>
622
+ `,
623
+ },
624
+ ],
625
+ },
626
+ args: {
627
+ items: [
628
+ {
629
+ key: 'Nom',
630
+ value: 'Dupont',
631
+ },
632
+ {
633
+ key: 'Prénom',
634
+ value: 'Paul',
635
+ },
636
+ {
637
+ key: 'Adresse',
638
+ value: '<b>50 Avenue du Professeur André Lemierre</b><br>75020 Paris',
639
+ },
640
+ ],
641
+ renderHtmlValue: true,
642
+ },
643
+ render: (args) => {
644
+ return {
645
+ components: { DataList },
646
+ setup() {
647
+ return { args }
648
+ },
649
+ template: `
650
+ <div class="pa-4">
651
+ <DataList
652
+ v-bind="args"
653
+ :items="args.items"
654
+ :render-html-value="args.renderHtmlValue"
655
+ />
656
+ </div>
657
+ `,
658
+ }
659
+ },
660
+ }
661
+
662
+ export const Loading: Story = {
663
+ parameters: {
664
+ controls: { exclude: ['icons', 'titleClass', 'row', 'placeholder', 'renderHtmlValue', 'listTitle', 'title', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
665
+ sourceCode: [
666
+ {
667
+ name: 'Template',
668
+ code: `
669
+ <template>
670
+ <DataList
671
+ :items="items"
672
+ :items-number-loading="3"
673
+ loading
674
+ list-title="Titre"
675
+ heading-loading
676
+ />
677
+ </template>
678
+ `,
679
+ },
680
+ {
681
+ name: 'Script',
682
+ code: `
683
+ <script setup lang="ts">
684
+ import DataList from '@cnamts/synapse'
685
+
686
+ const items = [
687
+ {
688
+ key: 'Nom',
689
+ value: 'Dupont'
690
+ },
691
+ {
692
+ key: 'Prénom',
693
+ value: 'Paul'
694
+ },
695
+ {
696
+ key: 'Date de naissance',
697
+ value: '24/09/1970',
698
+ }
699
+ ]
700
+ </script>
701
+ `,
702
+ },
703
+ ],
704
+ },
705
+ args: {
706
+ items: [
707
+ {
708
+ key: 'Nom',
709
+ value: 'Dupont',
710
+ },
711
+ {
712
+ key: 'Prénom',
713
+ value: 'Paul',
714
+ },
715
+ {
716
+ key: 'Date de naissance',
717
+ value: '24/09/1970',
718
+ },
719
+ ],
720
+ itemsNumberLoading: 3,
721
+ loading: true,
722
+ listTitle: 'Titre',
723
+ headingLoading: true,
724
+ },
725
+ render: (args) => {
726
+ return {
727
+ components: { DataList },
728
+ setup() {
729
+ return { args }
730
+ },
731
+ template: `
732
+ <div class="pa-4">
733
+ <DataList
734
+ v-bind="args"
735
+ :items="args.items"
736
+ :items-number-loading="args.itemsNumberLoading"
737
+ :loading="args.loading"
738
+ :list-title="args.listTitle"
739
+ :heading-loading="args.headingLoading"
740
+ />
741
+ </div>
742
+ `,
743
+ }
744
+ },
745
+ }
746
+
747
+ export const SlotTitle: Story = {
748
+ parameters: {
749
+ controls: { exclude: ['icons', 'titleClass', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'listTitle', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
750
+ sourceCode: [
751
+ {
752
+ name: 'Template',
753
+ code: `
754
+ <template>
755
+ <DataList :items="items">
756
+ <template #title>
757
+ <template #title>
758
+ <h3 class="text-subtitle-1 text-primary font-weight-bold">
759
+ Liste de données
760
+ </h3>
761
+ <p class="text-subtitle-2 mb-3">
762
+ Informations complémentaires
763
+ </p>
764
+ </template>
765
+ </DataList>
766
+ </template>
767
+ `,
768
+ },
769
+ {
770
+ name: 'Script',
771
+ code: `
772
+ <script setup lang="ts">
773
+ import DataList from '@cnamts/synapse'
774
+
775
+ const items = [
776
+ {
777
+ key: 'Nom',
778
+ value: 'Dupont'
779
+ },
780
+ {
781
+ key: 'Prénom',
782
+ value: 'Paul'
783
+ },
784
+ {
785
+ key: 'Date de naissance',
786
+ value: '24/09/1970',
787
+ }
788
+ ]
789
+ </script>
790
+ `,
791
+ },
792
+ ],
793
+ },
794
+ args: {
795
+ items: [
796
+ {
797
+ key: 'Nom',
798
+ value: 'Dupont',
799
+ },
800
+ {
801
+ key: 'Prénom',
802
+ value: 'Paul',
803
+ },
804
+ {
805
+ key: 'Date de naissance',
806
+ value: '24/09/1970',
807
+ },
808
+ ],
809
+ title: `<template #title>
810
+ <h3 class="text-subtitle-1 text-primary font-weight-bold">
811
+ Liste de données
812
+ </h3>
813
+ <p class="text-subtitle-2 mb-3">
814
+ Informations complémentaires
815
+ </p>
816
+ </template>`,
817
+ },
818
+ render: (args) => {
819
+ return {
820
+ components: { DataList },
821
+ setup() {
822
+ return { args }
823
+ },
824
+ template: `
825
+ <div class="pa-4">
826
+ <DataList :items="args.items">
827
+ <template #title>
828
+ <h3 class="text-subtitle-1 text-primary font-weight-bold">
829
+ Liste de données
830
+ </h3>
831
+ <p class="text-subtitle-2 mb-3">
832
+ Informations complémentaires
833
+ </p>
834
+ </template>
835
+ </DataList>
836
+ </div>
837
+ `,
838
+ }
839
+ },
840
+ }
841
+
842
+ export const Customisation: Story = {
843
+ parameters: {
844
+ controls: { exclude: ['icons', 'titleClass', 'row', 'placeholder', 'loading', 'itemsNumberLoading', 'headingLoading', 'renderHtmlValue', 'listTitle', 'click:item-action', 'width', 'minWidth', 'maxWidth'] },
845
+ sourceCode: [
846
+ {
847
+ name: 'Template',
848
+ code: `
849
+ <template>
850
+ <DataList
851
+ :items="items"
852
+ :icons="icons"
853
+ />
854
+ </template>
855
+ `,
856
+ },
857
+ {
858
+ name: 'Script',
859
+ code: `
860
+ <script setup lang="ts">
861
+ import DataList from '@cnamts/synapse'
862
+ import { mdiAccount, mdiCalendar, mdiInformationOutline } from '@mdi/js'
863
+
864
+ const items = [
865
+ {
866
+ key: 'Nom',
867
+ value: 'Dupont',
868
+ icon: 'accountIcon',
869
+ options: itemOptions,
870
+ },
871
+ {
872
+ key: 'Prénom',
873
+ value: 'Paul',
874
+ icon: 'accountIcon',
875
+ options: itemOptions,
876
+ },
877
+ {
878
+ key: 'Date de naissance',
879
+ value: '24/09/1970',
880
+ icon: 'calendarIcon',
881
+ options: itemOptions,
882
+ }
883
+ ]
884
+
885
+ const icons = {
886
+ calendarIcon: mdiCalendar,
887
+ accountIcon: mdiAccount,
888
+ mdiInformationOutline: mdiInformationOutline,
889
+ }
890
+
891
+ const itemOptions = {
892
+ icon: {
893
+ color: 'primary',
894
+ class: 'mt-0 mr-4',
895
+ },
896
+ }
897
+ </script>
898
+ `,
899
+ },
900
+ ],
901
+ },
902
+ args: {
903
+ items: [
904
+ {
905
+ key: 'Nom',
906
+ value: 'Dupont',
907
+ icon: 'accountIcon',
908
+ options: {
909
+ icon: {
910
+ color: 'primary',
911
+ class: 'mt-0 mr-4',
912
+ },
913
+ },
914
+ },
915
+ {
916
+ key: 'Prénom',
917
+ value: 'Paul',
918
+ icon: 'accountIcon',
919
+ options: {
920
+ icon: {
921
+ color: 'primary',
922
+ class: 'mt-0 mr-4',
923
+ },
924
+ },
925
+ },
926
+ {
927
+ key: 'Date de naissance',
928
+ value: '24/09/1970',
929
+ icon: 'calendarIcon',
930
+ options: {
931
+ icon: {
932
+ color: 'primary',
933
+ class: 'mt-0 mr-4',
934
+ },
935
+ },
936
+ },
937
+ ],
938
+ icons: {
939
+ calendarIcon: mdiCalendar,
940
+ accountIcon: mdiAccount,
941
+ mdiInformationOutline: mdiInformationOutline,
942
+ },
943
+ },
944
+ render: (args) => {
945
+ return {
946
+ components: { DataList },
947
+ setup() {
948
+ return { args }
949
+ },
950
+ template: `
951
+ <div class="pa-4">
952
+ <DataList
953
+ :items="args.items"
954
+ :icons="args.icons"
955
+ />
956
+ </div>
957
+ `,
958
+ }
959
+ },
960
+ }