@cnamts/synapse 1.1.0 → 1.1.1

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 (202) hide show
  1. package/dist/{AutocompleteFilter-DXd4szWO.js → AutocompleteFilter-CGF33skz.js} +1 -1
  2. package/dist/{DateFilter-BD59Kgwf.js → DateFilter-D7-MsKtx.js} +1 -1
  3. package/dist/{NumberFilter-BSMZE7uw.js → NumberFilter-bjQPPfsj.js} +1 -1
  4. package/dist/{PeriodFilter-keUdSSk0.js → PeriodFilter-B3wJpK8-.js} +1 -1
  5. package/dist/{SelectFilter-Dhvvwazl.js → SelectFilter-BN6DbKAV.js} +1 -1
  6. package/dist/{TextFilter-CU8FpXz0.js → TextFilter-BffP0J2f.js} +1 -1
  7. package/dist/{apLightTheme2026-DbS7BPUf.js → apLightTheme2026-C4ygwMHC.js} +11 -11
  8. package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +6 -6
  9. package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +6 -6
  10. package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +6 -6
  11. package/dist/components/Captcha/Captcha.d.ts +27 -16
  12. package/dist/components/Captcha/CaptchaForm.d.ts +29 -3
  13. package/dist/components/Captcha/types.d.ts +14 -0
  14. package/dist/components/Captcha/useCaptchaValidation.d.ts +37 -0
  15. package/dist/components/Customs/Selects/SelectBtnField/SelectBtnField.d.ts +33 -13
  16. package/dist/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.d.ts +23 -0
  17. package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +2 -2
  18. package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +2 -2
  19. package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +17 -48
  20. package/dist/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.d.ts +29 -0
  21. package/dist/components/Customs/SyCheckBoxGroup/types.d.ts +46 -0
  22. package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +16 -51
  23. package/dist/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.d.ts +27 -0
  24. package/dist/components/Customs/SyCheckbox/types.d.ts +49 -0
  25. package/dist/components/Customs/SyTextField/FieldState.d.ts +5 -0
  26. package/dist/components/Customs/SyTextField/useSyTextFieldValidation.d.ts +3 -3
  27. package/dist/components/DialogBox/DialogBox.d.ts +2 -0
  28. package/dist/components/DialogBox/locales.d.ts +1 -0
  29. package/dist/components/FilterSideBar/FilterSideBar.d.ts +4 -0
  30. package/dist/components/LunarCalendar/LunarCalendar.d.ts +43 -14
  31. package/dist/components/LunarCalendar/types.d.ts +35 -0
  32. package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +11 -12
  33. package/dist/components/MonthPicker/MonthPicker.d.ts +72 -1747
  34. package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +21 -1733
  35. package/dist/components/MonthPicker/MonthPickerText/useTextField.d.ts +5 -0
  36. package/dist/components/MonthPicker/locales.d.ts +1 -0
  37. package/dist/components/MonthPicker/types.d.ts +11 -0
  38. package/dist/components/MonthPicker/useMonthPickerValidation.d.ts +37 -24
  39. package/dist/components/NirField/NirField.d.ts +6 -4
  40. package/dist/components/NirField/useNirValidation.d.ts +7 -5
  41. package/dist/components/PageContainer/PageContainer.d.ts +8 -0
  42. package/dist/components/PasswordField/PasswordField.d.ts +2 -2
  43. package/dist/components/PasswordField/usePasswordFieldValidation.d.ts +2 -2
  44. package/dist/components/PhoneField/PhoneField.d.ts +960 -1938
  45. package/dist/components/PhoneField/indicatifs.d.ts +715 -8
  46. package/dist/components/PhoneField/locales.d.ts +7 -0
  47. package/dist/components/PhoneField/types.d.ts +29 -0
  48. package/dist/components/PhoneField/usePhoneFieldValidation.d.ts +45 -0
  49. package/dist/components/PhoneField/usePhoneIndicatifs.d.ts +947 -0
  50. package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +2 -2
  51. package/dist/composables/unifyValidation/documentationValidationProps.d.ts +1 -1
  52. package/dist/composables/unifyValidation/useValidation.d.ts +4 -5
  53. package/dist/design-system-v3.js +2 -2
  54. package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +10 -10
  55. package/dist/designTokens/tokens/baseTokens.d.ts +18 -18
  56. package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +10 -10
  57. package/dist/designTokens/tokens/pa/paLightTheme.d.ts +10 -10
  58. package/dist/designTokens/tokens/semanticTokens.d.ts +14 -14
  59. package/dist/{main-D8ryUoS5.js → main-C4wAktOs.js} +13718 -12991
  60. package/dist/synapse.css +1 -1
  61. package/dist/vuetifyConfig.js +1 -1
  62. package/package.json +7 -7
  63. package/src/assets/compat/_legacy-tokens.scss +91 -0
  64. package/src/assets/overrides/_utilities.scss +23 -0
  65. package/src/components/Accordion/Accordion.stories.ts +121 -1
  66. package/src/components/BackBtn/BackBtn.mdx +1 -1
  67. package/src/components/BackToTopBtn/BackToTopBtn.mdx +0 -1
  68. package/src/components/Captcha/Captcha.stories.ts +134 -31
  69. package/src/components/Captcha/Captcha.vue +95 -28
  70. package/src/components/Captcha/CaptchaForm.vue +51 -22
  71. package/src/components/Captcha/tests/Captcha.focus.spec.ts +214 -0
  72. package/src/components/Captcha/tests/Captcha.spec.ts +233 -24
  73. package/src/components/Captcha/tests/CaptchaForm.spec.ts +82 -0
  74. package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +16 -42
  75. package/src/components/Captcha/types.ts +15 -0
  76. package/src/components/Captcha/useCaptchaValidation.ts +87 -0
  77. package/src/components/Captcha/validation/validation.stories.ts +1194 -0
  78. package/src/components/ChipList/ChipList.mdx +0 -1
  79. package/src/components/CollapsibleList/CollapsibleList.mdx +0 -1
  80. package/src/components/CookieBanner/CookieBanner.mdx +0 -1
  81. package/src/components/CopyBtn/CopyBtn.mdx +0 -1
  82. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +123 -439
  83. package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +147 -41
  84. package/src/components/Customs/Selects/SelectBtnField/Validation/Validation.stories.ts +600 -0
  85. package/src/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.ts +87 -0
  86. package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +402 -33
  87. package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/SelectBtnField.spec.ts.snap +52 -38
  88. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +342 -162
  89. package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +77 -129
  90. package/src/components/Customs/SyCheckBoxGroup/Validation/Validation.stories.ts +1008 -0
  91. package/src/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.ts +107 -0
  92. package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.spec.ts +180 -7
  93. package/src/components/Customs/SyCheckBoxGroup/types.ts +49 -0
  94. package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +41 -161
  95. package/src/components/Customs/SyCheckbox/SyCheckbox.vue +71 -148
  96. package/src/components/Customs/SyCheckbox/Validation/Validation.stories.ts +654 -0
  97. package/src/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.ts +105 -0
  98. package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +106 -0
  99. package/src/components/Customs/SyCheckbox/tests/useSyCheckboxValidation.spec.ts +98 -0
  100. package/src/components/Customs/SyCheckbox/types.ts +51 -0
  101. package/src/components/Customs/SyTextField/FieldState.vue +50 -0
  102. package/src/components/Customs/SyTextField/SyTextField.vue +12 -9
  103. package/src/components/Customs/SyTextField/useSyTextFieldValidation.ts +2 -11
  104. package/src/components/DataList/DataList.mdx +0 -1
  105. package/src/components/DataListGroup/DataListGroup.mdx +0 -1
  106. package/src/components/DiacriticPicker/DiacriticPicker.mdx +0 -1
  107. package/src/components/DialogBox/DialogBox.mdx +0 -1
  108. package/src/components/DialogBox/DialogBox.stories.ts +399 -4
  109. package/src/components/DialogBox/DialogBox.vue +20 -0
  110. package/src/components/DialogBox/locales.ts +1 -0
  111. package/src/components/DialogBox/tests/DialogBox.spec.ts +73 -0
  112. package/src/components/DialogBox/tests/DialogBox.visual.cy.ts +24 -0
  113. package/src/components/ErrorPage/ErrorPage.mdx +1 -1
  114. package/src/components/ExternalLinks/ExternalLinks.mdx +0 -1
  115. package/src/components/FileList/FileList.mdx +0 -1
  116. package/src/components/FilterInline/FilterInline.mdx +0 -1
  117. package/src/components/FilterSideBar/FilterSideBar.mdx +8 -1
  118. package/src/components/FilterSideBar/FilterSideBar.stories.ts +133 -1
  119. package/src/components/FilterSideBar/FilterSideBar.vue +19 -2
  120. package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +55 -0
  121. package/src/components/FooterBar/FooterBar.mdx +0 -1
  122. package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +0 -1
  123. package/src/components/HeaderBar/HeaderBar.mdx +0 -1
  124. package/src/components/HeaderLoading/HeaderLoading.mdx +0 -1
  125. package/src/components/LangBtn/LangBtn.mdx +0 -1
  126. package/src/components/Logo/Logo.mdx +1 -1
  127. package/src/components/LunarCalendar/LunarCalendar.mdx +6 -9
  128. package/src/components/LunarCalendar/LunarCalendar.stories.ts +243 -46
  129. package/src/components/LunarCalendar/LunarCalendar.vue +61 -26
  130. package/src/components/LunarCalendar/Validation/Validation.stories.ts +717 -0
  131. package/src/components/LunarCalendar/tests/LunarCalendar.a11y.spec.ts +1 -1
  132. package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +197 -6
  133. package/src/components/LunarCalendar/tests/useLunarCalendarValidation.spec.ts +287 -0
  134. package/src/components/LunarCalendar/types.ts +39 -0
  135. package/src/components/LunarCalendar/useLunarCalendarValidation.ts +115 -39
  136. package/src/components/MonthPicker/MonthPicker.stories.ts +38 -281
  137. package/src/components/MonthPicker/MonthPicker.vue +66 -17
  138. package/src/components/MonthPicker/MonthPickerText/MonthPickerInput.vue +44 -20
  139. package/src/components/MonthPicker/MonthPickerText/useTextField.ts +5 -0
  140. package/src/components/MonthPicker/Validation/Validation.stories.ts +1117 -0
  141. package/src/components/MonthPicker/locales.ts +1 -0
  142. package/src/components/MonthPicker/tests/MonthPicker.spec.ts +353 -2
  143. package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +12 -8
  144. package/src/components/MonthPicker/types.ts +16 -0
  145. package/src/components/MonthPicker/useMonthPickerValidation.ts +64 -27
  146. package/src/components/NirField/NirField.mdx +120 -66
  147. package/src/components/NirField/NirField.stories.ts +216 -0
  148. package/src/components/NirField/useNirValidation.ts +16 -17
  149. package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +263 -245
  150. package/src/components/NotificationBar/NotificationBar.mdx +0 -1
  151. package/src/components/PageContainer/PageContainer.mdx +0 -1
  152. package/src/components/PageContainer/PageContainer.stories.ts +170 -2
  153. package/src/components/PageContainer/PageContainer.vue +63 -8
  154. package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +19 -11
  155. package/src/components/PaginatedTable/PaginatedTable.mdx +0 -1
  156. package/src/components/PeriodField/PeriodField.mdx +0 -1
  157. package/src/components/PhoneField/PhoneField.mdx +2 -3
  158. package/src/components/PhoneField/PhoneField.stories.ts +227 -410
  159. package/src/components/PhoneField/PhoneField.vue +204 -438
  160. package/src/components/PhoneField/indicatifs.ts +1 -1
  161. package/src/components/PhoneField/locales.ts +7 -0
  162. package/src/components/PhoneField/tests/PhoneField.a11y.spec.ts +0 -1
  163. package/src/components/PhoneField/tests/PhoneField.spec.ts +517 -220
  164. package/src/components/PhoneField/types.ts +30 -0
  165. package/src/components/PhoneField/usePhoneFieldValidation.ts +119 -0
  166. package/src/components/PhoneField/usePhoneIndicatifs.ts +89 -0
  167. package/src/components/PhoneField/validation/validation.stories.ts +717 -0
  168. package/src/components/RangeField/RangeField.mdx +0 -1
  169. package/src/components/RatingPicker/RatingPicker.mdx +0 -1
  170. package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +0 -1
  171. package/src/components/StatusPage/StatusPage.vue +1 -0
  172. package/src/components/StatusPage/tests/__snapshots__/StatusPage.spec.ts.snap +248 -230
  173. package/src/components/SubHeader/SubHeader.mdx +5 -6
  174. package/src/components/Tables/common/tests/SyTableFilter.spec.ts +11 -12
  175. package/src/components/UploadWorkflow/UploadWorkflow.mdx +0 -1
  176. package/src/components/UserMenuBtn/UserMenuBtn.mdx +0 -1
  177. package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +177 -0
  178. package/src/composables/unifyValidation/documentationValidationProps.ts +1 -1
  179. package/src/composables/unifyValidation/tests/useValidation.spec.ts +13 -1
  180. package/src/composables/unifyValidation/useValidation.ts +37 -33
  181. package/src/composantsVuetify/VCard/VCard.mdx +4 -0
  182. package/src/composantsVuetify/VCard/v-card.stories.ts +93 -1
  183. package/src/composantsVuetify/VCarousel/VCarousel.mdx +74 -0
  184. package/src/composantsVuetify/VCarousel/v-carousel.stories.ts +531 -0
  185. package/src/composantsVuetify/VNavigationDrawer/VNavgationDrawer.mdx +53 -0
  186. package/src/composantsVuetify/VNavigationDrawer/v-navigation-drawer.stories.ts +310 -0
  187. package/src/composantsVuetify/VSlideGroup/VSlideGroup.mdx +105 -0
  188. package/src/composantsVuetify/VSlideGroup/v-slide-group.stories.ts +463 -0
  189. package/src/designTokens/tokens/baseColors.ts +1 -1
  190. package/src/designTokens/tokens/baseTokens.ts +18 -18
  191. package/src/stories/Components/Components.stories.ts +34 -1
  192. package/src/stories/Demarrer/Releases.stories.ts +16 -2
  193. package/src/stories/DesignTokens/Arrondis.mdx +1 -1
  194. package/src/stories/DesignTokens/Correspondances.mdx +219 -0
  195. package/src/stories/DesignTokens/UtiliserLesTokens.mdx +235 -0
  196. package/src/stories/DesignTokens/colors.stories.ts +569 -569
  197. package/src/stories/GuideDuDev/Amelipro.stories.ts +335 -267
  198. package/dist/components/LunarCalendar/useLunarCalendarRules.d.ts +0 -5
  199. package/dist/components/PhoneField/tests/types.d.ts +0 -18
  200. package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +0 -184
  201. package/src/components/LunarCalendar/useLunarCalendarRules.ts +0 -96
  202. package/src/components/PhoneField/tests/types.d.ts +0 -19
@@ -1,8 +1,7 @@
1
1
  import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import { onMounted, ref } from 'vue'
2
3
  import SelectBtnField from './SelectBtnField.vue'
3
- import SyAlert from '@/components/SyAlert/SyAlert.vue'
4
- import { VBtn } from 'vuetify/components'
5
- import { ref } from 'vue'
4
+ import { getValidationDocumentation } from '@/composables/unifyValidation/documentationValidationProps'
6
5
 
7
6
  const meta = {
8
7
  title: 'Composants/Formulaires/Selects/SelectBtnField',
@@ -17,6 +16,7 @@ const meta = {
17
16
  controls: { exclude: ['copy'] },
18
17
  },
19
18
  argTypes: {
19
+ ...getValidationDocumentation('base'),
20
20
  modelValue: {
21
21
  control: { SelectBtnField },
22
22
  default: null,
@@ -47,22 +47,11 @@ const meta = {
47
47
  control: { type: 'boolean' },
48
48
  default: false,
49
49
  },
50
- hint: {
50
+ helpText: {
51
+ description: 'Texte d’aide permanent affiché sous le champ.',
51
52
  control: { type: 'text' },
52
53
  default: undefined,
53
54
  },
54
- error: {
55
- control: { type: 'boolean' },
56
- default: false,
57
- },
58
- errorMessages: {
59
- control: { type: 'text' },
60
- default: undefined,
61
- },
62
- readonly: {
63
- control: { type: 'boolean' },
64
- default: false,
65
- },
66
55
  },
67
56
  } satisfies Meta<typeof SelectBtnField>
68
57
 
@@ -92,23 +81,13 @@ export const Default: Story = {
92
81
  code: `<script setup lang="ts">
93
82
  import { SelectBtnField } from '@cnamts/synapse'
94
83
  import { ref } from 'vue'
95
-
84
+
96
85
  const value = ref([])
97
86
  const items = [
98
- {
99
- text: 'Email',
100
- value: 'email',
101
- },
102
- {
103
- text: 'Courrier',
104
- value: 'courrier',
105
- },
106
- {
107
- text: 'SMS',
108
- value: 'sms',
109
- },
87
+ { text: 'Email', value: 'email' },
88
+ { text: 'Courrier', value: 'courrier' },
89
+ { text: 'SMS', value: 'sms' },
110
90
  ]
111
-
112
91
  </script>
113
92
  `,
114
93
  },
@@ -117,24 +96,12 @@ export const Default: Story = {
117
96
  args: {
118
97
  modelValue: null,
119
98
  items: [
120
- {
121
- text: 'Email',
122
- value: 'email',
123
- },
124
- {
125
- text: 'Courrier',
126
- value: 'courrier',
127
- },
128
- {
129
- text: 'SMS',
130
- value: 'sms',
131
- },
99
+ { text: 'Email', value: 'email' },
100
+ { text: 'Courrier', value: 'courrier' },
101
+ { text: 'SMS', value: 'sms' },
132
102
  ],
133
103
  multiple: false,
134
104
  inline: false,
135
- hint: undefined,
136
- error: false,
137
- errorMessages: undefined,
138
105
  readonly: false,
139
106
  },
140
107
  render: (args) => {
@@ -152,9 +119,7 @@ export const Default: Story = {
152
119
  :label="args.label"
153
120
  :multiple="args.multiple"
154
121
  :inline="args.inline"
155
- :hint="args.hint"
156
- :error="args.error"
157
- :error-messages="args.errorMessages"
122
+ :help-text="args.helpText"
158
123
  :readonly="args.readonly"
159
124
  aria-labelledby="contact-method"
160
125
  />
@@ -164,6 +129,67 @@ export const Default: Story = {
164
129
  },
165
130
  }
166
131
 
132
+ export const Required: Story = {
133
+ parameters: {
134
+ docs: {
135
+ description: {
136
+ story: 'Champ requis : la validation `required` se déclenche à la soumission (`validateOnSubmit`).',
137
+ },
138
+ },
139
+ sourceCode: [
140
+ {
141
+ name: 'Script',
142
+ code: `<script setup lang="ts">
143
+ import { onMounted, ref } from 'vue'
144
+ import { SelectBtnField } from '@cnamts/synapse'
145
+
146
+ const value = ref(null)
147
+ const fieldRef = ref(null)
148
+
149
+ onMounted(() => {
150
+ fieldRef.value?.validateOnSubmit()
151
+ })
152
+ </script>`,
153
+ },
154
+ ],
155
+ },
156
+ args: {
157
+ modelValue: null,
158
+ items: [
159
+ { text: 'Email', value: 'email' },
160
+ { text: 'Courrier', value: 'courrier' },
161
+ { text: 'SMS', value: 'sms' },
162
+ ],
163
+ label: 'Moyen de contact',
164
+ required: true,
165
+ },
166
+ render: (args) => {
167
+ return {
168
+ components: { SelectBtnField },
169
+ setup() {
170
+ const fieldRef = ref<{ validateOnSubmit: () => Promise<boolean> } | null>(null)
171
+ onMounted(() => {
172
+ fieldRef.value?.validateOnSubmit()
173
+ })
174
+ return { args, fieldRef }
175
+ },
176
+ template: `
177
+ <div style="max-width: 400px">
178
+ <h2 id="contact-method" class="text-h6">Choisissez votre moyen de contact :</h2>
179
+ <SelectBtnField
180
+ ref="fieldRef"
181
+ v-model="args.modelValue"
182
+ :items="args.items"
183
+ label="Moyen de contact"
184
+ aria-labelledby="contact-method"
185
+ required
186
+ />
187
+ </div>
188
+ `,
189
+ }
190
+ },
191
+ }
192
+
167
193
  export const Multiple: Story = {
168
194
  parameters: {
169
195
  sourceCode: [
@@ -185,23 +211,14 @@ export const Multiple: Story = {
185
211
  {
186
212
  name: 'Script',
187
213
  code: `<script setup lang="ts">
188
- import { SelectBtnField } from '@cnamts/synapse'
214
+ import { SelectBtnField } from '@cnamts/synapse'
189
215
  import { ref } from 'vue'
190
-
216
+
191
217
  const value = ref([])
192
218
  const items = [
193
- {
194
- text: 'Email',
195
- value: 'email',
196
- },
197
- {
198
- text: 'Courrier',
199
- value: 'courrier',
200
- },
201
- {
202
- text: 'SMS',
203
- value: 'sms',
204
- },
219
+ { text: 'Email', value: 'email' },
220
+ { text: 'Courrier', value: 'courrier' },
221
+ { text: 'SMS', value: 'sms' },
205
222
  ]
206
223
  </script>
207
224
  `,
@@ -211,18 +228,9 @@ export const Multiple: Story = {
211
228
  args: {
212
229
  modelValue: null,
213
230
  items: [
214
- {
215
- text: 'Email',
216
- value: 'email',
217
- },
218
- {
219
- text: 'Courrier',
220
- value: 'courrier',
221
- },
222
- {
223
- text: 'SMS',
224
- value: 'sms',
225
- },
231
+ { text: 'Email', value: 'email' },
232
+ { text: 'Courrier', value: 'courrier' },
233
+ { text: 'SMS', value: 'sms' },
226
234
  ],
227
235
  multiple: true,
228
236
  },
@@ -268,23 +276,14 @@ export const inline: Story = {
268
276
  {
269
277
  name: 'Script',
270
278
  code: `<script setup lang="ts">
271
- import { SelectBtnField } from '@cnamts/synapse'
279
+ import { SelectBtnField } from '@cnamts/synapse'
272
280
  import { ref } from 'vue'
273
-
281
+
274
282
  const value = ref([])
275
283
  const items = [
276
- {
277
- text: 'Email',
278
- value: 'email',
279
- },
280
- {
281
- text: 'Courrier',
282
- value: 'courrier',
283
- },
284
- {
285
- text: 'SMS',
286
- value: 'sms',
287
- },
284
+ { text: 'Email', value: 'email' },
285
+ { text: 'Courrier', value: 'courrier' },
286
+ { text: 'SMS', value: 'sms' },
288
287
  ]
289
288
  </script>
290
289
  `,
@@ -294,18 +293,9 @@ export const inline: Story = {
294
293
  args: {
295
294
  modelValue: null,
296
295
  items: [
297
- {
298
- text: 'Email',
299
- value: 'email',
300
- },
301
- {
302
- text: 'Courrier',
303
- value: 'courrier',
304
- },
305
- {
306
- text: 'SMS',
307
- value: 'sms',
308
- },
296
+ { text: 'Email', value: 'email' },
297
+ { text: 'Courrier', value: 'courrier' },
298
+ { text: 'SMS', value: 'sms' },
309
299
  ],
310
300
  inline: true,
311
301
  },
@@ -339,8 +329,8 @@ export const itemUnique: Story = {
339
329
  <div style="max-width: 400px">
340
330
  <h2 id="contact-method" class="text-h6">Choisissez votre moyen de contact :</h2>
341
331
  <SelectBtnField
342
- v-model="args.modelValue"
343
- :items="args.items"
332
+ v-model="value"
333
+ :items="items"
344
334
  aria-labelledby="contact-method"
345
335
  multiple
346
336
  />
@@ -351,28 +341,15 @@ export const itemUnique: Story = {
351
341
  {
352
342
  name: 'Script',
353
343
  code: `<script setup lang="ts">
354
- import { SelectBtnField } from '@cnamts/synapse'
344
+ import { SelectBtnField } from '@cnamts/synapse'
355
345
  import { ref } from 'vue'
356
-
346
+
357
347
  const value = ref([])
358
348
  const items = [
359
- {
360
- text: 'Email',
361
- value: 'email',
362
- },
363
- {
364
- text: 'Courrier',
365
- value: 'courrier',
366
- },
367
- {
368
- text: 'SMS',
369
- value: 'sms',
370
- },
371
- {
372
- text: 'Autre',
373
- value: 'other',
374
- unique: true
375
- }
349
+ { text: 'Email', value: 'email' },
350
+ { text: 'Courrier', value: 'courrier' },
351
+ { text: 'SMS', value: 'sms' },
352
+ { text: 'Autre', value: 'other', unique: true },
376
353
  ]
377
354
  </script>
378
355
  `,
@@ -382,23 +359,10 @@ export const itemUnique: Story = {
382
359
  args: {
383
360
  modelValue: null,
384
361
  items: [
385
- {
386
- text: 'Email',
387
- value: 'email',
388
- },
389
- {
390
- text: 'Courrier',
391
- value: 'courrier',
392
- },
393
- {
394
- text: 'SMS',
395
- value: 'sms',
396
- },
397
- {
398
- text: 'Autre',
399
- value: 'other',
400
- unique: true,
401
- },
362
+ { text: 'Email', value: 'email' },
363
+ { text: 'Courrier', value: 'courrier' },
364
+ { text: 'SMS', value: 'sms' },
365
+ { text: 'Autre', value: 'other', unique: true },
402
366
  ],
403
367
  multiple: true,
404
368
  },
@@ -427,7 +391,7 @@ export const itemUnique: Story = {
427
391
  },
428
392
  }
429
393
 
430
- export const messageAide: Story = {
394
+ export const HelpText: Story = {
431
395
  parameters: {
432
396
  sourceCode: [
433
397
  {
@@ -439,7 +403,7 @@ export const messageAide: Story = {
439
403
  v-model="value"
440
404
  :items="items"
441
405
  aria-labelledby="contact-method"
442
- hint="Par défaut, le moyen de contact est l’email."
406
+ help-text="Par défaut, le moyen de contact est l’email."
443
407
  />
444
408
  </div>
445
409
  </template>
@@ -448,23 +412,14 @@ export const messageAide: Story = {
448
412
  {
449
413
  name: 'Script',
450
414
  code: `<script setup lang="ts">
451
- import { SelectBtnField } from '@cnamts/synapse'
415
+ import { SelectBtnField } from '@cnamts/synapse'
452
416
  import { ref } from 'vue'
453
-
417
+
454
418
  const value = ref([])
455
419
  const items = [
456
- {
457
- text: 'Email',
458
- value: 'email',
459
- },
460
- {
461
- text: 'Courrier',
462
- value: 'courrier',
463
- },
464
- {
465
- text: 'SMS',
466
- value: 'sms',
467
- },
420
+ { text: 'Email', value: 'email' },
421
+ { text: 'Courrier', value: 'courrier' },
422
+ { text: 'SMS', value: 'sms' },
468
423
  ]
469
424
  </script>
470
425
  `,
@@ -474,20 +429,11 @@ export const messageAide: Story = {
474
429
  args: {
475
430
  modelValue: null,
476
431
  items: [
477
- {
478
- text: 'Email',
479
- value: 'email',
480
- },
481
- {
482
- text: 'Courrier',
483
- value: 'courrier',
484
- },
485
- {
486
- text: 'SMS',
487
- value: 'sms',
488
- },
432
+ { text: 'Email', value: 'email' },
433
+ { text: 'Courrier', value: 'courrier' },
434
+ { text: 'SMS', value: 'sms' },
489
435
  ],
490
- hint: 'Par défaut, le moyen de contact est l’email.',
436
+ helpText: 'Par défaut, le moyen de contact est l’email.',
491
437
  },
492
438
  render: (args) => {
493
439
  return {
@@ -502,7 +448,7 @@ export const messageAide: Story = {
502
448
  v-model="args.modelValue"
503
449
  :items="args.items"
504
450
  aria-labelledby="contact-method"
505
- :hint="args.hint"
451
+ :help-text="args.helpText"
506
452
  />
507
453
  </div>
508
454
  `,
@@ -510,233 +456,6 @@ export const messageAide: Story = {
510
456
  },
511
457
  }
512
458
 
513
- export const erreur: Story = {
514
- parameters: {
515
- sourceCode: [
516
- {
517
- name: 'Template',
518
- code: `<template>
519
- <div style="max-width: 400px">
520
- <h2 id="contact-method" class="text-h6">Choisissez votre moyen de contact :</h2>
521
- <SelectBtnField
522
- v-model="value"
523
- :items="items"
524
- aria-labelledby="contact-method"
525
- v-model:error="error"
526
- />
527
- <VBtn
528
- color="primary"
529
- class="mt-3"
530
- @click="resetExample"
531
- >
532
- Réinitialiser
533
- </VBtn>
534
- </div>
535
- </template>
536
- `,
537
- },
538
- {
539
- name: 'Script',
540
- code: `<script setup lang="ts">
541
- import { SelectBtnField } from '@cnamts/synapse'
542
- import { ref } from 'vue'
543
- const value = ref([])
544
- const error = ref(true)
545
- const items = [
546
- {
547
- text: 'Email',
548
- value: 'email',
549
- },
550
- {
551
- text: 'Courrier',
552
- value: 'courrier',
553
- },
554
- {
555
- text: 'SMS',
556
- value: 'sms',
557
- },
558
- ]
559
- function resetExample() {
560
- value.value = null
561
- error.value = true
562
- }
563
- </script>
564
- `,
565
- },
566
- ],
567
- },
568
- args: {
569
- modelValue: null,
570
- items: [
571
- {
572
- text: 'Email',
573
- value: 'email',
574
- },
575
- {
576
- text: 'Courrier',
577
- value: 'courrier',
578
- },
579
- {
580
- text: 'SMS',
581
- value: 'sms',
582
- },
583
- ],
584
- error: true,
585
- },
586
- render: (args) => {
587
- return {
588
- components: { SelectBtnField, VBtn },
589
- setup() {
590
- const error = ref(args.error)
591
- const value = ref(args.modelValue)
592
-
593
- function resetExample() {
594
- error.value = true
595
- value.value = null
596
- }
597
- return { args, resetExample, error, value }
598
- },
599
- template: `
600
- <div style="max-width: 400px">
601
- <h2 id="contact-method" class="text-h6">Choisissez votre moyen de contact :</h2>
602
- <SelectBtnField
603
- v-model="value"
604
- :items="args.items"
605
- aria-labelledby="contact-method"
606
- v-model:error="error"
607
- />
608
- <VBtn
609
- color="primary"
610
- class="mt-3"
611
- @click="resetExample"
612
- >
613
- Réinitialiser
614
- </VBtn>
615
- </div>
616
- `,
617
- }
618
- },
619
- }
620
-
621
- export const messageErreur: Story = {
622
- parameters: {
623
- sourceCode: [
624
- {
625
- name: 'Template',
626
- code: `<template>
627
- <div style="max-width: 400px">
628
- <h2 id="contact-method" class="text-h6">Choisissez votre moyen de contact :</h2>
629
- <SelectBtnField
630
- v-model="value"
631
- :items="items"
632
- aria-labelledby="contact-method"
633
- v-model:error="error"
634
- v-model:error-messages="errorMessages"
635
- />
636
- <VBtn
637
- color="primary"
638
- class="mt-3"
639
- @click="resetExample"
640
- >
641
- Réinitialiser
642
- </VBtn>
643
- </div>
644
- </template>
645
- `,
646
- },
647
- {
648
- name: 'Script',
649
- code: `<script setup lang="ts">
650
- import { SelectBtnField } from '@cnamts/synapse'
651
- import { ref } from 'vue'
652
- const value = ref([])
653
- const error = ref(true)
654
- const errorMessages = ref(['Le champ est requis.'])
655
- const items = [
656
- {
657
- text: 'Email',
658
- value: 'email',
659
- },
660
- {
661
- text: 'Courrier',
662
- value: 'courrier',
663
- },
664
- {
665
- text: 'SMS',
666
- value: 'sms',
667
- },
668
- ]
669
- function resetExample() {
670
- value.value = null
671
- error.value = true
672
- errorMessages.value = [
673
- 'Le champ est requis.',
674
- ]
675
- }
676
- </script>
677
- `,
678
- },
679
- ],
680
- },
681
- args: {
682
- modelValue: null,
683
- items: [
684
- {
685
- text: 'Email',
686
- value: 'email',
687
- },
688
- {
689
- text: 'Courrier',
690
- value: 'courrier',
691
- },
692
- {
693
- text: 'SMS',
694
- value: 'sms',
695
- },
696
- ],
697
- error: true,
698
- errorMessages: [
699
- 'Le champ est requis.',
700
- ],
701
- },
702
- render: (args) => {
703
- return {
704
- components: { SelectBtnField, VBtn },
705
- setup() {
706
- const error = ref(args.error)
707
- const value = ref(args.modelValue)
708
- const errorMessages = ref(args.errorMessages)
709
-
710
- function resetExample() {
711
- error.value = true
712
- value.value = null
713
- errorMessages.value = ['Le champ est requis.']
714
- }
715
- return { args, resetExample, error, value, errorMessages }
716
- },
717
- template: `
718
- <div style="max-width: 400px">
719
- <h2 id="contact-method" class="text-h6">Choisissez votre moyen de contact :</h2>
720
- <SelectBtnField
721
- v-model="value"
722
- :items="args.items"
723
- aria-labelledby="contact-method"
724
- v-model:error="error"
725
- v-model:error-messages="errorMessages"
726
- />
727
- <VBtn
728
- color="primary"
729
- class="mt-3"
730
- @click="resetExample"
731
- >
732
- Réinitialiser
733
- </VBtn>
734
- </div>
735
- `,
736
- }
737
- },
738
- }
739
-
740
459
  export const readonly: Story = {
741
460
  parameters: {
742
461
  sourceCode: [
@@ -758,22 +477,14 @@ export const readonly: Story = {
758
477
  {
759
478
  name: 'Script',
760
479
  code: `<script setup lang="ts">
761
- import { SelectBtnField } from '@cnamts/synapse'
762
- import { ref } from 'vue'
480
+ import { SelectBtnField } from '@cnamts/synapse'
481
+ import { ref } from 'vue'
482
+
763
483
  const value = ref(['email'])
764
484
  const items = [
765
- {
766
- text: 'Email',
767
- value: 'email',
768
- },
769
- {
770
- text: 'Courrier',
771
- value: 'courrier',
772
- },
773
- {
774
- text: 'SMS',
775
- value: 'sms',
776
- },
485
+ { text: 'Email', value: 'email' },
486
+ { text: 'Courrier', value: 'courrier' },
487
+ { text: 'SMS', value: 'sms' },
777
488
  ]
778
489
  </script>
779
490
  `,
@@ -783,18 +494,9 @@ export const readonly: Story = {
783
494
  args: {
784
495
  modelValue: ['email'],
785
496
  items: [
786
- {
787
- text: 'Email',
788
- value: 'email',
789
- },
790
- {
791
- text: 'Courrier',
792
- value: 'courrier',
793
- },
794
- {
795
- text: 'SMS',
796
- value: 'sms',
797
- },
497
+ { text: 'Email', value: 'email' },
498
+ { text: 'Courrier', value: 'courrier' },
499
+ { text: 'SMS', value: 'sms' },
798
500
  ],
799
501
  label: 'Moyen de contact',
800
502
  readonly: true,
@@ -819,21 +521,3 @@ export const readonly: Story = {
819
521
  }
820
522
  },
821
523
  }
822
-
823
- export const Info: Story = {
824
- render: (args) => {
825
- return {
826
- components: { SyAlert },
827
- setup() {
828
- return { args }
829
- },
830
- template: `
831
- <SyAlert v-model="args.modelValue" :type="args.type" :variant="tonal" :closable="false">
832
- <template #default>Vous pouvez utiliser le modificateur v-model:error pour réinitialiser l’erreur lorsque l’utilisateur modifie la valeur du champ.
833
- </template>
834
- </SyAlert>
835
- `,
836
- }
837
- },
838
- tags: ['!dev'],
839
- }