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